Handhelds.org - Open source for handheld devices

UserPreferences

DevelopOnFamiliar


1. You should have some more space for devel libs. You can get it with NFS or SD card. Here I will give instructions with SD card. So first we prepeare SD card. You can set SD card as root or just take instructions from here: [WWW]http://www.handhelds.org/moin/moin.cgi/UseAnSDCardForRoot to make SD card formated with ext2 file system.

IMPORTANT: SD card should be ext2 formated, because of links needed by libs.

2. Install gcc compiler and binutils. To do this first add your new made space as ipkg source destination by adding line to /etc/ipkg.conf like this

dest card /mnt/card
Now you can install packages you need
ipkg install glibc-extra-nss libthread-db1
ipkg install -d card binutils binutils-symlinks cpp gcc gcc-symlinks libc6-dev

(If you wonder about feed take this http://familiar.handhelds.org/releases/v0.8.2/feed/base)

I installed also this
ipkg install -d card g++ g++-symlinks
To have all card packages linked to default locations against root (like /bin/gcc for /media/card/gcc) use this:
ipkg-link mount /media/card/
3. Write hello world programm in file hello.c
#include <stdio.h>

int main(int argc, char** argv) {
  printf("Hello, World!\n");
  return 0;
}
4. If you try
gcc hello.c -o hello
for some reason test app do not compiles. It says that it can't find -lgcc_s. I get rid of this with command:
ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
5. You should also correct some kind of bug in file /usr/lib/libc.so with comenting out last line with *** so it will look like this
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.
*** BUG in libc/scripts/output-format.sed *** elf32-bigarm,elf32-littlearm */
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )

This file has changed in 0.8.4-rc2, but it still breaks. if you set the line starting with 'GROUP' to what is above and leave everything else alone, it works.

If you want to compile somthing with -pthread option then do the same with file - /usr/lib/libpthread.so (this file is fine now (0.8.4-rc2))

6. Compile it with
gcc hello.c -o hello
7. If you try to use ar (or libtool) you will probably run into something like this:
ar: cru: No such file or directory
[WWW]Here the problem is described:
00:03.19        joh     anything strange with the version of 'ar' in busybox?
00:03.55        joh     I do this: "ar cru libiw.a iwlib.o" and get "ar: cru: No such file or directory"
00:04.03        kergoth its extract only.
00:04.05        kergoth no create
00:04.17        joh     oh, is it possible to enable create?
00:04.26        kergoth not that i know of
00:05.14        joh     doh
It's finding /usr/bin/ar which is a symlink that points to busybox rather than /mnt/card/packages/usr/bin/arm-linux-ar. So do this:
rm /usr/bin/ar
ln -s /mnt/card/packages/usr/bin/arm-linux-ar /usr/bin/ar
The above didn't work for me (JoshuaLayne), instead:
rm /usr/bin/ar
ln -s /mnt/card/usr/bin/arm-linux-ar /usr/bin/ar