brandonduda
Posts: 10
Joined: Fri Nov 25, 2011 8:38 am

Re: Compiling Guide?

Sat May 05, 2012 7:14 pm

With me awaiting my turn in the que, I've found (and obtained) some programs along with their source code that I wish to hopefully use with the Pi.  I HAVE compiled programs for x86 linux before, but that was at least 3-4 years ago.

Is there a guide on how to compile for ARM linux?  Or would it be similar to compiling x86 linux apps just as long as it is compiled while on the Pi?

I did do some searching, but came up empty handed.

Thanks in advance for any help.

(FYI, 2+2=5)

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Compiling Guide?

Sat May 05, 2012 8:08 pm

Compiling (packages not already supported by your package manager) on the pi should be simple as

./configure && make && sudo make install

Cross compiling (compiling off-pi) is probably going to be the fastest, but needs bit more setup, and then you need to package for your distro of choice.

brandonduda
Posts: 10
Joined: Fri Nov 25, 2011 8:38 am

Re: Compiling Guide?

Mon May 07, 2012 3:46 am

OK, so it is basically identical to regular compiling on an x86 linux machine as long as it is on the RasPi or set up to compile for RasPi via emulator, etc.

Thanks for the quick reply and clearing that up.

+1 Raspberries to you good sir!

mrbill
Posts: 31
Joined: Tue Jan 03, 2012 12:35 pm

Re: Compiling Guide?

Mon May 07, 2012 7:37 am

Do any additional I packages need to be installed to have a full dev environment on the current Ubuntu image? I see the standard gcc and libs are there - any extras needed?

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Compiling Guide?

Mon May 07, 2012 8:09 am

Assuming you"re talking about Ubuntu on some desktop machine, you will need a cross-development environment.  Your installed gcc/gdb/binutils and so on will be configured for your host platform, which is most likely i386 or x86_64.

What you need is a set of development tools which target the Pi.  They will be installed separately to your existing devtools, and named something along the lines of arm-linux-eabi-<program>(the stuff before the program name is given by the "triplet" of hardware platform, software platform and ABI – the stuff I"m using is arm-none-eabi as I"m developing "on the metal" – my cross-compiling gcc, for example, is arm-none-eabi-gcc).

Now, there"s a few ways you can get such a toolkit.  The easiest way is to use your package manager to install a cross development toolkit – this should deal with all the dependencies automagically.  I believe the package you require is called gcc-arm-linux-gnueabi

That will get you a cross development toolkit, to compile a "standard" autotools package using it you would do:

cd ./package_i_want_to_compile./configure –target arm-linux-gnueabi <other configuration options>make
If you then want to test on your x86 machine, you"re going to need qemu (be aware that qemu doesn"t fully emulate the Pi, but it can be used for a lot of testing anyway).  See the multitude of threads about qemu for  help on that.

Okay, the hell with this bloody editor.  The more you edit, the more it mangles your post.  The "code" block above is 3 separate lines, I'll leave you to work out where they start.

mrbill
Posts: 31
Joined: Tue Jan 03, 2012 12:35 pm

Re: Compiling Guide?

Mon May 07, 2012 8:46 am

That is useful thanks.

What if I want to compile on the pi? Any extras needed as far as packages outside the default on squeeze?

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Compiling Guide?

Mon May 07, 2012 9:36 am

Dunno what"s in the default package, but you should have all you need - standard platform gcc / gdb and so on should be there aiui

Return to “General discussion”