[maemo-developers] Developping C application on maemo without scratchbox

From: Karoliina.T.Salminen at nokia.com Karoliina.T.Salminen at nokia.com
Date: Wed Mar 21 17:15:28 EET 2007
>I'm trying to run a simple program on my device nokia N800, 
>without scratchbox and it doesn't work!!

First of all what are you trying to do?
Are you trying to set up compilation environment on the device in order
to be able to compile
programs without scratchbox? This is very complicated thing to do. The
reason is simply that
the development libraries, gcc etc. takes a lots of space and you may be
in trouble in trying to fit that
on the internal flash. This would be pretty cool thing to have if there
was plenty of resources on
the device to allow that, but with the restrictions the device sets, it
is going to be hard and
I am not sure if you was going to attempt this.

Or maybe you trying to do something else like execute your hello.c on
your device. If the case
is the latter, it sounds like you don't have your compilation
environment, in other words, Scratchbox, correctly setted up on your PC
and you are trying something else which will not work.

> It tells me 
>Permission Denied when I use ./, after doing chmod +x, and I 
>can't use gcc to run it !!

I guess you know gcc is not used to run c-programs but to compile them
to machine language.
The C is compiled language and is not an interpreted language where you
could run
something with gcc. I hope you are not meaning chmod +x hello.c and then
./hello.c which will of course never work.

> I already install a gcc package 
>gcc3.4.4, but I don't have the possibility to use it!

Where did you install it? On the device or on your computer?

>Please could someone help me!!
>Thank you very much for reply!!

If you want to do a simple C application for N800, you have to:
1. install scratchbox according to the instructions on the Meamo site
2. install rootstraps according to the instructions on the Maemo site
3. _Inside_ the scratchbox on arm-target, compile your program, for
gcc hello.c -o hello
4. Copy your compiled executable to the device by e.g. copying to the
memory card.
5. Go to x-terminal and cd e.g. /media/mmc2/ (depending on which memory
card you did put your
file, is it in the internal slot or on the external slot)
6. Then you can execute your hello by typing ./hello

And surely it works and it doesn't say "Permission Denied". It can say
this if you haven't
compiled your binary properly, e.g. if you have compiled in on the PC
without the cross compilation
environment, namely Scratchbox. 

Best Regards,
Karoliina Salminen

More information about the maemo-developers mailing list