Re: GCC configure problem with 32-bit stuff on x86_64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Lu wrote:
On 11/14/05, Kai Ruottu <karuottu@xxxxxxxx> wrote:

You didn't tell your "x86_64 system" type but let's guess it being
Linux, not FreeBSD, NetBSD or something else...

You guessed correctly, it is a Linux system. Sorry about that...

Just (pre)install the 32-bit C libraries, they should be in '/lib'
and '/usr/lib' in the Linux case. The default 64-bit libs then are
normally in '/lib64' and '/usr/lib64'.

For some reason I have */lib for the 64-bit libs, */lib32 for 32-bit,
and */lib64 symlinked to */lib.

 The FSF GCC sources seem to expect the Linux/x86_64 installations
to have the default 64-bit stuff in '*/lib64' and the 32-bit stuff
in '*/lib', so you have a problem to solve with this. What kind of
Linux/x86_64 puts its libraries this way?

 Anyway the place where the default settings for GCC are told, is
the 'gcc/config/i386/t-linux64', a clip from its beginning :

----------------------- clip ------------------------------------
# On x86-64 we do not need any exports for glibc for 64-bit libgcc_s,
# override the settings
# from t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
		 $(srcdir)/config/i386/libgcc-x86_64-glibc.ver

MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
MULTILIB_OSDIRNAMES = ../lib64 ../lib
----------------------- clip ------------------------------------

 So changing the last row to be:

MULTILIB_OSDIRNAMES = ../lib ../lib32

should change the default behaviour to be for your 'custom'
Linux/x86_64... At least I think this being the place for setting
those 'operating system directory names'.

$ x86_64-unknown-linux-gnu-gcc-4.0.2 -o hello -m32 -L/lib32/ -v hello.c
<snip>
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.0.2/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello
/usr/lib/../lib/crt1.o /usr/lib/../lib/crti.o
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.0.2/32/crtbegin.o
-L/lib32/ -L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.0.2/32
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.0.2
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.0.2/../../../../lib
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.0.2/../../..
-L/lib/../lib -L/usr/lib/../lib /tmp/cc03Pm1W.o -lgcc --as-needed
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.0.2/32/crtend.o
/usr/lib/../lib/crtn.o

Yes, with the '-m32' the '*/lib' stuff is tried to be used... Without
it you should get the '*/lib64' in those '-L' options with your current
settings. And changing what I suggested, restarting the build (it should
see the target-makefile-fragment changed and rebuild what this change
requires), the '*/lib' stuff should be searched as default and '*/lib32'
stuff with the '-m32'...

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux