Mailing List Archive

[crossdev] problem building pure 64bit toolchain for mips64
hi,

I'm trying to build a pure 64bit cross toolchain for mips64 on a x86(x86 or
x86_64) host, using the following method:

1. set PORTATE_OVERLAY in /etc/make.conf

echo "PORTDIR_OVERLAY=/usr/local/portage" >> /etc/make.conf

2. emerge crossdev

emerge -av crossdev

3. select CTARGET (mips64el for instance here), Setup 'categories', set proper
package/use mask

mkdir -p /etc/portage
echo cross-mips64el-unknown-linux-gnu >> /etc/portage/categories

echo ">=cross-mips64el-unknown-linux-gnu/mips-headers-2.6.10 * -* ~*"
>> /etc/portage/package.keywords

echo "cross-mips64el-unknown-linux-gnu/gcc n64" >> /etc/portage/package.use

mkdir -p /usr/portage/profile

echo '-n64' >> /etc/portage/profile/use.mask

4. make neccessary package symlinks

mkdir -p /usr/local/portage/cross-mips64el-unknown-linux-gnu
cd /usr/local/portage/cross-mips64el-unknown-linux-gnu
ln -s /usr/portage/sys-devel/binutils binutils
ln -s /usr/portage/sys-devel/gcc gcc
ln -s /usr/portage/sys-kernel/mips-headers mips-headers
ln -s /usr/portage/sys-libs/glibc glibc

5. emerge binutils

about USE flags, please look at [1]

emerge -av cross-mips64el-unknown-linux-gnu/binutils

6. emerge bootstrap gcc (Pass 1)

make sure only "nocxx" and "bootstrap" are selected:

USE="nocxx bootstrap n64 -fortran -mudflap -nls" emerge -av
cross-mips64el-unknown-linux-gnu/gcc

also use gcc-config to select the new (cross) gcc:

gcc-config -l # to list gccs
gcc-config XXX

7. emerge linux-headers

emerge -av cross-mips64el-unknown-linux-gnu/mips-headers

8. emerge glibc

emerge -av cross-mips64el-unknown-linux-gnu/glibc

make sure "nptl ntplonly" is in USE flags if you wan't nptl.

USE="ntpl nptlonly" emerge -av cross-mips64el-unknown-linux-gnu/glibc

9. emerge gcc (Pass 2), with c and c++ compilers:

make sure "nocxx" is not set, you could also enalbe "nls" or "mudflap" if
you like.

emerge -av cross-mips64el-unknown-linux-gnu/gcc

10. build stuff

When you go to emerge packages, you should just need to do:
ROOT=/blah/ CHOST=mips64el-unknown-linux-gnu emerge cpio
- you should also set CBUILD to your building machine for
completeness sake ... most of the time you won't need it,
but sometimes you will :)
- CTARGET is no longer needed so don't set it !

If you want to cross compile a kernel, do this:
make ARCH=mips CROSS_COMPILE=mips64el-unknown-linux-gnu-

[1] for step 6, the USE flags should better have "nocxx bootstrap" and no
other flags, they are tested to work on my system. other than step 6, the USE
flags is not abitrary so we could keep it as same as the host system as
possible.

.ref: http://dev.gentoo.org/~vapier/CROSS-COMPILE-HOWTO

at step 8 I got the following error message:

mips64el-unknown-linux-gnu-gcc -mabi=n32 -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/lib32/ld.so.1 -B/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/csu/ -Wl,--version-script=/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/libc.map -Wl,-soname=libc.so.6 -Wl,-z,relro -nostdlib -nostartfiles -e
__libc_main -Wl,-z,now -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/math -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/elf -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/dlfcn -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/nss -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/nis -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/rt -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/resolv -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/crypt -L/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/nptl -Wl,-rpath-link=/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/math:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/elf:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/dlfcn:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/nss:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/nis:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/rt:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/resolv:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/crypt:/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/nptl -o /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/libc.so -T /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/shlib.lds /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/csu/abi-note.o /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/elf/soinit.os /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/libc_pic.os /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/elf/sofini.os /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/elf/interp.os /var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/elf/ld.so -lgcc
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_mul_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_mul_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_div_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_div_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_eq_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_eq_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_ne_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_ne_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_ge_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_ge_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_lt_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_lt_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_le_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_le_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_si_to_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_si_to_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_thenan_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_thenan_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_pack_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_pack_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_unpack_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_unpack_tf.o)
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_fpcmp_parts_tf.o):
ABI is incompatible with that of the selected emulation
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: failed to merge target
specific data of
file /usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_fpcmp_parts_tf.o)
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `_fpadd_parts':
(.text+0x58): relocation truncated to fit: R_MIPS_GOT_DISP against
`__thenan_tf'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__subtf3':
(.text+0x384): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__subtf3':
(.text+0x3b4): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__subtf3':
(.text+0x3cc): relocation truncated to fit: R_MIPS_GOT_PAGE against `.text'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__subtf3':
(.text+0x3e0): relocation truncated to fit: R_MIPS_GOT_OFST against `.text'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__subtf3':
(.text+0x3ec): relocation truncated to fit: R_MIPS_CALL16 against `__pack_t'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__addtf3':
(.text+0x424): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__addtf3':
(.text+0x454): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__addtf3':
(.text+0x468): relocation truncated to fit: R_MIPS_GOT_PAGE against `.text'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__addtf3':
(.text+0x474): relocation truncated to fit: R_MIPS_GOT_OFST against `.text'
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.2/libgcc.a(_addsub_tf.o): In
function `__addtf3':
(.text+0x480): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[1]: ***
[/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/build-n32-mips64el-unknown-linux-gnu-nptl/libc.so]
Error 1
make[1]: Leaving directory
`/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/work/glibc-2.5'
make: *** [all] Error 2

!!! ERROR: cross-mips64el-unknown-linux-gnu/glibc-2.5-r4 failed.
Call stack:
ebuild.sh, line 1632: Called dyn_compile
ebuild.sh, line 983: Called qa_call 'src_compile'
ebuild.sh, line 44: Called src_compile
glibc-2.5-r4.ebuild, line 1160: Called src_compile
glibc-2.5-r4.ebuild, line 1171: Called toolchain-glibc_src_compile
glibc-2.5-r4.ebuild, line 272: Called die

!!! make for n32 failed
!!! If you need support, post the topmost build error, and the call stack if
relevant.
!!! A complete build log is located
at '/var/tmp/portage/cross-mips64el-unknown-linux-gnu/glibc-2.5-r4/temp/build.log'.

!!! This ebuild is from an overlay: '/usr/local/portage'


as we can see, when I tried to build glibc, it still use -mabi=n32 flag, how
can I build a pure 64bit glibc (and gcc pass 2)?

BTW: If I use "n32 n64 multilib" for gcc, and "multilib" for glibc, the
toolchain will be built successfully (on a x86_64 host), but I like a pure 64
bit cross toolchain other than use multilib. Could you give me any clue?
thanks very much!

Regards,

Wang
--
Wang, Baojun Lanzhou University
Distributed & Embedded System Lab http://dslab.lzu.edu.cn
School of Information Science and Engeneering wangbj@lzu.edu.cn
Tianshui South Road 222. Lanzhou 730000 .P.R.China
Tel:+86-931-8912025 Fax:+86-931-8912022
Re: [crossdev] problem building pure 64bit toolchain for mips64 [ In reply to ]
(1) dont cross-post
(2) this belongs on gentoo-embedded, not gentoo-user, and most certainly not
gentoo-dev
-mike