fueler
Posts: 1
Joined: Thu Jul 12, 2012 2:28 am

Compiling GCC on Raspberry Pi

Mon Aug 13, 2012 12:57 am

I am trying to compile GCC on the Raspberry Pi itself.

Background:
I am using the the Wheezy distro off the download page.

Steps so far:
1. Added the following to /etc/apt/sources.list
deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
2. sudo apt-get update
3. sudo apt-get build-dep gcc binutils gdb

During step #3 I run into issues with the package libecj-java-gcj, I am unable to configure it nor finish installing it.

Any help would be great!

scm
Posts: 12
Joined: Thu Sep 13, 2012 8:48 pm

Re: Compiling GCC on Raspberry Pi

Fri Sep 14, 2012 7:19 am

Is there a reason you want to build gcc on the Pi rather than on a Desktop Linux machine with a cross-compiler?

I admit, it would be a challenge, but given the Pi's low memory and slow CPU, it seems like a masochistic endeavor.

User avatar
RaTTuS
Posts: 10519
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Compiling GCC on Raspberry Pi

Fri Sep 14, 2012 7:57 am

maek sure you are in in 240 ram config , and have swap space
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
Hypnos
Posts: 3
Joined: Sat Sep 08, 2012 10:55 pm
Location: facebook/Gerwyn3

Re: Compiling GCC on Raspberry Pi

Fri Sep 14, 2012 10:29 pm

The reason is I have loads of c code some using open gl and id like to convert them to work on linux pi,
rather than completely re-writing the code the code as c is quite stable as i use most of my own functions and structures for the body of the work, maybe there is a way to transfer c text files to the pi via telnet or fttp but I am not a network programmer but specialize in graphics. Any more advice would be a great help.

mupi
Posts: 8
Joined: Sat Sep 15, 2012 9:43 pm

Re: Compiling GCC on Raspberry Pi

Sun Sep 16, 2012 11:05 am

Why not

Code: Select all

pacman -S gcc
in arch?

Edit: In case it isn't clear, I'm suggesting you use Arch :)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5380
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Compiling GCC on Raspberry Pi

Sun Sep 16, 2012 11:34 am

Hypnos wrote:The reason is I have loads of c code some using open gl and id like to convert them to work on linux pi,
rather than completely re-writing the code the code as c is quite stable as i use most of my own functions and structures for the body of the work, maybe there is a way to transfer c text files to the pi via telnet or fttp but I am not a network programmer but specialize in graphics. Any more advice would be a great help.
The Wheezy distribution has gcc installed as standard. No need to build it yourself. Type in:
gcc hello.c

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Compiling GCC on Raspberry Pi

Sun Sep 16, 2012 6:06 pm

Hypnos wrote:The reason is I have loads of c code some using open gl and id like to convert them to work on linux pi,
rather than completely re-writing the code the code as c is quite stable as i use most of my own functions and structures for the body of the work, maybe there is a way to transfer c text files to the pi via telnet or fttp but I am not a network programmer but specialize in graphics. Any more advice would be a great help.
Hi,

If the ssh daemon is setup to run, then

apt-get rsync

is probably a good idea. Then you can

rsync -av somedir/ pi@someaddress:~/somedir/

and copy your source files over. C code should compile as expected without the need to recompile gcc.

Regards,

Will

User avatar
pbinks
Posts: 2
Joined: Thu Sep 13, 2012 7:16 pm

Re: Compiling GCC on Raspberry Pi

Mon Sep 17, 2012 12:11 pm

Good idea about putting rsync on. Command should be:

Code: Select all

apt-get install rsync

Return to “Advanced users”