Subject: 24.0.90; configuration and compilation for multiple architectures not possible

From: Peter Dyballa <[email-masked]>
Date: Fri, 14 Oct 2011 22:38:44 +0200

Hello!

Trying to set up GNU Emacs with Apple means to run on more than one target architecture configuration fails because the configure script does not use the value I set for CPP but insists on using the -E option for CC, which is not allowed in this situation:

configure:5753: checking how to run the C preprocessor
configure:5823: result: gcc-4.0 -arch ppc -arch ppc64 -arch x86_64 -mmacosx-version-min=10.4.8 -isysroot /Developer45/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4.8 -Xarch_ppc -faltivec -Xarch_ppc -mabi=altivec -Xarch_ppc -mcpu=G4 -Xarch_ppc -mtune=G4 -Xarch_ppc64 -mpowerpc-gfxopt -Xarch_ppc64 -faltivec -Xarch_ppc64 -mabi=altivec -Xarch_x86_64 -march=nocona -Xarch_x86_64 -m64 -Xarch_x86_64 -msse3 -Xarch_x86_64 -mssse3 -E -I/sw/include -L/sw/lib
configure:5843: gcc-4.0 -arch ppc -arch ppc64 -arch x86_64 -mmacosx-version-min=10.4.8 -isysroot /Developer45/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4.8 -Xarch_ppc -faltivec -Xarch_ppc -mabi=altivec -Xarch_ppc -mcpu=G4 -Xarch_ppc -mtune=G4 -Xarch_ppc64 -mpowerpc-gfxopt -Xarch_ppc64 -faltivec -Xarch_ppc64 -mabi=altivec -Xarch_x86_64 -march=nocona -Xarch_x86_64 -m64 -Xarch_x86_64 -msse3 -Xarch_x86_64 -mssse3 -E -I/sw/include -L/sw/lib  conftest.c
gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
configure:5843: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "emacs"
| #define PACKAGE_TARNAME "emacs"
| #define PACKAGE_VERSION "24.0.90"
| #define PACKAGE_STRING "emacs 24.0.90"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "emacs"
| #define VERSION "24.0.90"
| #define SYNC_INPUT 1
| #define WIDE_EMACS_INT 1
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| 		     Syntax error
configure:5843: gcc-4.0 -arch ppc -arch ppc64 -arch x86_64 -mmacosx-version-min=10.4.8 -isysroot /Developer45/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4.8 -Xarch_ppc -faltivec -Xarch_ppc -mabi=altivec -Xarch_ppc -mcpu=G4 -Xarch_ppc -mtune=G4 -Xarch_ppc64 -mpowerpc-gfxopt -Xarch_ppc64 -faltivec -Xarch_ppc64 -mabi=altivec -Xarch_x86_64 -march=nocona -Xarch_x86_64 -m64 -Xarch_x86_64 -msse3 -Xarch_x86_64 -mssse3 -E -I/sw/include -L/sw/lib  conftest.c
gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
configure:5843: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "emacs"
| #define PACKAGE_TARNAME "emacs"
| #define PACKAGE_VERSION "24.0.90"
| #define PACKAGE_STRING "emacs 24.0.90"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "emacs"
| #define VERSION "24.0.90"
| #define SYNC_INPUT 1
| #define WIDE_EMACS_INT 1
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| 		     Syntax error
configure:5873: error: in `/Users/peter/Quellen/Emacs_CVS/emacs-24.0.90':
configure:5875: error: C preprocessor "gcc-4.0 -arch ppc -arch ppc64 -arch x86_64 -mmacosx-version-min=10.4.8 -isysroot /Developer45/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4.8 -Xarch_ppc -faltivec -Xarch_ppc -mabi=altivec -Xarch_ppc -mcpu=G4 -Xarch_ppc -mtune=G4 -Xarch_ppc64 -mpowerpc-gfxopt -Xarch_ppc64 -faltivec -Xarch_ppc64 -mabi=altivec -Xarch_x86_64 -march=nocona -Xarch_x86_64 -m64 -Xarch_x86_64 -msse3 -Xarch_x86_64 -mssse3 -E -I/sw/include -L/sw/lib" fails sanity check
See `config.log' for more details

