Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
xmerge armeb-softfloat-linux-gnu: (wrong?) g++ can't link
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 264

PostPosted: Mon Jul 07, 2008 9:47 am    Post subject: xmerge armeb-softfloat-linux-gnu: (wrong?) g++ can't link Reply with quote

I tried to set up a crossdev toolchain following the Gentoo Embedded Handbook. The device I try to compile for is a NSLU2 from Linksys using an ARM (the default bootloader only accepts Big Endian mode). uclibc seems to have become useless for packages later than 2006 so I wanted to crosscompile with glibc. (And if it goes well build a whole new inofficial stage 3 tarball...)

Looking around on the Debian-based SlugOS/BE-distro I had to install, GCC 4.1.2, a kernel 2.6.21 and glibc 2.5 seem to work. Assuming I can apply the available patches for kernel 2.6.24 and maybe a newer (because marked stable) glibc, I ran crossdev with the following arguments:

Code:
crossdev --gcc 4.1.2 --libc 2.6.1 --binutils 2.18-r1 --kernel 2.6.24 --target armeb-softfloat-linux-gnu


That compiled fine. I set up /usr/armeb-softfloat-linux-gnu/etc/make.conf:

Code:

ACCEPT_KEYWORDS="arm"
ARCH="arm"

CHOST="armeb-softfloat-linux-gnu"
#CFLAGS="-march=armv5t -mtune=xscale -Os -pipe"
CFLAGS="-Os -pipe"
CXXFLAGS="${CFLAGS}"

INPUT_DEVICES="keyboard"

MAKEOPTS="-j2"

USE="-* minimal"
# USE="-X -gnome -gtk -kde -qt minimal"


I setup xmerge and pkg-config as told in the docs, copied make.globals and symlinked /usr/portage/profiles/default-linux/arm/ as make.profile.

Running xmerge ncurses unfortunately gives me:

Code:

/usr/bin/g++ -I../c++ -I../include -I/var/tmp/portage/sys-libs/ncurses-5.6-r2/work/ncurses-5.6/c++ -DHAVE_CONFIG_H -I/var/tmp/portage/sys-libs/ncurses-5.6-r2/work/ncurses-5.6/c++/../include -I. -I../include  -D_GNU_SOURCE -DXTSTRINGDEFINES -DNDEBUG -Os -pipe -W -Wall -Wabi -fabi-version=0 -Woverloaded-virtual -Wsign-promo -Wsynth -Wold-style-cast -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wundef -Wwrite-strings -Weffc++ -Wno-unused -fPIC -c /var/tmp/portage/sys-libs/ncurses-5.6-r2/work/ncurses-5.6/c++/demo.cc -o ../obj_s/demo.o
armeb-softfloat-linux-gnu-ar rv ../lib/libncurses++.a ../obj_s/cursesf.o ../obj_s/cursesm.o ../obj_s/cursesw.o ../obj_s/cursespad.o ../obj_s/cursesp.o ../obj_s/cursslk.o ../obj_s/cursesapp.o ../obj_s/cursesmain.o
armeb-softfloat-linux-gnu-ar: creating ../lib/libncurses++.a
a - ../obj_s/cursesf.o
a - ../obj_s/cursesm.o
a - ../obj_s/cursesw.o
a - ../obj_s/cursespad.o
a - ../obj_s/cursesp.o
a - ../obj_s/cursslk.o
a - ../obj_s/cursesapp.o
a - ../obj_s/cursesmain.o
armeb-softfloat-linux-gnu-ranlib ../lib/libncurses++.a
/usr/bin/g++  -o demo ../obj_s/demo.o -L../lib -lncurses++ -L../lib -lform -lmenu -lpanel -lncurses -Wl,-rpath,/var/tmp/portage/sys-libs/ncurses-5.6-r2/work/narrowc/lib  -I../c++ -I../include -I/var/tmp/portage/sys-libs/ncurses-5.6-r2/work/ncurses-5.6/c++ -DHAVE_CONFIG_H -I/var/tmp/portage/sys-libs/ncurses-5.6-r2/work/ncurses-5.6/c++/../include -I. -I../include  -D_GNU_SOURCE -DXTSTRINGDEFINES -DNDEBUG -Os -pipe -W -Wall -Wabi -fabi-version=0 -Woverloaded-virtual -Wsign-promo -Wsynth -Wold-style-cast -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wundef -Wwrite-strings -Weffc++ -Wno-unused -fPIC
../lib/libncurses++.a: could not read symbols: Archive has no index; run ranlib to add one
collect2: ld returned 1 exit status
make[1]: *** [demo] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-libs/ncurses-5.6-r2/work/narrowc/c++'
make: *** [all] Error 2


