maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [fremantle/n900] native gcc on device possible? (https://talk.maemo.org/showthread.php?t=79466)

dyx 2011-10-29 05:54

[fremantle/n900] native gcc on device possible?
 
I want to compile really small native C programs (like wrapper python modules) for maemo so I do not care about the compilation speed.

I don't want to install scratchbox on my linux box (it's too big and ugly and has no proper packaging) so I was thinking I could just compile right on the device.

but alas, gcc package appears stripped from its contents entirely save for the directories and readme files.

so is it not possible to compile for n900 directly on the device?

I heard about easy-debian but not sure if gcc there can be used to make native maemo apps, rather than apps that will only run inside debian chroot. If it can, I'll go for it.

bonapart 2011-10-29 07:16

Re: [fremantle/n900] native gcc on device possible?
 
you need to add SDK repository and install gcc
root
echo "deb http://repository.maemo.org fremantle/sdk free non-free">>sources.list
apt-get update
apt-get install gcc

qwazix 2011-10-29 07:19

Re: [fremantle/n900] native gcc on device possible?
 
Yes, it is possible. It is not straightforward though, there is a kind of circular dependency. I read a post some time ago about how to do it but I can't search for it now. Search a bit more and if you don't get anything, post here, when I get home I can give it a try.

EDIT: you beat me. I didn't know it was that easy...

electroaudio 2011-10-29 08:41

Re: [fremantle/n900] native gcc on device possible?
 
Thanks guys and ofcourse the OP for bringing it up :)
That was way easier than the ossguys GCC installation i saw earlier...

Now a related problem for a linux newbie like me...
How do i compile with gcc?
I tried "gcc filename.cpp" and got "no such file or directory"

tuxsavvy 2011-10-29 09:36

Re: [fremantle/n900] native gcc on device possible?
 
You have to be in the same directory as the source for your PWD. Also judging by the extension, the file may not be able to be compiled with gcc. gcc only handles c files primarily. You would need something like g++ to handle c plus plus (cpp) files.

electroaudio 2011-10-29 09:47

Re: [fremantle/n900] native gcc on device possible?
 
Thanks, the C extension did the trick ;)
But why did it give an error on include stdio.h , No such file or directory?

szopin 2011-10-29 11:36

Re: [fremantle/n900] native gcc on device possible?
 
For gcc/++ 4.2 install build-essentials from SDK repo. For 4.4 search for tannerlab repo and get all gcc related packages from there (uninstalling 4.2 first is advisable so they don't conflict, you need to manually select packages as there is no metapackage like build-essentials on it)

tuxsavvy 2011-10-29 11:50

Re: [fremantle/n900] native gcc on device possible?
 
its looking for its dependencies. The dependency requested by that cpp file is standard input/output which is missing from either the PWD or from the defined location.

szopin 2011-10-29 11:56

Re: [fremantle/n900] native gcc on device possible?
 
yeah, build-essentials includes some standard headers/libs, which is why installing it should fix it. gcc alone is just that, compiler.

daperl 2011-10-29 14:56

Re: [fremantle/n900] native gcc on device possible?
 
If you want the SDK on your n900, click the link in my signature.

Oblomow 2011-10-29 16:11

Re: [fremantle/n900] native gcc on device possible?
 
Quote:

Originally Posted by dyx (Post 1115427)
I heard about easy-debian but not sure if gcc there can be used to make native maemo apps, rather than apps that will only run inside debian chroot. If it can, I'll go for it.

At least it does not work easily out-of-the-box. I just tried to compile a "hello world" in C++, and when executing it under plain maemo it complains about a wrong version of libstdc++.so. You can execute easy-debian programs from the maemo shell by placing the "debbie" command in front of your command line, though.

brahim98 2011-10-29 18:59

Re: [fremantle/n900] native gcc on device possible?
 
Hello
I actualy compile every program on device. It's very easy :).

add testing, devel, sdk and tools to your sources
Code:

echo "deb http://repository.maemo.org/extras-testing fremantle free non-free">>/etc/apt/sources.list
echo "deb http://repository.maemo.org/extras-devel fremantle free non-free">>/etc/apt/sources.list
echo "deb http://repository.maemo.org fremantle/sdk free non-free">>/etc/apt/sources.list
echo "deb http://repository.maemo.org fremantle/tools free non-free">>/etc/apt/sources.list

Edit : You need to add nokia-binaries repository too. I don't want to show an easy copy and paste here as I had to register and you probably need to. If you don't know how to or don't want to add it, just remove the packages on the list that are making error.

now install gcc, g++ and some useful development libraries
Code:

apt-get update
apt-get install dpkg-dev make gcc g++ libsdl1.2-dev libgles1-sgx-img-dev libgles2-sgx-img-dev libsdl-gles1.2-dev libwxgtk2.8-dev

now you should be able to compile your first c program
Code:

echo "#include <stdio.h>">main.c
echo "int main(int argc,char *argv[]){printf(\"hello world\");return 0;}">>main.c
gcc -o hello main.c
./hello

edit and extend main.c ;)

