I'm trying to cross-compile the entire gentoo system for my ipaq pda. The cross-tools compiled fine but when I tried to compile the glibc for the target system, if fails with ../sysdeps/unix/syscall.S: Assembler messages: ../sysdeps/unix/syscall.S:28: Error: cannot represent SWI relocation in this object file format This is caused by gcc sourcing the wrong (build-system, not the target one) asm/unistd.h. It can be effectively solved by modifying src/glibc-2.3.1/Makerules like this: adding -I/root/ipaq/local/arm-linux/include so that +sysdep-includes becomes +sysdep-includes := $(addprefix -I,$(+sysdep_dirs)) -I/root/ipaq/local/arm-linux/include (the path should be constructed like ${ROOT}/usr/include) ...or maybe there's a better way but this works. (material found at http://moss.csc.ncsu.edu/~mueller/rt/rt02/g1/cross_installlog.txt)
Have a look at http://dev.gentoo.org/~vapier/CROSS-COMPILE-HOWTO (especially step 9).
...yeah, I'm familiar with this howto and it just isn't that simple. Believe me. Vapier may have been lucky if his unistd.h's were compatible (between build and target) but generally, it doesn't work...
you didnt really post any info on this if your cross-compiling toolchain is setup properly, it will automatically include the right headers
Well, how do I verify my cross-toolchain is setup correctly? I assumed a successful crossdev build to be sufficient. You can try to see for yourself. crossdev --target arm-unknown-linux-gnu USE="bootstrap build" CHOST="arm-unknown-linux-gnu" CBUILD="i686-pc-linux-gnu" emerge glibc ...anyway, ask me on any info you need.
well you still havent posted `emerge info` so how am i supposed to guess at your setup you yourself in your original report said you built your own cross-compiling toolchain ... nowhere did you say you used crossdev all that means is that you're trying to do cross-compiling yourself so of course the toolchain ebuilds are going to fail
Well, I don't know what useful can emerge info be but here it comes: Portage 2.0.51.21-r1 (default-linux/x86/2005.0, gcc-3.4.3-20050110, glibc-2.3.5-r0, 2.6.11.8 i686) ================================================================= System uname: 2.6.11.8 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz Gentoo Base System version 1.6.11 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] ccache version 2.4 [disabled] dev-lang/python: 2.2.3-r5, 2.3.5 sys-apps/sandbox: 1.2.3 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5 sys-devel/binutils: 2.15.92.0.2-r8 sys-devel/libtool: 1.5.14 virtual/os-headers: 2.6.11 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d" CXXFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distcc distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.cz.gentoo.org/gentoo-portage" USE="x86 X acpi alsa apache2 apm avi bash-completion bitmap-fonts bluetooth bonobo cdr crypt cups curl dvd emboss encode fam flac flash foomaticdb fortran gd gif gnome gphoto2 gstreamer gtk gtk2 gtkhtml imagemagick imap imlib ipv6 java jpeg junit kde libg++ libwww lirc mad maildir matroska mbox mmx motif mozilla mp3 mpeg mysql ncurses nptl ogg oggvorbis opengl png postgres qt readline samba scanner sdl speex sqlite sse ssl tcltk tetex tiff truetype truetype-fonts type1-fonts unicode usb vorbis xine xml xml2 xv zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Anyway, I've never said I'm using my custom cross-toolchain. I followed your howto (only skipped first 8 steps because crossdev took care of it). When issuing ARCH=arm CHOST=arm-unknown-linux-gnu CBUILD=i686-pc-linux-gnu USE="bootstrap build" emerge sys-libs/glibc it fails with the error I've posted earlier. How do I verify crossdev did a good job when building the cross-toolchain?
Take a look at http://podgorny.cz/moin/GentooOnIpaq to see what steps I took, please...
this is why you cant file bug reports with very little information your original report never mentioned crossdev and in fact contained a link to instructions on how to build your own cross-compiling toolchain all you said was 'glibc unable to be cross-compiled' ... well if you ran `crossdev -t arm-unknown-linux-gnu`, then you already cross-compiled glibc for the arm target ... just do `ls /usr/arm*/lib/libc*` and you should get a bunch of arm libraries back i'm assuming the issue here is that you're trying to do `ROOT=someplace emerge glibc` and *that* glibc is not cross-compiling properly for the arm target
Yeah, you got it right. I'm sorry I didn't make myself clear enough in the first place...
ive documented this issue already here: http://dev.gentoo.org/~vapier/CROSS-COMPILE-SYSTEM
OK, so let's solve this one. :-) The problem is in wrong unistd.h being sources. When I look at /usr/arm-u...gnu/sys-include/unistd.h it's not the right file for arm architecture. Is this the file that gets included by default (when no -I is specified)? If yes, it looks like the crossdev did something wrong...
I am also having no end of trouble cross-compiling glibc version 2.3.5 with crossdev. That is During the initial crossdev toolchain compile not using the crossdev toolchain. the previous version compiles perfectly. (<glibc-2.3.5) the error message I got while building a i586-pc-linux-gnu toolchain with an i686-pc-linux-gnu installation is extremely long so brace yourself. It's a section of the log that crossdev makes.: i586-pc-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/usr/i586-pc-linux-gnu/lib/ld-linux.so.2 -B/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/ -B/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/csu/ -B/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/ -Wl,--version-script=/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/libpthread.map -Wl,-soname=libpthread.so.0 -Wl,-z,combreloc -Wl,-z,relro -Wl,--enable-new-dtags,-z,nodelete -Wl,--enable-new-dtags,-z,initfirst -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/math -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/elf -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/dlfcn -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/nss -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/nis -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/rt -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/resolv -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/crypt -L/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads -Wl,-rpath-link=/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/math:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/elf:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/dlfcn:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/nss:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/nis:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/rt:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/resolv:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/crypt:/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads -o /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread.so -T /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/shlib.lds /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/csu/abi-note.o -Wl,--whole-archive /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread_pic.a -Wl,--no-whole-archive /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/elf/interp.os /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/libc.so /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/libc_nonshared.a /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/elf/ld.so /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread_pic.a(pthread.os): In function `pthread_initialize': pthread.c:(.text+0x21d): undefined reference to `_res' /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread_pic.a(pthread.os): In function `__pthread_reset_main_thread': pthread.c:(.text+0x9b3): undefined reference to `_errno' pthread.c:(.text+0x9bf): undefined reference to `_h_errno' pthread.c:(.text+0x9cb): undefined reference to `_res' /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread_pic.a(pthread.os):(.data.rel+0x698): undefined reference to `_errno' /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread_pic.a(pthread.os):(.data.rel+0x6a0): undefined reference to `_h_errno' /var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread_pic.a(pthread.os):(.data.rel+0x6a8): undefined reference to `_res' collect2: ld returned 1 exit status make[2]: *** [/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/build-default-i586-pc-linux-gnu-linuxthreads/linuxthreads/libpthread.so] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory `/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/glibc-2.3.5/linuxthreads' make[1]: *** [linuxthreads/others] Error 2 make[1]: Leaving directory `/var/tmp/cross/i586-pc-linux-gnu/portage/glibc-2.3.5/work/glibc-2.3.5' make: *** [all] Error 2 This is my emerge info: Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r6 i686) ================================================================= System uname: 2.6.11-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz Gentoo Base System version 1.4.16 Python: dev-lang/python-2.3.5 [2.3.5 (#1, May 1 2005, 13:47:23)] distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] dev-lang/python: 2.3.5 sys-apps/sandbox: [Not Present] sys-devel/autoconf: 2.59-r6, 2.13 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r7 sys-devel/libtool: 1.5.16 virtual/os-headers: 2.6.8.1-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X acpi alsa avi berkdb bitmap-fonts cdr crypt cups curl dvd eds emboss encode esd fam flac foomaticdb fortran gdbm gif gnome gpm gstreamer gtk gtk2 imagemagick imlib ipv6 java jpeg junit libg++ libwww mad mikmod motif mozilla mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam pdflib perl png ppds python quicktime readline samba scanner sdl spell ssl svga tcpd tiff truetype truetype-fonts type1-fonts unicode usb v4l vorbis xml xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS if you need anything else just say so. This is only trivial to my actual computer development as I can still use the old version so take your time.
can you sync up to the latest tree and see if this works any better ? ive had reports of mips64 success ...
OK, will try ASAP, stay tuned...
At the first quick try it seems to be working. Hold on for more thorough testing...
Seems to be working, will reopen if problems appear...