crosscompiler toolchain from i686 to x86_64

Juraj Lutter jlutter@cisco.com
Thu Jan 25 19:56:00 GMT 2007


Folks,

I turn to you because I seem to be really stuck.

I have:
- binutils 2.17
- gcc 3.4.6
- glibc 2.3.6

what I need to achieve is to have ``multilib'' support in this
toolchain which I can't manage to work :-( I need to have
both 32-bit and 64-bit of glibc compiled using this compiler.

Build platform for toolchain is i686-pc-linux-gnu or x86_64-pc-linux-gnu 
with
resulting binaries running on x86_64-pc-linux-gnu.

gcc should support both -m32 and -m64 as well as probably the rest of 
the tools need.

So far I've managed to build toolchain from i686 to x86_64 using 
binutils, gcc-stage1, glibc and gcc-stage2.

Options used to generate:

binutils
--------

               --prefix=${[TOOLCHAIN_PREFIX]} \
               --disable-nls \
               --disable-multilib \
               --enable-shared \
               --with-lib-path=${[TOOLCHAIN_TARGET_PREFIX]}/lib \
               --host=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
               --build=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
               --target=${[GNU_CONFIGURE_TRIPLET_TARGET]}

gcc-stage1
----------

               --prefix=${[TOOLCHAIN_PREFIX]} \
               --host=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
               --build=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
               --target=${[GNU_CONFIGURE_TRIPLET_TARGET]} \
               --disable-multilib \
               --with-local-prefix=${[TOOLCHAIN_GCC_BUILD_DIR]} \
               --disable-nls \
               --disable-shared \
               --disable-threads \
               --enable-languages=c

glibc
-----
       cd ${[TOOLCHAIN_BUILD_DIR]} && echo "libc_cv_forced_unwind=yes" > 
config.cache
       cd ${[TOOLCHAIN_BUILD_DIR]} && echo "libc_cv_c_cleanup=yes" >> 
config.cache
       cd ${[TOOLCHAIN_BUILD_DIR]} && 
CC="${[TOOLCHAIN_TARGET_PREFIX]}/bin/gcc" 
AR="${[TOOLCHAIN_TARGET_PREFIX]}/bin/ar" RANLIB="${
[TOOLCHAIN_TARGET_PREFIX]}/bin/ranlib" BUILD_CC="/usr/bin/gcc" sh 
${[CWD]}/$(SUB)/configure \
              --prefix=${[TOOLCHAIN_TARGET_PREFIX]} \
              --host=${[GNU_CONFIGURE_TRIPLET_TARGET]} \
              --build=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
              --disable-profile \
              --enable-add-ons \
              --with-tls \
              --enable-kernel=2.6.0 \
              --with-__thread \
              --with-binutils=${[TOOLCHAIN_TARGET_PREFIX]}/bin \
              --with-headers=$(INCLUDE_TARGET) \
              --cache-file=config.cache

gcc-stage2
----------

       cd ${[TOOLCHAIN_GCC_BUILD_DIR]} && \
       PATH="${[TOOLCHAIN_BASE]}/usr/bin:${PATH}" \
       
RANLIB="${[TOOLCHAIN_BASE]}/usr/bin/${[GNU_CONFIGURE_TRIPLET_TARGET]}-ranlib" 
\
       
RANLIB_FOR_TARGET="${[TOOLCHAIN_BASE]}/usr/bin/${[GNU_CONFIGURE_TRIPLET_TARGET]}-ranlib" 
\
       
AR="${[TOOLCHAIN_BASE]}/usr/bin/${[GNU_CONFIGURE_TRIPLET_TARGET]}-ar" \
       AR_FOR_TARGET="${AR}" \
       
AS_FOR_TARGET="${[TOOLCHAIN_BASE]}/usr/bin/${[GNU_CONFIGURE_TRIPLET_TARGET]}-as" 
\
       
LD_FOR_TARGET="${[TOOLCHAIN_BASE]}/usr/bin/${[GNU_CONFIGURE_TRIPLET_TARGET]}-ld" 
\
                     sh ${[CWD]}/$(SUB)/configure \
               --prefix=${[TOOLCHAIN_PREFIX]} \
               --host=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
               --build=${[GNU_CONFIGURE_TRIPLET_BUILD]} \
               --target=${[GNU_CONFIGURE_TRIPLET_TARGET]} \
               --disable-multilib \
               --with-local-prefix=${[TOOLCHAIN_GCC_BUILD_DIR]} \
               --disable-nls \
               --enable-shared \
               --enable-languages=c,c++ \
               --enable-__cxa_atexit \
               --enable-c99 \
               --enable-long-long \
               --enable-threads=posix


Using the above options I'm able to compile on i686 platform binaries 
for x86_64 platform but as soon as I start to fiddle with multilib 
support, I start to get errors regarding incompatible libc and so on.

Obviously I'm getting something wrong. Can someone of you point me to 
the right direction where can I have look at?

TIA,

otis

-- 
Juraj Lutter                              |           |
Software Developer                       :|:         :|:
SRBU Service Node                       :|||:       :|||:
phone: +421 907 986 576              .:|||||||:...:|||||||:.
email: jlutter@cisco.com             C i s c o S y s t e m s

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list