Can't build MacOS X Tiger binary from Snow Leopard/Xcode 3.2

Can't build MacOS X Tiger binary from Snow Leopard/Xcode 3.2

This is a messy problem and I apologize in advance for the length of this message.

I recently migrated a project from XCode 2.5 on Tiger to XCode 3.2 on Snow Leopard and ran into an unanticipated problem with the Intel C++ compiler 11.1 for OS X ("icc"). I want to build universal applications that are backward compatible to Tiger.

* If I build with gcc using the 10.4 SDK, all goes well (but I want to use icc!).

* If I build with icc using the 10.5 SDK, the build completes successfully and runs on Snow Leopard, but will not launch on Tiger (console output contains an error message about an undefined symbol, and I haven't pursued this further).

* If I build with icc using the 10.4 SDK (which is what I really want to do), my compile dies with the message:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:0 catastrophic error: could not open source file "stdarg.h" (no directories in search list)

The problem is that there is no "stdarg.h" file included in the icc distribution. The header contained in both the 10.4 and 10.5 SDKs looks like this:

/* This file is public domain. */
/* GCC uses its own copy of this header */
#if defined(__GNUC__)
#include_next
#elif defined(__MWERKS__)
#include "mw_stdarg.h"
#else
#error "This header only supports __MWERKS__."
#endif

So what's apparently happening is that __GNUC__ is defined and it tries to go to the next entry in the search path for the "real" stdarg.h, but there is no search path. I can't figure out why this happens with the 10.4 SDK but not the 10.5 SDK, but it seems to be related to use of icc because everything works fine with gcc.

I can force a file trying to include "stdarg.h" to compile successfully by adding "/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/include" to the header search path, but this obviously isn't the right thing to do, as it will always prefer a gcc header rather than an intel one when both are present.

Is there some solution or workaround, or am I just SOL if I want to use XCode 3.2 for the builds?

Thanks,
Dave

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You will not be able to target tiger with ICC 11.1 compiler. See link below regarding UNIX compiliance and $UNIX2003 symbols.

>>* If I build with icc using the 10.5 SDK, the build completes successfully and runs on Snow Leopard, but will not >>launch on Tiger (console output contains an error message about an undefined symbol, and I haven't pursued >>this further).

If it's a UNIX2003 symbols,see this thread:
http://software.intel.com/en-us/forums/showthread.php?t=69540

>> * If I build with icc using the 10.4 SDK (which is what I really want to do), my compile dies with the message:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:0 catastrophic error: could not open source file "stdarg.h" (no directories in search list)

You would get the same error if you were using gcc4.2 which is the default gcc compiler found in the path in Xcode 3.2 on Snow Leopard.

icc actually calls gcc to resolve the environment so it is not surprising that icc and gcc4.2 are failing in the same manner.

try adding the option gcc-name=gcc-4.0 gxx-name=g++-4.0 in the Xcode build tab "Additional Commands", or you can set the compiler to gcc4.0 in Xcode build tab.

See below:

intels-mac-pro:~ ale$ cat t.cpp
#include

GCC 4.0 - passed
================
intels-mac-pro:~ ale$ gcc-4.0 -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c t.cpp

GCC 4.2 default gcc on Snow Leopard - failed
============================================
intels-mac-pro:~ ale$ gcc -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c t.cpp
gcc version 4.2.1 (Apple Inc. build 5646)
In file included from t.cpp:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

ICC 11.1.067 - failed
======================
intels-mac-pro:~ ale$ icc -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c t.cpp
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h(4): catastrophic error: could not open source file "stdarg.h" (no directories in search list)
#include_next
^

ICC 11.1.067 - Passed with when using option -gcc-name=gcc-4.0 -gxx-name=g++-4
===============================================================================
Intels-mac-pro:~ ale$ icc -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c -gcc-name=gcc-4.0 -gxx-name=g++-4.0 t.cpp

As for building a universal binary to target Tiger, It's not possible with 11.1 compiler, since the 11.1 runtime libraries are built on Leopard, which has the $UNIX2003 symbols in them.

Hi Qale,

Thanks for the prompt reply; I really appreciate it. I just want to confirm the following conclusions:

1. I can't build for Tiger using 11.1.

2. I can, however, build for Tiger using 10.1, but...

3. I can't use 10.1, even with Xcode 2.5, on Snow Leopard.

I tried re-installing 10.1 and building my project, but all of the builtin functions like__builtin_object_size and __builtin___strncpy_chk are missing. Is there a workaround for this?

If not, I guess I'm just completely hosed. Is it just impossible to build a Tiger binary using any version of the Intel compiler on Snow Leopard? If so, I've just made a very big mistake in upgrading my system to icc 11.1 and Snow Leopard.

Dave

Quoting - Qale (Intel)
You will not be able to target tiger with ICC 11.1 compiler. See link below regarding UNIX compiliance and $UNIX2003 symbols.

>>* If I build with icc using the 10.5 SDK, the build completes successfully and runs on Snow Leopard, but will not >>launch on Tiger (console output contains an error message about an undefined symbol, and I haven't pursued >>this further).

If it's a UNIX2003 symbols,see this thread:
http://software.intel.com/en-us/forums/showthread.php?t=69540

>> * If I build with icc using the 10.4 SDK (which is what I really want to do), my compile dies with the message:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:0 catastrophic error: could not open source file "stdarg.h" (no directories in search list)

You would get the same error if you were using gcc4.2 which is the default gcc compiler found in the path in Xcode 3.2 on Snow Leopard.

icc actually calls gcc to resolve the environment so it is not surprising that icc and gcc4.2 are failing in the same manner.

try adding the option gcc-name=gcc-4.0 gxx-name=g++-4.0 in the Xcode build tab "Additional Commands", or you can set the compiler to gcc4.0 in Xcode build tab.

See below:

intels-mac-pro:~ ale$ cat t.cpp
#include

GCC 4.0 - passed
================
intels-mac-pro:~ ale$ gcc-4.0 -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c t.cpp

GCC 4.2 default gcc on Snow Leopard - failed
============================================
intels-mac-pro:~ ale$ gcc -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c t.cpp
gcc version 4.2.1 (Apple Inc. build 5646)
In file included from t.cpp:1:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

ICC 11.1.067 - failed
======================
intels-mac-pro:~ ale$ icc -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c t.cpp
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h(4): catastrophic error: could not open source file "stdarg.h" (no directories in search list)
#include_next
^

ICC 11.1.067 - Passed with when using option -gcc-name=gcc-4.0 -gxx-name=g++-4
===============================================================================
Intels-mac-pro:~ ale$ icc -x c++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -c -gcc-name=gcc-4.0 -gxx-name=g++-4.0 t.cpp

As for building a universal binary to target Tiger, It's not possible with 11.1 compiler, since the 11.1 runtime libraries are built on Leopard, which has the $UNIX2003 symbols in them.

Hi Qale,

>>> Thanks for the prompt reply; I really appreciate it. I just want to confirm the following conclusions:

>>> 1. I can't build for Tiger using 11.1.

Unfortunately, No. The 11.1 compiler and the compiler runtime librarieswere built on Leopard OS 10.5 which has the $UNIX2003 symbols

>>> 2. I can, however, build for Tiger using 10.1, but...
>>> 3. I can't use 10.1, even with Xcode 2.5, on Snow Leopard.

No, you can't use icc 10.1 on Snow Leopard. The supported OS/Xcode/Intel compiler support:
http://software.intel.com/en-us/articles/performance-tools-for-software-developers-compatibility-of-intel-compiler-for-mac-os-x-and-xcode/

>>> If not, I guess I'm just completely hosed. Is it just impossible to build a Tiger binary using any version of the Intel compiler on Snow Leopard? If so, I've just made a very big mistake in upgrading my system to icc 11.1 and Snow Leopard.

One possible solution might be for the Intel Compilerdevelopers to create a redistributable library separate from the11.1 compiler for targeting Tiger.

Ok, thanks. I wasn't sure if "(un)supported" in that table meant "can't do the build" or "can't run the binary".

I guess I'll have to find another solution. I can't give up Tiger support just yet.

Dave

Quoting - Qale (Intel)

Hi Qale,

>>> Thanks for the prompt reply; I really appreciate it. I just want to confirm the following conclusions:

>>> 1. I can't build for Tiger using 11.1.

Unfortunately, No. The 11.1 compiler and the compiler runtime librarieswere built on Leopard OS 10.5 which has the $UNIX2003 symbols

>>> 2. I can, however, build for Tiger using 10.1, but...
>>> 3. I can't use 10.1, even with Xcode 2.5, on Snow Leopard.

No, you can't use icc 10.1 on Snow Leopard. The supported OS/Xcode/Intel compiler support:
http://software.intel.com/en-us/articles/performance-tools-for-software-developers-compatibility-of-intel-compiler-for-mac-os-x-and-xcode/

>>> If not, I guess I'm just completely hosed. Is it just impossible to build a Tiger binary using any version of the Intel compiler on Snow Leopard? If so, I've just made a very big mistake in upgrading my system to icc 11.1 and Snow Leopard.

One possible solution might be for the Intel Compilerdevelopers to create a redistributable library separate from the11.1 compiler for targeting Tiger.

Leave a Comment

Please sign in to add a comment. Not a member? Join today