self-contained cross-compiler?

Roman Duka rduka@mail.ru
Tue Dec 16 18:18:00 GMT 2003


Ken Wolcott wrote:
> 
> Roman;
> 
>   I'm using crosstool to generate the cross tool chain.  I've only edited 
> crosstool.sh to change the make call(s), I've not edited the Makefile.
> 
>   I'll take another look at LFS in general (*shudder*) and your specific 
> mention of LFS...
> 
> Thanks,
> Ken
> 
right, i've just managed to build static binutils for x86-cross-sparc

roman@athlon1000:~/crosstool/sparc-unknown/bin> ls
sparc-unknown-linux-gnu-addr2line  sparc-unknown-linux-gnu-ld 
sparc-unknown-linux-gnu-ranlib   sparc-unknown-linux-gnu-strip
sparc-unknown-linux-gnu-ar         sparc-unknown-linux-gnu-nm 
sparc-unknown-linux-gnu-readelf
sparc-unknown-linux-gnu-as         sparc-unknown-linux-gnu-objcopy 
sparc-unknown-linux-gnu-size
sparc-unknown-linux-gnu-c++filt    sparc-unknown-linux-gnu-objdump 
sparc-unknown-linux-gnu-strings

roman@athlon1000:~/crosstool/sparc-unknown/bin> file *as
sparc-unknown-linux-gnu-as: ELF 32-bit LSB executable, Intel 80386, 
version 1 (SYSV), statically linked, not stripped

roman@athlon1000:~/crosstool/sparc-unknown/bin> ldd *as
         not a dynamic executable

roman@athlon1000:~/crosstool/sparc-unknown/bin>

the key is to
run "configure" with --disable-nls option
run "make configure-host"
run "make configure-target"
run "make LDFLAGS=-all-static"
run "make install"

Note: you need to change line "make LDFLAGS=-all-static all" to "make 
LDFLAGS=-all-static" otherwise build will fail
anyway below is the function for building static binutils from my scripts

mkbinutils() {

echo "Unpacking binutils sources" \
&& cd $BUILDDIR && unpacksrc $BINUTILS \
&& echo "Patching binutils source tree" \
&& patchsrc $BINUTILS \
&& mkdir -p $BUILDDIR/binutils-build \
&& cd $BUILDDIR/binutils-build \
&&
if test '!' -f Makefile
then
     $BUILDDIR/$BINUTILS/configure --target=$MTARGET 
--prefix=$INSTALLDIR --disable-nls
fi \
&& make configure-host \
&& make configure-target \
&& make LDFLAGS="-all-static" \
&& make install \
&& cd .. \
&& rm -rf $BUILDDIR/binutils* \
&& if test ! -x $INSTALLDIR/bin/$MTARGET-ld
then
     return 1
fi

#---------------------------------------------------------
}


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list