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]

making gcc relocatable


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-lib/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


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