{"id":5024,"date":"2014-03-30T18:00:02","date_gmt":"2014-03-30T18:00:02","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/cross-compile-apache-portable-runtime-to-the-iphone-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:00:02","modified_gmt":"2014-03-30T18:00:02","slug":"cross-compile-apache-portable-runtime-to-the-iphone-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/cross-compile-apache-portable-runtime-to-the-iphone-collection-of-common-programming-errors\/","title":{"rendered":"Cross-compile Apache Portable Runtime to the iPhone-Collection of common programming errors"},"content":{"rendered":"<p>This is a followup to a previous question on cross-compiling for the iPhone:<br \/>\nhttp:\/\/stackoverflow.com\/questions\/1602182\/cross-compile-autotools-based-libraries-for-official-iphone-sdk<\/p>\n<p>Basically, I am trying to compile the Apache Portable Runtime (APR) version 1.3.8 (latest) for the iPhone. I am currently running into the following error during the configuration step:<\/p>\n<pre>\nchecking for working PROCESS_SHARED locks... configure: error: in `\/Users\/michaelsafyan\/Downloads\/apr-1.3.8':\nconfigure: error: cannot run test program while cross compiling\nSee `config.log' for more details.\n<\/pre>\n<p>I am invoking the &#8220;configure&#8221; script via &#8220;iphone3.1-configure &#8211;disable-dso &#8211;enable-threads&#8221;, where &#8220;iphone3.1-configure&#8221; is the following script that I&#8217;ve cooked-up to invoke the &#8220;configure&#8221; script:<\/p>\n<pre>\n#! \/bin\/bash\n\n#\n# Program  : iphone3.1-configure\n# Authors  : Michael Aaron Safyan (michaelsafyan@gmail.com)\n# Synopsis :\n#            This program runs the \"configure\" script generated by the\n#            GNU Autotools in order to cross-compile thirdparty libraries\n#            for the iPhone 3.1 SDK. Run this script while in a directory\n#            containing an autotools \"configure\" script. Once you run this,\n#            you can use \"make\" and \"sudo make install\" to build the library.\n#            An install prefix of \"\/opt\/iphone-3.1\/\" is used.\n#\n\nunset CPATH\nunset C_INCLUDE_PATH\nunset CPLUS_INCLUDE_PATH\nunset OBJC_INCLUDE_PATH\nunset LIBS\nunset DYLD_FALLBACK_LIBRARY_PATH\nunset DYLD_FALLBACK_FRAMEWORK_PATH\n\nexport BUILD_DARWIN_VER=`uname -r`\nexport SDKVER=\"3.1\"\nexport DEVROOT=\"\/Developer\/Platforms\/iPhoneOS.platform\/Developer\"\nexport SDKROOT=\"$DEVROOT\/SDKs\/iPhoneOS$SDKVER.sdk\"\nexport PKG_CONFIG_PATH=\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/SDKs\/iPhoneOS$SDKVER.sdk\/usr\/lib\/pkgconfig:\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/usr\/lib\/pkgconfig:\/opt\/iphone-$SDKVER\/lib\/pkgconfig:\/usr\/local\/iphone-$SDKVER\/lib\/pkgconfig\nexport PREFIX=\"\/opt\/iphone-$SDKVER\"\nexport AS=\"$DEVROOT\/usr\/bin\/as\"\nexport ASCPP=\"$DEVROOT\/usr\/bin\/as\"\nexport AR=\"$DEVROOT\/usr\/bin\/ar\"\nexport RANLIB=\"$DEVROOT\/usr\/bin\/ranlib\"\nexport CPPFLAGS=\"-pipe -no-cpp-precomp -I$SDKROOT\/usr\/lib\/gcc\/arm-apple-darwin9\/4.2.1\/include\/ -I$SDKROOT\/usr\/include -I$DEVROOT\/usr\/include -I\/opt\/iphone-$SDKVER\/include -I\/usr\/local\/iphone-$SDKVER\/include\"\nexport CFLAGS=\"-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT\/usr\/lib\/gcc\/arm-apple-darwin9\/4.2.1\/include\/ -isystem $SDKROOT\/usr\/include -isystem $DEVROOT\/usr\/include -isystem \/opt\/iphone-$SDKVER\/include -isystem \/usr\/local\/iphone-$SDKVER\/include\"\nexport CXXFLAGS=\"-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT\/usr\/lib\/gcc\/arm-apple-darwin9\/4.2.1\/include\/ -isystem $SDKROOT\/usr\/include -isystem $DEVROOT\/usr\/include -isystem \/opt\/iphone-$SDKVER\/include -isystem \/usr\/local\/iphone-$SDKVER\/include\"\nexport LDFLAGS=\"-arch armv6 --sysroot='$SDKROOT' -L$SDKROOT\/usr\/lib -L$DEVROOT\/usr\/lib -L\/opt\/iphone-$SDKVER\/lib -L\/usr\/local\/iphone-$SDKVER\/lib\"\nexport CPP=\"$DEVROOT\/usr\/bin\/cpp\"\nexport CXXCPP=\"$DEVROOT\/usr\/bin\/cpp\"\nexport CC=\"$DEVROOT\/usr\/bin\/gcc-4.2\"\nexport CXX=\"$DEVROOT\/usr\/bin\/g++-4.2\"\nexport LD=\"$DEVROOT\/usr\/bin\/ld\"\nexport STRIP=\"$DEVROOT\/usr\/bin\/strip\"\n\nif [ ! \\( -d \"$DEVROOT\" \\) ] ; then\n   echo \"The iPhone SDK could not be found. Folder \\\"$DEVROOT\\\" does not exist.\"\n   exit 1\nfi\n\nif [ ! \\( -d \"$SDKROOT\" \\) ] ; then\n   echo \"The iPhone SDK could not be found. Folder \\\"$SDKROOT\\\" does not exist.\"\n   exit 1\nfi\n\n.\/configure --prefix=\"$PREFIX\" --build=\"i386-apple-darwin$BUILD_DARWIN_VER\" --host=\"arm-apple-darwin9\" --enable-static --disable-shared ac_cv_file__dev_zero=no ac_cv_func_setpgrp_void=yes $@\n<\/pre>\n<p>The error that configure is giving me is not the first time I have received a message along the lines of &#8220;cannot run test program while cross compiling&#8221;. In fact, the &#8220;ac_cv_file__dev_zero=no&#8221; and &#8220;ac_cv_func_setpgrp_void=yes&#8221; elements in the &#8220;iphone3.1-configure&#8221; script cause two similarly failing tests to be bypassed. The problem I am having is that I do not know how to bypass this check &#8212; that is, I don&#8217;t know what variable(s) to set to bypass this test and any additional tests that try to run executables built for the target platform. I was able to bypass the earlier two similar tests simply because I was able to locate the workaround on Google&#8230; does anyone know what variables to set or another way to bypass this check?<\/p>\n<p>If anyone knows a way to suppress all tests that cannot be executed when cross-compiling, or if you just know how to suppress this specific check, I would be greatly appreciative. Thank you very much.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a followup to a previous question on cross-compiling for the iPhone: http:\/\/stackoverflow.com\/questions\/1602182\/cross-compile-autotools-based-libraries-for-official-iphone-sdk Basically, I am trying to compile the Apache Portable Runtime (APR) version 1.3.8 (latest) for the iPhone. I am currently running into the following error during the configuration step: checking for working PROCESS_SHARED locks&#8230; configure: error: in `\/Users\/michaelsafyan\/Downloads\/apr-1.3.8&#8242;: configure: error: cannot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5024","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5024"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5024\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}