view · edit · print · history

Note that the Unslung development team uses the native toolchain which is built by crosstool-native.mk in the Unslung CVS repository. See NativelyCompileUnslungPackages for more details.

Note that the following native toolchain is an externally contributed item, and is not supported by the Unslung or OpenSlug development teams. Please address any questions or bugs to the original contributor (gullc at phys.ethz.ch).

Oct 01 21:34:45 <emanuel> Hi guys, unfortunately I can't post to the mailing list right now, but you might want to check out the gnu compiler:

Oct 01 21:35:24 <emanuel> http://n.ethz.ch/student/gullc/download/toolchain.html(approve sites)

Oct 01 21:35:51 <emanuel> It's a gcc that runs on the NSLU2-box and produces code for the NSLU2-box.

Oct 01 21:36:29 <emanuel> It works fine for me - maybe someone else ought to try it too to check if everything's fine.

Nov 07 <michaelebrown> It works fine for me for simple things. I'm running into some slight complications with locations of include files for more complex projects, but nothing major. For an example, check out BuildGNUMakeOnYourNSLU2Box.

The download is very slow, so try using the Coralized link which caches the file. It may well download much faster once it has been Coralized. Or it might not (some people have found that the Coralized link delivers less than 1KB/s, but the original link delivers >100KB/s)

Coralized link http://n.ethz.ch.nyud.net:8090/student/gullc/download/gcc-3.3.4-glibc-2.2.5.tar.gz(approve sites)

Non-coralized link http://n.ethz.ch/student/gullc/download/gcc-3.3.4-glibc-2.2.5.tar.gz(approve sites)

BuildGNUMakeOnYourNSLU2Box worked well with the above instructions, but if you've never setup a toolchain before (like me), you might not find gcc is configured correctly if you want to MakeGNUGawkOnYourNSLU2Box. In addition to creating various symlinks and the library path, you should set the C_INCLUDE_PATH environment variable to an appropriate value; I used this:


Be sure to export C_INCLUDE_PATH once it is set to avoid compile time errors. You will probably also need to export LD_LIBRARY_PATH and/or LD_RUN_PATH also, if you need to be able to link to locally built libs

Some folks have had trouble with this. I've had some success, including building a very large package. Time to share the technique.

This work based on the above, and BuildGNUMakeOnYourNSLU2Box.

Here are some scripts that may help with setup and use:

This one copies the tools (I renamed the .gz file to keep it straight - too many toolsets is confusing).

