Getting C
Home Up

Getting a C compiler

The SlugOS packages include the GNU C and C++ compiler, however it is not installed by default, but is split into several packages. 

You could install "slugos-native". Warning, this is HUGE!!

Getting just the C compiler

As far as I am able to determine you require the following packages:

  1. gcc
  2. gcc-symlinks

    gcc currently stands for "gnu compiler collection" or "gnu c compiler" depending on where you look. On it's own it appears to compile c code. As I understand it cpp is required to handle macros and g++ to compile c++ code.
  3. libc6-dev
  4. binutils

Other parts you might need:

  1. libusb-dev

    "libusb" is required to run programs that access the USB ports.
    "libusb-dev" is required to compile programs that use USB.

  2. make

    "make" is usually required to build source code that consists of more than one file.

  3. cpp

  4. cpp-symlinks

    cpp is the c pre-processor. It expands out macros before the source reaches the actual compiler. As k8055 compiled OK with out cpp I'm assuming cpp is only needed if macros are found.

  5. g++

  6. g++-symlinks

    g++ is the gnu c++ compiler and it functions as an extension to gcc.

Installing the compiler:

We'll start with gcc and gcc-symlinks

root@zebidee:~# ipkg install gcc
Installing gcc (3.4.4-r5) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/gcc_3.4.4-r5_armeb.ipk
Configuring gcc
root@zebidee:~# ipkg install gcc-symlinks
Installing gcc-symlinks (3.4.4-r5) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/gcc-symlinks_3.4.4-r5_armeb.ipk
Configuring gcc-symlinks
root@zebidee:~#

It's probably worth adding cpp and cpp-symlinks too:

root@zebidee:~# ipkg install cpp
Installing cpp (3.4.4-r5) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/cpp_3.4.4-r5_armeb.ipk
Configuring cpp
root@zebidee:~# ipkg install cpp-symlinks
Installing cpp-symlinks (3.4.4-r5) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/cpp-symlinks_3.4.4-r5_armeb.ipk
Configuring cpp-symlinks
root@zebidee:~#

Then libc6-dev. Note the dependencies, this package requires other packages:

  1. glibc-extra-nss
  2. libthread-db1
  3. linux-libc-headers-dev

Dependencies are normally downloaded and installed automatically, unless you are installing from files in which case you will have to install all the packages individually.

root@zebidee:~# ipkg install libc6-dev
Installing libc6-dev (2.3.5+cvs20050627-r6) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libc6-dev_2.3.5+cvs20050627-r6_armeb.ipk
Installing linux-libc-headers-dev (2.6.11.1-r2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/linux-libc-headers-dev_2.6.11.1-r2_armeb.ipk
Installing glibc-extra-nss (2.3.5+cvs20050627-r6) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/glibc-extra-nss_2.3.5+cvs20050627-r6_armeb.ipk
Installing libthread-db1 (2.3.5+cvs20050627-r6) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libthread-db1_2.3.5+cvs20050627-r6_armeb.ipk
Configuring glibc-extra-nss
Configuring libc6-dev
Configuring libthread-db1
Configuring linux-libc-headers-dev
root@zebidee:~# 

Then binutils. This package contains the assembler that gcc uses to create a program.

root@zebidee:~# ipkg install binutils
Installing binutils (2.16-r7) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/binutils_2.16-r7_armeb.ipk
Configuring binutils
root@zebidee:~#

We'll add libusb-dev as we'll need it later:

root@zebidee:~# ipkg install libusb-dev
Installing libusb-dev (0.1.12-r0) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libusb-dev_0.1.12-r0_armeb.ipk
Installing libusb (0.1.12-r0) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libusb_0.1.12-r0_armeb.ipk
Installing libstdc++6 (3.4.4-r3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libstdc++6_3.4.4-r3_armeb.ipk
Configuring libstdc++6
Configuring libusb
Configuring libusb-dev
root@zebidee:~#

There's a chain of dependencies here, libusb-dev requires libusb and libusb requires libstdc++6.

We'll add "make" as you're likely to need it eventually:

root@zebidee:~# ipkg install make
Installing make (3.80-r0) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/make_3.80-r0_armeb.ipk
Configuring make
root@zebidee:~#

Common problems:

gcc: installation problem, cannot exec `as': No such file or directory

"as" is the assembler used to produce a program. It's in the "binutils" package. This error probably just means that binutils isn't installed.

Home Up