maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   HOWTO: C/C++ compiling on the unit itself. (https://talk.maemo.org/showthread.php?t=6737)

torx 2007-06-10 09:07

HOWTO: C/C++ compiling on the unit itself.
 
[Last update: 21 July 07]

Here's how to do C/C++ compiling on the unit itself.

What you need:

gainroot
xterm (apt-get install osso-xterm)
wget (Download from: http://maemo.org/downloads/product/wget/)


Instructions:

First, fire up your xterm and type the following lines

Code:

sudo gainroot

//Now cd into a directory with at least 15mb free space

wget http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/libstdc++6_3.4.4cs2005q3.2-5.osso3_armel.deb http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/gcc-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb  http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/libstdc++6-dev_3.4.4cs2005q3.2-5.osso3_armel.deb  http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/g++-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb  http://repository.maemo.org/pool/maemo3.1/free/binary/libc6_2.3.5cs2005q3.2-5.osso12_armel.deb  http://repository.maemo.org/pool/maemo3.1/free/binary/linux-kernel-headers_2.6.16.osso7_armel.deb  http://repository.maemo.org/pool/maemo2.2/free/b/binutils/binutils_2.16.91cs2005q3.2-5.osso1_armel.deb
http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/cpp-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb

//After all the packages are downloaded

dpkg -i binutils_2.16.91cs2005q3.2-5.osso1_armel.deb
dpkg -i linux-kernel-headers_2.6.16.osso7_armel.deb
dpkg -i libc6-dev_2.3.5cs2005q3.2-5.osso12_armel.deb
dpkg -i cpp-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb
dpkg -i gcc-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb

//you will encounter dependencies error with the following steps.
//It's perfectly "alright"

dpkg -i libstdc\+\+6-dev_3.4.4cs2005q3.2-5.osso3_armel.deb
dpkg -i g\+\+-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb

//the following step will fix the depencies error
apt-get -f install

After you have done so, you will now be able to compile with the command

Code:

g++-3.4 yourprogramhere.cpp
**Do note that you will get a permission error if you try to compile your source files located on a vfat storage.

These steps are put together by a linux beginner who has no idea what he is doing. It didn't screw up my installation, but your mileage may vary.

torx 2007-06-24 14:21

Re: HOWTO: C/C++ compiling on the unit itself.
 
I'm not sure if anyone actually cares about this thread, but anyway, some updates.

I have verified that the SciTE editor works fine at compiling c++ programs.

However, to use the compile button on Scite editor, you need to make type the following commands into your xterm.

Code:

sudo gainroot
cd /usr/bin
ln -s g\+\+\-3.4 g\+\+

Using the build command will however require 'make'.

peterjb31 2007-06-24 14:33

Re: HOWTO: C/C++ compiling on the unit itself.
 
Do you by any chance know where a copy of 'make' exists for the device?

torx 2007-06-24 14:41

Re: HOWTO: C/C++ compiling on the unit itself.
 
Here it is.


This should get it installed IF there are no dependencies error. No time to check that now, but i will do that soon.

Code:

sudo gainroot

wget http://repository.maemo.org/pool/maemo2.2/free/m/make/make_3.80-9osso_armel.deb

dpkg -i make_3.80-9osso_armel.deb


robmiller 2007-06-24 14:42

Re: HOWTO: C/C++ compiling on the unit itself.
 
Quote:

Originally Posted by torx (Post 53643)
I'm not sure if anyone actually cares about this thread, but anyway, some updates.

I'm watching and interested :)

rob.

peterjb31 2007-06-24 14:47

Re: HOWTO: C/C++ compiling on the unit itself.
 
No dependency errors. Thanks.

seattleweb 2007-07-17 04:53

Re: HOWTO: C/C++ compiling on the unit itself.
 
Doesn't seem to work :(

Khertan 2007-07-17 05:10

Re: HOWTO: C/C++ compiling on the unit itself.
 
i've successfully install gcc and osso/hildon library before the flash with the new os. But it's take too many place (100Mo).

torx 2007-07-19 13:54

Re: HOWTO: C/C++ compiling on the unit itself.
 
Quote:

Originally Posted by seattleweb (Post 60515)
Doesn't seem to work :(

On the new OS? I have yet to tried it install it on the new OS yet, but i'll try it out this weekend.

edit: realised i left out wget-ing one of the files in my instructions. i have updated it, so try again if you will.

edit: seems like these instructions are not useful on the latest firmware ('chinook').

torx 2007-07-20 15:20

Re: HOWTO: C/C++ compiling on the unit itself.
 
Quote:

Originally Posted by Khertan (Post 60518)
i've successfully install gcc and osso/hildon library before the flash with the new os. But it's take too many place (100Mo).

On a uncompressed ext 2 filesystem, the whole installation takes up 50mb on my system. If you are using the jffs2 filesystem, it should be much lesser.

robmiller 2007-07-20 21:59

Re: HOWTO: C/C++ compiling on the unit itself.
 
can anyone supply a hint or fix for the binutils ld not finding shared libraries?

Code:

Nokia-N800-26:~# ldconfig -v | grep crypto
        libcrypto.so.0.9.7 -> libcrypto.so.0.9.7
Nokia-N800-26:~# ldconfig --print-cache | grep crypto
        libcrypto.so.0.9.7 (libc6) => /usr/lib/libcrypto.so.0.9.7
Nokia-N800-26:~# ld -lcrypto
ld: cannot find -lcrypto
Nokia-N800-26:~# ls /usr/lib/libcrypto*
/usr/lib/libcrypto.so.0.9.7
Nokia-N800-26:~# ls /usr/lib/libc.*
/usr/lib/libc.a  /usr/lib/libc.so
Nokia-N800-26:~# ld -lc
ld: BFD 2.16.91 20051213 assertion fail /home/ed/su18-2006se-armel-sandbox.gcc34qemu.distcc/work/binutils-2.16.91cs2005q3.2/bfd/elf32-arm.c:2320
ld: warning: cannot find entry symbol _start; defaulting to 00008100
Nokia-N800-26:~#

?

thanks,

rob.

edit:

the problem is with libs that do not end in .so :

Code:


Nokia-N800-26:~/code# ls /usr/lib/libcrypto*
/usr/lib/libcrypto.so.0.9.7
Nokia-N800-26:~/code# cd /usr/lib
Nokia-N800-26:/usr/lib# ld -lcrypto
ld: cannot find -lcrypto
Nokia-N800-26:/usr/lib# ln -s libcrypto.so.0.9.7 libcrypto.so
Nokia-N800-26:/usr/lib# ld -lcrypto
ld: BFD 2.16.91 20051213 assertion fail /home/ed/su18-2006se-armel-sandbox.gcc34qemu.distcc/work/binutils-2.16.91cs2005q3.2/bfd/elf32-arm.c:2320
ld: warning: cannot find entry symbol _start; defaulting to 00008248
Nokia-N800-26:/usr/lib#

rob.

i.rachita 2007-08-07 10:37

Re: HOWTO: C/C++ compiling on the unit itself.
 
I had some errors when i was trying to install g++. A file was missed in the wget step and another one that was downloaded wasn't installed.
Here is the modified script that worked for me.

Code:

wget http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/libstdc++6_3.4.4cs2005q3.2-5.osso3_armel.deb http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/gcc-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/libstdc++6-dev_3.4.4cs2005q3.2-5.osso3_armel.deb  http://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/g++-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb  http://repository.maemo.org/pool/maemo3.1/free/binary/libc6_2.3.5cs2005q3.2-5.osso12_armel.deb  http://repository.maemo.org/pool/maemo3.2/free/binary/libc6-dev_2.3.5cs2005q3.2-5.osso12_armel.debhttp://repository.maemo.org/pool/maemo3.1/free/binary/linux-kernel-headers_2.6.16.osso7_armel.deb  http://repository.maemo.org/pool/maemo2.2/free/b/binutils/binutils_2.16.91cs2005q3.2-5.osso1_armel.debhttp://repository.maemo.org/pool/maemo2.2/free/g/gcc-3.4/cpp-3.4_3.4.4cs2

dpkg -i binutils_2.16.91cs2005q3.2-5.osso1_armel.deb
dpkg -i linux-kernel-headers_2.6.16.osso7_armel.deb
dpkg -i libc6_2.3.5cs2005q3.2-5.osso12_armel.deb
dpkg -i libc6-dev_2.3.5cs2005q3.2-5.osso12_armel.deb
dpkg -i cpp-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb
dpkg -i gcc-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb

dpkg -i libstdc\+\+6-dev_3.4.4cs2005q3.2-5.osso3_armel.deb
dpkg -i g\+\+-3.4_3.4.4cs2005q3.2-5.osso3_armel.deb

apt-get -f install

I hope i haven't missed anything.

torx 2007-08-07 12:15

Re: HOWTO: C/C++ compiling on the unit itself.
 
Thanks rob and i.rachita for the update/fix!

Anyway rob, does that mean that libraries that end in .so will work now? Is it only libcrypto that is affected or are there other libraries that don't end in .so too?

gotanga 2007-08-07 15:54

Re: HOWTO: C/C++ compiling on the unit itself.
 
Hi,

This looks brilliant, and i'll try it out soon. Should i consider converting/creating a new partition (efs and jffs2 are mentioned) on my internal memory card for this?

torx 2007-08-08 06:56

Re: HOWTO: C/C++ compiling on the unit itself.
 
Quote:

Originally Posted by gotanga (Post 66226)
Hi,

This looks brilliant, and i'll try it out soon. Should i consider converting/creating a new partition (efs and jffs2 are mentioned) on my internal memory card for this?

That's really up to you, it takes up 50mb on my uncompressed filesystem. On a jffs2 partition, it should take up a lot lesser.

click170 2008-02-03 01:44

Re: HOWTO: C/C++ compiling on the unit itself.
 
Great post, thanks for the info!

Much appreciated.

codeMonkey 2008-02-22 21:45

Re: HOWTO: C/C++ compiling on the unit itself.
 
Agreed. Just followed a modified version to get gcc working on an N800 in OS2008 and it works a treat. Portable c++ development here I come.

Baranman 2008-02-27 16:03

Re: HOWTO: C/C++ compiling on the unit itself.
 
Hi,

Then, it's possible to compile a c or c++ app source like in any other linux dist?

I'm thinking that if we have the make utilitie and c/c++ libs, it's possible to make ./configure make make install/or buid package with dpkg utilitie, is it true?

sorry if this is an stupid question, i'm new with the IT, and escuse my poor english.

dont 2008-02-27 16:12

Re: HOWTO: C/C++ compiling on the unit itself.
 
I would love to see a complete replacement for Scratchbox that runs on the tablet. Plus Glade.

This is way beyond my capabilities to create but I would cheer heartily from the sidelines.;)

OSEmuTech 2008-03-09 02:47

Re: HOWTO: C/C++ compiling on the unit itself.
 
This is so cool. As I read a PDF about C++ using the Evince Document reader, I can try out the examples using SciTE.

http://fkwjcw.bay.livefilestore.com/...Q/sciteIDE.png

gregrob 2009-01-21 14:58

Re: HOWTO: C/C++ compiling on the unit itself.
 
I did this today, and had to update all of the WGETs to reflect the latest OS. As well the install for G++ had to be done simultaneously with the libc++-dev. Here is what I did:

wget http://repository.maemo.org/pool/dia...sso8_armel.deb
wget http://repository.maemo.org/pool/dia...sso8_armel.deb
wget http://repository.maemo.org/pool/dia...sso8_armel.deb
wget http://repository.maemo.org/pool/dia...sso8_armel.deb
wget http://repository.maemo.org/pool/dia...sso8_armel.deb
wget http://repository.maemo.org/pool/dia...so10_armel.deb
wget http://repository.maemo.org/pool/dia...so10_armel.deb
wget http://repository.maemo.org/pool/mae...11-1_armel.deb
wget http://repository.maemo.org/pool/dia...sso1_armel.deb

dpkg -i binutils_2.16.91cs2005q3.2-5.osso1_armel.deb
dpkg -i linux-kernel-headers_2.6.16.osso11-1_armel.deb
dpkg -i libc6_2.5.0-1osso10_armel.deb
dpkg -i libc6-dev_2.5.0-1osso10_armel.deb
dpkg -i gcc-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb
dpkg -i cpp-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb
dpkg -i libstdc\+\+6_3.4.4cs2005q3.2-5.osso8_armel.deb
dpkg -i libstdc\+\+6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb

apt-get -f install

apt-get install make

cd /usr/bin
ln -s g\+\+\-3.4 g\+\+

After this I also downloaded the source for grep-2.4 to replace the busybox grep. This helps compiling many other packages:
wget http://mirror.csclub.uwaterloo.ca/gn...rep-2.4.tar.gz
gunzip -dc grep-2.4.tar.gz | tar -xv
cd grep-2.4/
./configure
make
make install
rm /bin/grep
ln -s /usr/local/bin/grep /bin/grep

Nathan 2009-01-26 04:30

Re: HOWTO: C/C++ compiling on the unit itself.
 
Just one note; to get grep compiled I needed to use

./configure --host=arm-linux-gnueabi

It couldn't detect what platform it was on.
Also, you can also create links to egrep and fgrep as compiling this packages will give you all three egrep/fgrep/grep.

Nathan.
P.S. Is their some environmental variable I do need to set, so I do not have to use the --host, anyone know?

mrphamtruong-vietnam 2009-02-09 06:06

Re: HOWTO: C/C++ compiling on the unit itself.
 
please help me compiling this app:
http://code.google.com/p/scim-unikey/downloads/list
thanks!:)

nhanquy 2009-02-09 06:39

Re: HOWTO: C/C++ compiling on the unit itself.
 
Quote:

Originally Posted by mrphamtruong-vietnam (Post 263089)
please help me compiling this app:
http://code.google.com/p/scim-unikey/downloads/list
thanks!:)

It's not a simple task we have to port x86 to armel and that needs time and effort.

stacia 2009-02-17 00:29

Re: HOWTO: C/C++ compiling on the unit itself.
 
I'm getting this error :

http://www.internettablettalk.com/fo...ight=libc6-dev

Any ideas?

haokah 2009-02-21 16:07

Re: HOWTO: C/C++ compiling on the unit itself.
 
Looks like the lib6c version on the tablet isn't high enough for the program you want to use. You might want to try an older version of what you're wanting, as it probably has lower dependencies.

virusforu 2010-05-02 15:09

Re: HOWTO: C/C++ compiling on the unit itself.
 
where i can download gcc for C++,arm programming for my n900


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

vBulletin® Version 3.8.8