I invoked configure this way:

	env LANG=C PATH=/sw/bin:$PATH ./configure --without-sound --without-dbus --without-pop --without-gconf --without-gpm --with-wide-int --with-x-toolkit=athena --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include --enable-locallisppath=/Library/Application\ Support/Emacs/calendar24:/Library/Application\ Support/Emacs CFLAGS="-H -pipe -fPIC -pthread" LDFLAGS="-Wl,-dead_strip_dylibs -Wl,-bind_at_load -Wl,-t" CC="gcc-4.0 -arch ppc -arch ppc64 -arch x86_64 -mmacosx-version-min=10.4.8 -isysroot /Developer45/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4.8 -Xarch_ppc -faltivec -Xarch_ppc -mabi=altivec -Xarch_ppc -mcpu=G4 -Xarch_ppc -mtune=G4 -Xarch_ppc64 -mpowerpc-gfxopt -Xarch_ppc64 -faltivec -Xarch_ppc64 -mabi=altivec -Xarch_x86_64 -march=nocona -Xarch_x86_64 -m64 -Xarch_x86_64 -msse3 -Xarch_x86_64 -mssse3" CPP=cpp-4 PKG_CONFIG_PATH=/sw/lib/xft2/lib/pkgconfig:/sw/share/pkgconfig:/sw/lib/pkgconfig:/usr/X11/lib/pkgconfig:/usr/X11/share/pkgconfig:/usr/lib/pkgconfig

In config.log I can see:

	ac_cv_c_compiler_gnu=yes
	ac_cv_env_CC_set=set
	ac_cv_env_CC_value='gcc-4.0 -arch ppc -arch ppc64 -arch x86_64 -mmacosx-version-min=10.4.8 -isysroot /Developer45/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4.8 -Xarch_ppc -faltivec -Xarch_ppc -mabi=altivec -Xarch_ppc -mcpu=G4 -Xarch_ppc -mtune=G4 -Xarch_ppc64 -mpowerpc-gfxopt -Xarch_ppc64 -faltivec -Xarch_ppc64 -mabi=altivec -Xarch_x86_64 -march=nocona -Xarch_x86_64 -m64 -Xarch_x86_64 -msse3 -Xarch_x86_64 -mssse3'
	ac_cv_env_CFLAGS_set=set
	ac_cv_env_CFLAGS_value='-H -pipe -fPIC -pthread'
	ac_cv_env_CPPFLAGS_set=
	ac_cv_env_CPPFLAGS_value=
	ac_cv_env_CPP_set=set
	ac_cv_env_CPP_value=cpp-4
	ac_cv_env_LDFLAGS_set=set
	ac_cv_env_LDFLAGS_value='-Wl,-dead_strip_dylibs -Wl,-bind_at_load -Wl,-t'
	ac_cv_env_LIBS_set=
	ac_cv_env_LIBS_value=

but these lines are below the first excerpt with the test whether some C preprocessor works, in a section "Cache variables." And it seems to cache a value that it never tested...

My test case also shows another problem: only one architecture, ppc (G4 or PowerPC 74xx) is 32-bit and would need the --with-wide-int configure option, the two other architectures, ppc64 (or G5, PowerPC 970) and x86_64 (intel, kind of "nocona"), are inherently 64-bit.

And one more problem (family) shines up: "uname -m = x86_64" and "/usr/bin/uname -p = i386" are found, a "Processor type: i486 (Intel 80486)" is deduced (Apple recommends the TRIPLE x86_64-apple-darwin10 for Snow Leopard on a 64-bit machine and i686-apple-darwin10 for Snow Leopard on a 32-bit machine). Finally configure logs:

	configure:4324: checking build system type
	configure:4338: result: i386-apple-darwin10.8.0
	configure:4358: checking host system type
	configure:4371: result: i386-apple-darwin10.8.0

It declares my hardware 32-bit, which is OK for the libraries provided by Fink in /sw/lib, but it's not OK for the native libraries provided by MacPorts in /opt/local/lib, which are 64-bit. (Apple makes it simple: it provides real fat libraries with support for i386, x86_64, and the G4 ppc family, as I try to compile myself. Notice: this is the situation for old Mac OS X 10.6.x, Snow Leopard; the Lion, Mac OS X 10.7.x, situation might be simpler, only i386 and x86_64, but I have no access.)

--
Greetings

  Pete

You can never know too little of what is not worth knowing at all.
			– Anon.