reinob 2011-10-30 13:21

Re: [fremantle/n900] native gcc on device possible?
 
One question: are these SDK packages optified?
I suppose not.. in which case, how much space does this take off the rootfs?

brahim98 2011-10-30 18:28

Re: [fremantle/n900] native gcc on device possible?
 
I don't know exactly how much it takes on rootfs but I got around the rootfs problem with this method.

reinob 2011-10-31 07:46

Re: [fremantle/n900] native gcc on device possible?
 
@brahim98,

Wow. I had thought about doing something like that, but didn't dare till now. I will print out your howto and keep it for reference (maybe some day I'll have the guts to do it :)

abubakar 2011-11-19 20:06

Re: [fremantle/n900] native gcc on device possible?
 
@brahim98 I have tried those commands, but i'm getting:

"E: Couldn't find package libgles1-sgx-img-dev"

all repos i wrote on console as you mentioned. Plz help resolve this error. Thanks.

brahim98 2011-11-19 20:38

Re: [fremantle/n900] native gcc on device possible?
 
My mistake :o
you need nokia-binaries repository, I don't know if I am authorized to add it to the former tutorial but I will mention it.

zdanee 2011-11-19 20:56

Re: [fremantle/n900] native gcc on device possible?
 
Be my guest: http://firstsearchblue.com/how-to-in...on-nokia-n900/

abubakar 2011-11-20 09:59

Re: [fremantle/n900] native gcc on device possible?
 
ok what you have to do is, goto this page:
http://tablets-dev.nokia.com/eula/index.php

In the end of the page, write the number in the textbox above the ACCEPT button, and click the accept button. It will take you to the next page, which will give you pretty clear instructions on how to add nokia-binaries repo with your specific token code (just one line, and btw it talks about adding that line to scratchbox, thats for the sdk on pc, just add that line to your devcie's sources file, or use the echo statement as mentioned above). Every dev adding this repo has to accept the EULA and is given their own token, thats why @brahim98 could not share it. Its a very small step guys, so just do it :)

and now you do an apt-get update and the apt-get command of all those binaries that brahim98 mentioned, that and an 86mb install later, you have a lot of dev stuff in your device to play with :) ... I just wrote little c program to calculate fibonacci series and compiled on device and it runs just fine :)

Conky tells me my rootfs has 20.6 mb left. I didnt note what it was before, but as of now I dont have a problem with that.

misterc 2012-07-09 20:31

Re: [fremantle/n900] native gcc on device possible?
 
Quote:

Originally Posted by reinob (Post 1115934)
One question: are these SDK packages optified?
I suppose not.. in which case, how much space does this take off the rootfs?

25MBs give or take


All times are GMT. The time now is 22:16.

vBulletin® Version 3.8.8