------- Comment #27 from howarth at nitro dot med dot uc dot edu  2009-09-03 
00:56 -------
Mike,
     Regarding passing -m32 within the x86_64 host case, I was considering the
case of trying to cross compile the i686-apple-darwin10 target on the
x86_64-apple-darwin10 host.  While this sounds odd, we currently do this on
i386 fink for 10.6 (but we cheat by using wrappers for the compilers that pass
-m32 and explicitly pass --build=i686-apple-darwin10 --host=i686-apple-darwin10
 --target=i686-apple-darwin10 to gcc's configure). Without my proposed patch in
comment 10, if the user passed...

--host=x86_64-apple-darwin10 --target=i686-apple-darwin10

the i[[3456789]]86-*-darwin* host case won't be triggered but rather the absent
x86_64-*-darwin* host case. Without the patch, no -m32 will be added to CC
and the compiler will attempt to build the i686-apple-darwin10 compiler with
the default m64 code generation. 

If I remove the change from comment 20 and use the stock configure from gcc
trunk with...

../gcc/configure --prefix=/Users/howarth/dist
--enable-languages=c,c++,fortran,objc,java --with-arch=nocona
--with-tune=generic --host=x86_64-apple-darwin10 --target=i686-apple-darwin9
--with-gmp=/sw --with-libiconv-prefix=/sw --with-system-zlib
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib

where /sw is a i386 fink installation containing i386 binaries for gmp/mpfr, I
get the configure failure...

checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
checking for the correct version of the gmp/mpfr libraries... no
configure: error: Building GCC requires GMP 4.2+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.

Adding Apple's patch as...

@@ -3645,6 +3653,12 @@
   powerpc-*-darwin*)
     host_makefile_frag="config/mh-ppc-darwin"
     ;;
+  i[3456789]86-*-darwin*)
+    # gcc can default to x86_64 code generation, avoid that
+    if test "${build}" = "${host}"; then
+         CC="${CC-gcc} -m32"
+    fi
+    ;;
   powerpc-*-aix*)
     host_makefile_frag="config/mh-ppc-aix"
     ;;

won't help in this case because 1) the host is set to x86_64-apple-darwin10 so
this case never
executes and 2) the target and host don't match anyway to set CC to have -m32.
I would also remind
you that the Apple system compiler in SL shows...

Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5646~6/src/configure --disable-checking
--enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
--program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10
--target=i686-apple-darwin10
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5646)

which is exactly the triplet combination for --host and --target that I am
looking at. Only if I add my proposed patch in Comment 20 does configure
complete properly for the --host=x86_64-apple-darwin10
--target=i686-apple-darwin10 combination producing 32-bit binaries.

[Macintosh-2:~/work] howarth% ../gcc/configure --prefix=/Users/howarth/dist
--enable-languages=c,c++,fortran,objc,java --with-arch=nocona
--with-tune=generic --host=x86_64-apple-darwin10 --target=i686-apple-darwin9
--with-gmp=/sw --with-libiconv-prefix=/sw --with-system-zlib
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
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... x86_64-apple-darwin10.0.0
checking host system type... x86_64-apple-darwin10
checking target system type... i686-apple-darwin9
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking for x86_64-apple-darwin10-gcc... gcc -m32
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m32 accepts -g... yes
checking for gcc -m32 option to accept ISO C89... none needed
checking for x86_64-apple-darwin10-g++... no
checking for x86_64-apple-darwin10-c++... no
checking for x86_64-apple-darwin10-gpp... no
checking for x86_64-apple-darwin10-aCC... no
checking for x86_64-apple-darwin10-CC... no
checking for x86_64-apple-darwin10-cxx... no
checking for x86_64-apple-darwin10-cc++... no
checking for x86_64-apple-darwin10-cl.exe... no
checking for x86_64-apple-darwin10-FCC... no
checking for x86_64-apple-darwin10-KCC... no
checking for x86_64-apple-darwin10-RCC... no
checking for x86_64-apple-darwin10-xlC_r... no
checking for x86_64-apple-darwin10-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for x86_64-apple-darwin10-gnatbind... no
checking for gnatbind... no
checking for x86_64-apple-darwin10-gnatmake... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1
$$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
checking for the correct version of the gmp/mpfr libraries... yes
checking for version 0.10 of PPL... yes
checking for correct version of CLooG... yes
The following languages will be built: c,c++,fortran,java,objc
*** This configuration is not supported in the following subdirectories:
     target-libmudflap target-libada gnattools
    (Any other directories should still work fine.)
rm: conftest.dSYM: is a directory
checking for bison... bison -y
checking for bison... bison
checking for gm4... gm4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... expect
checking for runtest... no
checking for x86_64-apple-darwin10-ar... no
checking for x86_64-apple-darwin10-as... no
checking for x86_64-apple-darwin10-dlltool... no
checking for ld... (cached) /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld
checking for x86_64-apple-darwin10-ld... (cached)
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld
checking for x86_64-apple-darwin10-lipo... no
checking for x86_64-apple-darwin10-nm... no
checking for x86_64-apple-darwin10-ranlib... no
checking for x86_64-apple-darwin10-strip... no
checking for x86_64-apple-darwin10-windres... no
checking for x86_64-apple-darwin10-windmc... no
checking for x86_64-apple-darwin10-objcopy... no
checking for x86_64-apple-darwin10-objdump... no
checking for i686-apple-darwin9-cc... no
checking for i686-apple-darwin9-gcc... no
checking for i686-apple-darwin9-c++... no
checking for i686-apple-darwin9-g++... no
checking for i686-apple-darwin9-cxx... no
checking for i686-apple-darwin9-gxx... no
checking for i686-apple-darwin9-gcc... no
checking for i686-apple-darwin9-gcj... no
checking for i686-apple-darwin9-gfortran... no
checking for i686-apple-darwin9-ar... no
checking for i686-apple-darwin9-as... no
checking for i686-apple-darwin9-dlltool... no
checking for i686-apple-darwin9-ld... no
checking for i686-apple-darwin9-lipo... no
checking for i686-apple-darwin9-nm... no
checking for i686-apple-darwin9-objdump... no
checking for i686-apple-darwin9-ranlib... no
checking for i686-apple-darwin9-strip... no
checking for i686-apple-darwin9-windres... no
checking for i686-apple-darwin9-windmc... no
checking where to find the target ar... pre-installed
checking where to find the target as... pre-installed
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... pre-installed
checking where to find the target gcc... pre-installed
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target ld... pre-installed
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed
checking where to find the target objdump... pre-installed
checking where to find the target ranlib... pre-installed
checking where to find the target strip... pre-installed
checking where to find the target windres... pre-installed
checking where to find the target windmc... pre-installed
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41180

Reply via email to