Why does it run g++ and c++ from /usr/bin/, shouldn't that be some stuff from the crossdev toolchain in sysroot? ranlib (for armeb) did run before. So there must be something wrong with my toolchain? Did I miss something? Also armeb-softfloat-linux-gnu-gcc got called several times before. Is this a bug in the ncurses ebuild, configure scripts or something similar?

I tried to run crossdev with --ex-gcc --ex-only, added -EB to CFLAGS in case there's some endianess broken, symlinked armeb-softfloat-linux-gnu-c++ (which does not exist?) to armeb-softfloat-linux-gnu-gcc and g++, all with no success. The error message stays the same or compilation breaks even earlier (if I try to symlink).

Here's my xmerge:

Code:

#!/bin/sh

export SYSROOT=/usr/armeb-softfloat-linux-gnu/

export ac_cv_func_calloc_0_nonnull=yes
export ac_cv_func_malloc_0_nonnull=yes
export gl_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes
export ac_cv_func_memcmp_working=yes
export ac_cv_func_strnlen_working=yes


export CBUILD=$(portageq envvar CHOST)
export PORTAGE_CONFIGROOT=${SYSROOT}
if [ "$1" = "--root" ] ; then
        export ROOT=$2
        shift 2
else
        export ROOT=${SYSROOT}
fi
#exec emerge "$@"

# also add buildpkg
PKGDIR="/root/crossdev-armeb/buildpkg/" exec emerge -b "$@"


Any ideas on what is going wrong? The host system is amd64 (Core2Duo).
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &
Back to top
View user's profile Send private message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 264

PostPosted: Mon Jul 07, 2008 5:51 pm    Post subject: Reply with quote

Okay, seems like crossdev didn't give me a C++ compiler. Taking a closer look on the build.log for stage 4 I discovered I get it compiled but it's merged into a wrong directory and not symlinked in /usr/bin/:

Code:

# ls /usr/x86_64-pc-linux-gnu
armeb-softfloat-linux-gnu  armeb-softfloat-linux-uclibc  bin  binutils-bin  gcc-bin  lib

# ls /usr/x86_64-pc-linux-gnu/armeb-softfloat-linux-gnu/gcc-bin/4.1.2/
armeb-softfloat-linux-gnu-c++  armeb-softfloat-linux-gnu-g++  armeb-softfloat-linux-gnu-gcc-4.1.2  armeb-softfloat-linux-gnu-gcov
armeb-softfloat-linux-gnu-cpp  armeb-softfloat-linux-gnu-gcc  armeb-softfloat-linux-gnu-gccbug     armeb-softfloat-linux-gnu-gfortran


Either I missed to set some variable or crossdev is broken?

Having symlinked these c++ and g++ to /usr/bin xmerge runs fine.


Edit: Seems to run fine now. However I experience some strange behaviours. Is xmerge system (in particular -e system) expected to remerge ebuilds for my host system? I don't think so.

Edit 2: Ignore that last edit about the host system. I begin to realize cross-compiling has its edges and needs huge amounts of workarounds and patience. I wrote a wrapper to clear things up a bit and avoid emerge going crazy in my host system while cross-compiling. That's a misbehaviour in portage after a change in dependency calculation. It's already filed in the bug tracker, so just ignore that.

However there's still the original problem with my toolchain being incorrectly set up. Any ideas on that? (Despite that issue I already got a good amount of ebuilds compiled; just couldn't transfer and test them on the target system yet)
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum