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...
Configuring gcc
root@zebidee:~# ipkg install gcc-symlinks
Installing gcc-symlinks (3.4.4-r5) to root...
Configuring gcc-symlinks

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

root@zebidee:~# ipkg install cpp
Installing cpp (3.4.4-r5) to root...
Configuring cpp
root@zebidee:~# ipkg install cpp-symlinks
Installing cpp-symlinks (3.4.4-r5) to root...
Configuring cpp-symlinks

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...
Installing linux-libc-headers-dev ( to root...
Installing glibc-extra-nss (2.3.5+cvs20050627-r6) to root...
Installing libthread-db1 (2.3.5+cvs20050627-r6) to root...
Configuring glibc-extra-nss
Configuring libc6-dev
Configuring libthread-db1
Configuring linux-libc-headers-dev

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...
Configuring binutils

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...
Installing libusb (0.1.12-r0) to root...
Installing libstdc++6 (3.4.4-r3) to root...
Configuring libstdc++6
Configuring libusb
Configuring libusb-dev

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...
Configuring make

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.