This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: making gcc relocatable


Testing further, it appears the gcc is relocable, but binutils is not.
After moving the compiler (which contains sysroot and binutils)
I can't run ar at all, it appears to  be depending on some shared library that 
it can no longer find.

~/workspace-new/SIB2.0-SDK/projects/hello$ /home/nathan/workspace-new/SIB2.0-SDK/gcc-4.0.0-i486-D/bin/../lib/gcc/i486-linux/4.0.0/../../../../bin/i486-linux-ar -v
/home/nathan/workspace-new/SIB2.0-SDK/gcc-4.0.0-i486-D/bin/../lib/gcc/i486-linux/4.0.0/../../../../bin/i486-linux-ar: 
error while loading shared libraries: libbfd-2.16.1.so: cannot open shared 
object file: No such file or directory

I sysrooted it with 
$prefix/sysroot
And the directory is indeed there, Is this a bug?
Has anyone else dealt with this?

thx,
NZG


On Friday 23 June 2006 9:09 am, NZG wrote:
> Yes, that's a possiblity, but I'd rather it just work without any special
> flags.
>
> NZG
>
> On Friday 23 June 2006 4:16 am, Niklaus wrote:
> > well you can include -L for library path gcc main.c -L/usr/lib -lc etc
> >
> > On 6/23/06, NZG <ngustavson@emacinc.com> wrote:
> > > Alright, I've got my cross-compiler working, but it's not relocatable.
> > > Doing a little googling I ran across this thread:
> > > http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00315.html
> > >
> > > Which seems to indicate that gcc can find it's headers even if you move
> > > it, provided that your specified sysroot is located at
> > > $prefix/sysroot.
> > >
> > > I did that, and indeed it does seem to find it's headers, but can't
> > > seem to find it's libraries.
> > > Is there a solution for this?
> > >
> > > Success at gcc's original prefix:
> > >
> > > ../../gcc-3.3.6d-i486/bin/i486-linux-gcc     -c hello.c
> > > ../../gcc-3.3.6d-i486/bin/i486-linux-gcc  *.o -Wl   -o hello -lc
> > >
> > > failure after relocation:
> > >
> > > ../../gcc-3.3.6d-i486/bin/i486-linux-gcc     -c hello.c
> > > /home/nathan/workspace-new/SIB2.0-SDKnew/gcc-3.3.6d-i486/bin/../lib/gcc
> > >-l ib/i486-linux/3.3.6/../../../../i486-linux/bin/as: error while
> > > loading shared libraries: libbfd-2.15.so: cannot open shared object
> > > file: No such file or directory
> > > make: *** [objects] Error 1
> > >
> > >
> > > scripts used to build the system:
> > >
> > > *******************build binutils****************************
> > > #!/bin/sh
> > > prefix=$HOME/workspace-new/SIB2.0-SDK/gcc-3.3.6d-i486/
> > > mkdir $prefix
> > > cp -r sysroot $prefix/
> > > sysroot=$prefix/sysroot/
> > >
> > > mkdir -p binutils-2.15
> > > cd binutils-2.15
> > >
> > > ../../binutils-2.15/configure \
> > > --host=i686-linux \
> > > --target=i486-linux \
> > > --with-sysroot=$sysroot \
> > > --prefix=$prefix \
> > > --with-local-prefix=$sysroot \
> > > --enable-languages=c,c++,objc \
> > > --enable-shared \
> > > --enable-_cxz_atexit \
> > > --with-system-zlib \
> > > --enable-nls \
> > > --without-included-gettext \
> > > --enable-clocal=gnu \
> > > --enable-debug
> > >
> > > make all
> > > make install
> > > cd ..
> > >
> > > *******************build gcc (run after
> > > binutils)****************************
> > >
> > > #!/bin/sh
> > > prefix=$HOME/workspace-new/SIB2.0-SDK/gcc-3.3.6d-i486/
> > > sysroot=$prefix/sysroot/
> > >
> > > export PATH=$prefix/bin:$PATH
> > >
> > > mkdir -p gcc-3.3.6
> > > cd gcc-3.3.6
> > >
> > > ../../gcc-3.3.6/configure \
> > > --host=i686-linux \
> > > --target=i486-linux \
> > > --with-sysroot=$sysroot \
> > > --prefix=$prefix \
> > > --with-local-prefix=$sysroot \
> > > --enable-languages=c,c++,objc \
> > > --enable-shared \
> > > --enable-_cxz_atexit \
> > > --with-system-zlib \
> > > --enable-nls \
> > > --without-included-gettext \
> > > --enable-clocal=gnu \
> > > --enable-debug
> > >
> > > make all
> > > make install
> > >
> > > *****************************************************
> > > thx,
> > > NZG
> > >
> > > --
> > > For unsubscribe information see http://sourceware.org/lists.html#faq
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]