On Feb 7, 2008, at 03:30, Anders F Björklund wrote:
I've added some configure. flags for +universal variants, and also to the macports.conf file for providing defaults.
They are:
- universal_target # for setting macosx_deployment_target and configure target Default: 10.4
- universal_sysroot # the SDK "sysroot" to use, normally for the -isysroot flag Default: /Developer/SDKs/MacOSX10.4u.sdk
- universal_archs # machine architectures to use, can be more than just one Default: ppc i386
There are some workarounds for known shortcomings/bugs, such as setting -mmacosx-version-min instead of macosx_deployment_target when the variable don't want to take effect,
The documentation I've read says to use MACOSX_DEPLOYMENT_TARGET environment variable. When is this -mmacosx-version-min applicable instead?
or adding -syslibroot on PowerPC so that it doesn't forget to use the Intel versions...
Apple documentation on building universal binaries from configure- based software used to mention -syslibroot but this was removed quite some time ago. When is it still applicable?
The additions means that it will now cross-compile when necessary,
As I understand it, cross-compiling is compiling for a platform other than the one on which the compiler is running. Haven't we already been doing that when building universal binaries?
and that +universal target is meant to generate similar binaries*. By changing the values, it's possible to build for the Leopard SDK and even the Panther SDK (cross-compiling to a previous OS version)
Currently these do _not_ affect the MacPorts os. variables, though. These use the currently running operating system, and nothing else (i.e. they aren't affected by changing these universal variables) So it would still say "+darwin_9" and "+i386", even for Panther SDK.
However, if you do set the universal_target to a certain version then it will pass matching configure flags to autoconf/automake. For instance, when using the default MacOSX10.4u.sdk, it'll use: configure --host=i686-apple-darwin8 --target=i686-apple-darwin8
What problem does setting --host and --target solve? Because for me it's causing a problem, namely that glib2 doesn't build universal anymore. I traced this failure back to r33483 in which you added the --host and --target switches. With trunk r33482 (without those switches), glib2 builds universal. With trunk r33483 (with them), it does not. Possibly suspicious output from glib2's ./configure at the beginning: 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. Definitely suspicious output from glib2's ./configure: checking whether to use assembler code for atomic operations... i486 With r33482 it says: checking whether to use assembler code for atomic operations... none Definitely suspicious output from glib2's make at the end: /usr/bin/gcc-4.0 -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN= \"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED - DGLIB_COMPILATION -DPCRE_STATIC -I/opt/local/include -isysroot / Developer/SDKs/MacOSX10.4u.sdk -D_REENTRANT -O2 -funroll-loops - fstrict-aliasing -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc - arch i386 -Wall -c gatomic.c -fno-common -DPIC -o .libs/gatomic.o gatomic.c: In function 'g_atomic_int_compare_and_exchange': gatomic.c:66: error: impossible constraint in 'asm' lipo: can't figure out the architecture type of: /var/tmp//ccmwc7KI.out make[4]: *** [gatomic.lo] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2