This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Installing multilib on x86_64*-linux* with 32-bit libs to lib32 and 64-bit libs to lib
On Thu, Jun 08, 2006 at 08:43:33AM -0500, Albert Chin wrote:
> On Thu, Jun 08, 2006 at 01:12:56PM +0300, Kai Ruottu wrote:
> > Kai Ruottu wrote :
> > >Albert Chin wrote :
> > >
> > >> How do I build gcc-4.0.2 on x86_64*-linux* so 32-bit libs are
> > >> installed to $prefix/lib32 and 64-bit libs to $prefix/lib?
> > >
> > >So your only choice without doing manual fixes to the FSF sources, is
> > >to "marry
> > >with" Ubuntu, use only its patched sources, and never try any pristine
> > >FSF ones!
> > >
> > Those "manual fixes" to the sources are quite obvious though, the
> > "target Makefile
> > fragment", 'gcc/config/i386/t-linux64', has in it :
> >
> > MULTILIB_OPTIONS = m64/m32
> > MULTILIB_DIRNAMES = 64 32
> > MULTILIB_OSDIRNAMES = ../lib64 ../lib
> >
> > and changing this into :
> >
> > MULTILIB_OPTIONS = m64/m32
> > MULTILIB_DIRNAMES = 64 32
> > MULTILIB_OSDIRNAMES = ../lib ../lib32
>
> Yeah, I saw this.
>
> > should succeed even for a newbie. This could sound being enough, but
> > then there
> > are things like :
> >
> > #undef LINK_SPEC
> > #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
> > %{shared:-shared} \
> > %{!shared: \
> > %{!static: \
> > %{rdynamic:-export-dynamic} \
> > %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
> > %{!m32:%{!dynamic-linker:-dynamic-linker
> > /lib64/ld-linux-x86-64.so.2}}} \
> > %{static:-static}}"
> >
> > in the 'gcc/config/i386/linux64.h' and maybe something else too...
>
> Ok, thanks. I'll check out the changes required for the above.
I don't think what I want to do is moderately possible. Having made
the change to gcc/config/i386/t-linux64, I built gcc-4.0.2 on RHEL
4/amd64 and failed with:
stage1/xgcc -Bstage1/
-B/nokia/apps/tww/@sys/gcc402/x86_64-unknown-linux-gnu/bin/ -g -O2
-DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros
-Wold-style-definition -DHAVE_CONFIG_H -DGENERATOR_FILE -o
build/genmodes build/genmodes.o build/errors.o
../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when
searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when
searching for -lc
/usr/bin/ld: warning: i386 architecture of input file
`/usr/lib/../lib/crt1.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file
`/usr/lib/../lib/crti.o' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file
`/usr/lib/../lib/crtn.o' is incompatible with i386:x86-64 output
If I strace the above command, the call to collect2 is:
execve("stage1/collect2", ["stage1/collect2", "--eh-frame-hdr", "-m", "elf_x86_64", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o", "build/genmodes", "/usr/lib/../lib64/crt1.o", "/usr/lib/../lib64/crti.o", "stage1/crtbegin.o", "-Lstage1", "-L/lib/../lib64", "-L/usr/lib/../lib64", "build/genmodes.o", "build/errors.o", "../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "stage1/crtend.o", "/usr/lib/../lib64/crtn.o"], [/* 34 vars */]) = 0
gcc/multilib.h starts with:
static const char *const multilib_raw[] = {
". !m64 !m32;",
"64:../lib m64 !m32;",
"32:../lib32 !m64 m32;",
NULL
};
and gcc/stage1/specs has:
*multilib:
. !m64 !m32;64:../lib m64 !m32;32:../lib32 !m64 m32;
Ubuntu can get away with lib/lib32 if the entire system is built this
way. However, if the OS has lib/lib64 (32-bit/64-bit) and I want GCC
to use lib32/lib, then things won't work. GCC is appending one of the
paths specified in MULTILIB_OSDIRNAMES to locate the system files and,
more than likely, its own.
--
albert chin (china@thewrittenword.com)