Copy the toolset .gz file (from http://n.ethz.ch.nyud.net:8090/student/gullc/download/gcc-3.3.4-glibc-2.2.5.tar.gz(approve sites)) to /share/hdd/data/tools/native-arm-gcc-3.3.4-glibc-2.2.5.tar.gz

Copy make from ftp://ftp.gnu.org/pub/gnu/make/make-3.80.tar.bz2 to /share/hdd/data/tools

Then run this script. It will install the toolchain and make. Eventually. It takes quite a while.

It will also create /share/hdd/data/tools/setup.sh, which you should source (.) in your .profile.

I suppose one could delete the build files, but it seems like work, and disk space is cheap. I leave that as an exercise to the reader.

That's as automated as I could make it.

Disclaimer: Providing this script does not constitute "support."




 #! /bin/sh
 echo "Setup for native tools on NSLU2"

 if [ ! -d /share/hdd/data/tools ]; then
 echo "Creating tools directory /share/hdd/data/tools"
 mkdir /share/hdd/data/tools
 return 0

 if [ ! -d /share/hdd/data/tools/gcc-3.3-4-glibc-2.2.5 ]; then
 if [ ! -e /share/hdd/data/tools/native-arm-gcc-3.3.4-glibc-2.2.5.tar.gz ]; then
 echo "Please copy native-arm-gcc-3.3.4-glibc-2.2.5.tar.gz to /share/hdd/data/tools"
 return 0
 echo "Installing native tools"
 tar -xzf /share/hdd/data/tools/native-arm-gcc-3.3.4-glibc-2.2.5.tar.gz -C /share/hdd/data/tools && rm /share/hdd/data/tools/native-arm-gcc-3.3.4-glibc-2.2.5.tar.gz

 echo "Creating links"

 ln -sf /share/hdd/data/tools/gcc-3.3.4-glibc-2.2.5 /share/hdd/data/tools/gcc

 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-addr2line /share/hdd/data/tools/gcc/bin/addr2line
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-ar /share/hdd/data/tools/gcc/bin/ar
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-as /share/hdd/data/tools/gcc/bin/as
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-c++ /share/hdd/data/tools/gcc/bin/c++
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-c++filt //share/hdd/data/tools/gcc/bin/c++filt
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-cpp /share/hdd/data/tools/gcc/bin/cpp
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-g++ /share/hdd/data/tools/gcc/bin/g++
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-gcc /share/hdd/data/tools/gcc/bin/gcc
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-gcc-3.3.4 /share/hdd/data/tools/gcc/bin/gcc-3.3.4
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-gccbug /share/hdd/data/tools/gcc/bin/gccbug
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-gcov /share/hdd/data/tools/gcc/bin/gcov
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-gprof /share/hdd/data/tools/gcc/bin/gprof
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-ld /share/hdd/data/tools/gcc/bin/ld
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-nm /share/hdd/data/tools/gcc/bin/nm
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-objcopy /share/hdd/data/tools/gcc/bin/objcopy
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-objdump /share/hdd/data/tools/gcc/bin/objdump
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-ranlib /share/hdd/data/tools/gcc/bin/ranlib
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-readelf /share/hdd/data/tools/gcc/bin/readelf
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-size /share/hdd/data/tools/gcc/bin/size
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-strings /share/hdd/data/tools/gcc/bin/strings
 ln -sf /share/hdd/data/tools/gcc/bin/armv5b-softfloat-linux-strip /share/hdd/data/tools/gcc/bin/strip

 echo "Writing setup file"

 if [ ! -e /share/hdd/data/tools/setup.sh ]; then
 echo "export PATH=\$PATH:/share/hdd/data/tools/gcc/bin" >/share/hdd/data/tools/setup.sh
 echo "export LD_LIBRARY_PATH=/lib:/opt/lib:/usr/lib:/usr/local/lib:/share/hdd/data/tools/gcc/armv5b-softfloat-linux/lib" >>/share/hdd/data/tools/setup.sh
 echo "export LDFLAGS=\"-L/usr/local/lib\"" >>/share/hdd/data/tools/setup.sh
 echo "export C_INCLUDE_PATH=/usr/include:/usr/local/include:/share/hdd/data/tools/gcc/include:/share/hdd/data/tools/gcc/armv5b-softfloat-linux/include:/share/hdd/data/tools/gcc/armv5b-softfloat-linux/sys-include" >>/share/hdd/data/tools/setup.sh
 . /share/hdd/data/tools/setup.sh

 if [ ! -x /opt/bin/make ]; then
 if [ ! -d /share/hdd/data/tools/make-3.80 ]; then
 if [ ! -e /share/hdd/data/tools/make-3.80.tar.bz2 ]; then
 echo "Please copy make-3.80.tar.bz2 to /share/data/hdd/tools"
 return 0
 echo "Installing make 3.80"
 bunzip2 /share/hdd/data/tools/make-3.80.tar.bz2
 tar -xf /share/hdd/data/tools/make-3.80.tar -C /share/hdd/data/tools && rm /share/hdd/data/tools/make-3.80.tar && rm make-3.80.tar.bz2
 cd /share/hdd/data/tools/make-3.80
 echo "Configuring to build make.  Please be patient"
 echo "Patching make"
 sed -e 's/@REMOTE@/stub/' build.sh > build-fixed.sh
 echo "Building make.  More patience is required..."
 /bin/sh build-fixed.sh
 strip make
 echo "Build complete, installing make"
 mv make /opt/bin

 echo "Tools environment is now setup."
 echo "Please add ". /share/hdd/data/tools/setup.sh" to your .profile"

 return 1

Note: As usual, remove the single space at the front of each line. Also, note that some lines are very long; don't wrap!.

2nd Note: Corrected script - in multiple places, "/share/data/hdd/..." was corrected to "/share/hdd/data/..."

3rd Note: Corrected script - added missing "/bin" in ln lines, and changed "s/@REMOTE@/stub" to "s/@REMOTE@/stub/"

4th Note: Corrected script - changed "/opt/bin/sh build-fixed.sh" to "/bin/sh build-fixed.sh". It is our shell environment after all.

Just a brief "Thank you" for the corrections. I apologize for the errors; actually, I had fixed them, but posted the wrong version by mistake. In any case, I hope that the automation has been helpful to others.


5th Note: I added /usr/local/lib to LD_LIBRARY_PATH, as well as LDFLAGS, to setup.sh to fix link errors when libraries have been installed to e.g. /usr/local/lib . It's maybe generally unnecessary but seems to be solving some problems for me (e.g. building libvorbis) DaveHooper?

6th Note: Coreutils should be installed before building make. (./configure relies on uname.)

Page last modified on April 14, 2005, at 10:26 PM