Gentoo Archives: gentoo-embedded

From: Joakim Tjernlund <joakim.tjernlund@×××××××××.se>
To: Mike Frysinger <vapier@g.o>
Cc: gentoo-embedded@l.g.o
Subject: Re: [gentoo-embedded] crossdev builds libiberty.a with host arch
Date: Fri, 11 Nov 2011 08:26:53
Message-Id: OF54B87BB6.51DBF2D9-ONC1257945.002BF108-C1257945.002E5C3D@transmode.se
In Reply to: Re: [gentoo-embedded] crossdev builds libiberty.a with host arch by Mike Frysinger
1 Mike Frysinger <vapier@g.o> wrote on 2011/11/10 04:55:58:
2 > From: Mike Frysinger <vapier@g.o>
3 > On Wednesday 09 November 2011 10:37:18 Joakim Tjernlund wrote:
4 > > Tried to build oprofile
5 > > ./configure --host powerpc-softfloat-linux-gnu
6 > > LDFLAGS="-L/usr/lib/binutils/powerpc-softfloat-linux-gnu
7 > > -L/usr/local/src/FS/fsall/basicfs/usr/lib"
8 > > CPPFLAGS=-I/usr/lib/binutils/powerpc-softfloat-linux-gnu/include
9 > >
10 > > configure: error: liberty library not found
11 > >
12 > > this appears to be caused by crossdevs libiberty.a beeing built with the
13 > > hosts arch instead of powerpc: nm
14 > > /usr/i686-pc-linux-gnu/powerpc-softfloat-linux-gnu/lib/libiberty.a | grep
15 > > __i686 00000000 T __i686.get_pc_thunk.bx
16 > > 00000000 T __i686.get_pc_thunk.bx
17 > > ....
18 > >
19 > > Bug in crossdev, oprofile or user error?
20 >
21 > user error. this is expected behavior: the libs under
22 > /usr/$CHOST/$CTARGET/lib/ are libraries that will be linked for $CHOST
23 > binaries but used to debug $CTARGET code. libiberty is a bad example as it
24 > generally doesn't have any target info in it, so let's use libbfd.a as an
25 > example instead.
26 >
27 > linking against /usr/$CHOST/$CTARGET/lib/libbfd.a will let you run code on
28 > $CHOST but load ELFs that are compiled for $CTARGET.
29 >
30 > if you want to build oprofile for $CTARGET, you need to build binutils for
31 > $CTARGET (CHOST==CTARGET).
32 > -mike
33
34 Ahh, too long time since I mucked around with sysroot. I installed binutils and now I got
35 a the correct libbfd.so and libiberty.a under
36 /usr/powerpc-softfloat-linux-gnu/usr/lib/binutils/powerpc-softfloat-linux-gnu/2.16.1/
37 There is no symlink under
38 /usr/powerpc-softfloat-linux-gnu/lib/
39 though which forces me to pass -L and -I options too gcc in order to
40 build oprofile. Would be nice if the symlinks were created to make the
41 x-compile env. mimic the normal host env.
42
43 Same for libbfd and headers for those 2 libs.
44
45 Jocke

Replies

Subject Author
Re: [gentoo-embedded] crossdev builds libiberty.a with host arch Mike Frysinger <vapier@g.o>