GCC changes in XCode 4.0 and 3.2.6
From XCode 4.0 GM and XCode 3.2.6, I found some my configure scripts for iOS aborted with the following errors.
$ export CFLAGS=-std=c99 -arch armv6 --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
-isystem /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include
$ export LDFLAGS=-arch armv6 --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib
$ ./configure --host="arm-apple-darwin"
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... i386-apple-darwin10.6.0
checking host system type... arm-apple-darwin
checking for arm-apple-darwin-gcc... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
checking for C compiler default output... configure: error: C compiler cannot create executables
According to the config.log, the configure script couldn't build the executable file because the linker couldn't found libcache for armv6.
$ less config.log
......
configure:xxxx: /Developer326/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -std=c99 -arch armv6
--sysroot=/Developer326/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
-isystem /Developer326/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include
-L/Developer326/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib
conftest.c >&5
ld: file not found: /usr/lib/system/libcache.dylib for architecture armv6
collect2: ld returned 1 exit status
configure:xxxx: $? = 1
configure:xxxx: result:
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:xxxx: error: in `xxxx:
configure:xxxx: error: C compiler cannot create executables
......
I created a new sample library project using XCode 4.0 to check the problem, and check the build log. Then I found the XCode uses "-isysroot" option in the link phase. According to GCC - Options for Directory Search, "--sysroot" option has a priority over "-isysroot", but it seems that "--sysroot" option is not working from XCode 4.0 and 3.2.6.
In any case, use '"-isysroot" option instead of "--sysroot" to run your configure scripts from XCode4 and 3.2.6 smile