Arm Compiling Howto


trix

Very Active Member
Joined
Jan 11, 2010
Messages
436
Hi, it's everyone's favourite cereal here. And if not, it should be.

With all of the "is it going to ship!?!?11?1" posts we need something new to talk about until official word is released. On that note, I have an important request!

I am not a very good programmer. In fact, I suck pretty badly. But I can scanf my way around a .c okay, and I was hoping for some tutorial or walk-through or something useful to help me when trying to compile open source x86 linux stuff to ARM. Personally I know the basics, changing makefile and stuff, but I was hoping if anyone has the time and patience for a complete Dummies guide to ARM compiling, what to look for, what patches may be needed. SOMETHING to help more people bring more software to Pandora.

Any takers?
 
I've been looking for a SIMPLIFIED guide for a long time as well!
SVN will help you download all the source files for most open source apps, then modify the makefile and that all all I really know.

I'm on a mac, and it's just difficult. I've been trying to port the Arduino IDE for a while now.. But can't - So I've lost interest. Someone want to help??

Apparently "Build for Target" ON the TARGET seems to be the easiest way.

Compile directly ON the Pandora - When we get one....

THIS might help.... YAGARTO - ARM Toolchain simple installer.
 
I suppose I can start with what I know, as a sort of background to help anyone get started.

ARM is not x86. Programs made for x86 (IBM compatible desktop PCs) will not work as-is on Pandora. To make them work, you will need the complete source code for the program, everything required for a successful compile, then you will need to change environment settings and make file to tell it to compile for the ARM instruction set. Also (and here's where I am fuzzy) sometimes certain patches or source changes need to be made for a successful ARM compile.

What I am looking for, is specifically the common types of changes or patches that might be required. What to look for, edit, and change. Like: "If the application uses a windows API it must be converted to QT or something compatible" or "If the application uses any Assembly that part will need a total rewrite" etc. More detail the better.

Also, a HOWTO or Tutorial section of the Pandora forums might be nice, not just for this, but all kinds of HOWTO's, like "HOWTO: Use Bluetooth PS3 controllers with Pandora" or "HOWTO: test joypad and make it work (jstest, etc)" or "HOWTO: using ext4 on Angstrom" etc etc etc.

In fact, when that section is created, I might post a lot of Pandora-specific linux HOWTO's myself out of boredom. And by 'might' I mean 'probably will'.

Any help or feedback would be great!

- trix
 
If you want to compile stuff for the Pandora, just do it on the Pandora.

That's the simplest way. Download the source and compile it.

EDIT: 666th post
 
Butterman said:
If you want to compile stuff for the Pandora, just do it on the Pandora.

That's the simplest way. Download the source and compile it.

EDIT: 666th post

First, congrats on 666! Muahaha....

Second, yes, compiling ON the Pandora is probably simplest. But, I don't have one. So, I am looking for alternatives. Having more software available when these finally ship is a worthwhile endeavour, IMO.

- trix
 
Last edited by a moderator:
trix said:
I suppose I can start with what I know, as a sort of background to help anyone get started.

You might want to check out the crosstool package here: http://www.kegel.com/crosstool/

It looks like it takes a good chunk of the grunt work off your hands when preparing for cross compiling non-native architectures on X86 platforms.

You can also check out an article on the basics of cross compiling in this Linux Journal article :

http://www.linuxjournal.com/article/9904

Some other good stuff there on cross compiling in the links at the end of that article.

Hope this is what you're looking for!

Pete
 
Last edited by a moderator:
pascalpb said:
trix said:
I suppose I can start with what I know, as a sort of background to help anyone get started.

You might want to check out the crosstool package here: http://www.kegel.com/crosstool/

It looks like it takes a good chunk of the grunt work off your hands when preparing for cross compiling non-native architectures on X86 platforms.

You can also check out an article on the basics of cross compiling in this Linux Journal article :

http://www.linuxjournal.com/article/9904

Some other good stuff there on cross compiling in the links at the end of that article.

Hope this is what you're looking for!

Pete

Ahh yes, those two links together seems to be tremendous help! For me they solve a good bit of the problems, but not quite everything. The problem I have with those links is the following:

First: It makes no mention of what conditions would cause a cross-compile to fail, what patches or edits might be necessary to make it work, and what kinds of things cannot be successfully cross-compiled.

Second: As 'kingoddball' said, not everyone is trying to compile from Linux. Personally I am, but he uses Mac, and the GCC cross compiling tutorial you linked is somewhat linux specific. I know OSX is fairly unix-like, but I don't think it includes by default a linux repository containing basics like binutils.

Third: A Tutorial or HOWTO specifically for Pandora would be quite helpful too, especially for those that are intimidated by how general the links you posted are. Pandora-specific tutorials could cover a wider, and yet more in-depth, range of related subjects. Such as, touchscreen support, emulating a mouse using nubs, mapping to the special mini keyboard and/or gaming controls, etc etc etc.

Finally, I still wish to emphasise my request for a HOWTO forum section. Again not just for this, but all kinds of HOWTO's that could be immensely helpful once the Pandora ships. I'll even volunteer to moderate it for you if need be :)

- trix
 
Last edited by a moderator:
Wasn't there a codesourcery toolchain that could be dropped right into Code::Blocks?

Seems like that's the best solution for C.

Or you could just code in Python. ;)
 
Trix,
Even with Linux you don't have a "standard" way of doing things. Some distributions ship by default with everything you need to have to compile programs - ala Gentoo. Others, such as Ubuntu, don't, assuming the people using the distribution will be more users rather than developers. You have to install the development tools for some of them. I wouldn't get too in depth for retrieving the build tools for all the various OSes out there. Maybe something simple for one Linux distribution, Windows, and OSX.

Pickle, Java Jake and the guys developing Neuvo, and a few others would be good sources for specific questions. But, yes, it would be nice to see an "official" and specific set of generic instructions for setting up Linux, Windows with some sort of Unix shell, and Mac up to do cross compiling, and doing so without mucking up your current build environment so you can still build stuff for your specific distribution. Make it command line and fairly generic, leaving the IDE integration up to the users. For SMALL projects compiling on the Pandora's probably an option, but for larger projects, and just convenience's sake in many cases, doing so from your main desktop/laptop is going to be MUCH faster.

There've been stuff in the forums already covering this, but something on the main page would be nice.

Cheers!
 
wardred said:
Trix,
Even with Linux you don't have a "standard" way of doing things. Some distributions ship by default with everything you need to have to compile programs - ala Gentoo. Others, such as Ubuntu, don't, assuming the people using the distribution will be more users rather than developers. You have to install the development tools for some of them. I wouldn't get too in depth for retrieving the build tools for all the various OSes out there. Maybe something simple for one Linux distribution, Windows, and OSX.

Pickle, Java Jake and the guys developing Neuvo, and a few others would be good sources for specific questions. But, yes, it would be nice to see an "official" and specific set of generic instructions for setting up Linux, Windows with some sort of Unix shell, and Mac up to do cross compiling, and doing so without mucking up your current build environment so you can still build stuff for your specific distribution. Make it command line and fairly generic, leaving the IDE integration up to the users. For SMALL projects compiling on the Pandora's probably an option, but for larger projects, and just convenience's sake in many cases, doing so from your main desktop/laptop is going to be MUCH faster.

There've been stuff in the forums already covering this, but something on the main page would be nice.

Cheers!

I've been investigating how to compile stuff for a Nokia N900 and I seem to be lead down a path towards Scratchbox. Now, I _think_ this is a set of tools for cross-compilation and includes QEmu for testing purposes. Does anyone think this would be suitable for Pandora development?

Ignore me, if I'm way off here...
 
Last edited by a moderator:
Last year I built some test applications for Pandora using a Pandora SDK. It's been a year since I did that so I don't recall where I downloaded it from. But it was a standard cross-compiling environment which I installed on my Linux laptop. Easy enough to use, slightly different from the scratchbox setup preferred my Nokia for the Nxx0. I had no problems with that method and I think I'll be building my applications on my x86 computer in the future too, I see no point in building on the Pandora itself. Others may feel differently.
The SDK I tested hadn't been updated to build specifically for the newer processor we use in the Pandora (but that was fine for me because I could run the resulting application on my omap2-based N800), I assume there's an updated SDK out there somewhere.
 
trix said:
Personally I know the basics, changing makefile and stuff, but I was hoping if anyone has the time and patience for a complete Dummies guide to ARM compiling, what to look for, what patches may be needed.
First of all, PLEASE don't use plain Makefiles when you want to start a project that is going to be portable.
There are alternatives (in ascending order of awesomeness):
  • Use Makefiles, but declare some standard variables in the header of the Makefile that can be changed when you want to cross-compile. Your Makefile's header should in other words look like this:
    Code:
    CC            = gcc
    CXX           = g++
    DEFINES       = -DDEFINE_SOMETHING_IN_THE_SOURCE -DNO_FLOATS -DUSE_STDSTRING
    CFLAGS        = -m64 -pipe -O2 -Wall -W $(DEFINES)
    CXXFLAGS      = -m64 -pipe -O2 -Wall -W $(DEFINES)
    INCPATH       = -I/usr/include -I../pandora-libraries/pnd/include -I.
    LINK          = g++
    LFLAGS        = -m64 -Wl,-O1
    LIBS          = -L/usr/lib -lpthread 
    AR            = ar cqs
    RANLIB        = 
    TAR           = tar -cf
    COMPRESS      = gzip -9f
    COPY          = cp -f
    SED           = sed
    COPY_FILE     = $(COPY)
    COPY_DIR      = $(COPY) -r
    STRIP         = strip
    INSTALL_FILE  = install -m 644 -p
    INSTALL_DIR   = $(COPY_DIR)
    INSTALL_PROGRAM = install -m 755 -p
    DEL_FILE      = rm -f
    SYMLINK       = ln -f -s
    DEL_DIR       = rmdir
    MOVE          = mv -f
    CHK_DIR_EXISTS= test -d
    MKDIR         = mkdir -p
    This was just an example of course... You will use different values for the variables yourself. But I would recommend to keep all variables in there for consistency's sake.
  • Use GNU autotools (like automake etc). They allow you to write small setup files that automake and a standard configure script then use to generate Makefiles that work with the platform you're targeting. Simplifies cross-compiling a lot.
  • Use a cross-compiling build tool like qmake. It operates on different compiler specifications (one for each os-compiler-arch combination) which allows you to easily cross-compile to any platform.
    You simply create a "myproject.pro" file containing lines like "SOURCES += main.c thing.h thing.c", invoke the "qmake -spec linux-g++-gles2-experimental" program followed by "make", and you're done. Sample .pro file here.
  • Use a full-fledged build tool like CMake. You basically write a "CMakeLists.txt" file that contains lines like "add_executable(myprogram main.c thing.h thing.c)" and "find_package(BZip2)" that help you automate dependency handling and compiler-independence in your build files. You can then use cmake to generate a Makefile for you with all of the correct library paths and include paths that generates a build for your target. Alternatives to CMake include Jam, SCons, Buildr etc.
 
Last edited by a moderator:
Tor said:
Last year I built some test applications for Pandora using a Pandora SDK. It's been a year since I did that so I don't recall where I downloaded it from. But it was a standard cross-compiling environment which I installed on my Linux laptop. Easy enough to use, slightly different from the scratchbox setup preferred my Nokia for the Nxx0. I had no problems with that method and I think I'll be building my applications on my x86 computer in the future too, I see no point in building on the Pandora itself. Others may feel differently.
The SDK I tested hadn't been updated to build specifically for the newer processor we use in the Pandora (but that was fine for me because I could run the resulting application on my omap2-based N800), I assume there's an updated SDK out there somewhere.

There are a few cross-compiling packages out there. Most of them work well once you figure out their nuances, which can be non-trivial. Although I am biased to Gentoo, there are advantages to using Gentoo w/ crossdev to build binaries for other Linux OSes. Since Gentoo saves binaries as tarballs they can be dropped directly on top of your existing OS, the problem of course being you run the risk of messing up dependancies, but it will be easy to implement. Also, since a Gentoo stage3 is effectively a self-contained SDK you can unpack in any directory, chroot in, and build your packages without your host OS any-the-wiser. No extra binaries, libraries, etc necessary, just chroot and root access. Checkout http://neuvoo.org for some quick guides (Gentoo focused, but should be generic enough for others) in setting up a cross compile env and also some guides like Icecream (distcc-esk) and other utils. We idle in IRC Freenode#neuvoo also if you need any more help.
 
Last edited by a moderator:
I see no point in building on the Pandora itself. Others may feel differently.

I see no point in setting up a whole other computer if the Pandora is, itself, more than adequate to build anyones software .. with two Pandoras in the room, you could do a full system build in the idle moments ..
 
Compiling on device worst possible suggestion ever, puh-leeze. Almost spit beer at the word, 'moments', ROFL. There are huge rewards setting up another pc, here is the best place to get you started; http://wiki.openembedded.net/index.php/Main_Page
 
torpor said:
if the Pandora is, itself, more than adequate to build anyones software
*if*
My 2.4 ghz Quad Core (running 4 parallel compile processes) still takes more than just a few minutes to rebuild my kernel. I can't begin to think of how long it would take on the Pandora.
 
Last edited by a moderator:
WizardStan said:
My 2.4 ghz Quad Core (running 4 parallel compile processes) still takes more than just a few minutes to rebuild my kernel. I can't begin to think of how long it would take on the Pandora.
I'd guess it wouldnt take (atleast much) more time than building a kernel on a P2 (500Mhz or so...) w 256M of RAM... == it can do it if in dire need, but if machines of higher specs are around, use something else.
 
Last edited by a moderator:
WizardStan said:
torpor said:
if the Pandora is, itself, more than adequate to build anyones software
*if*
My 2.4 ghz Quad Core (running 4 parallel compile processes) still takes more than just a few minutes to rebuild my kernel. I can't begin to think of how long it would take on the Pandora.
It takes ~4 hours on my pxa270@400Mhz. Pandora should be 5-10 times faster, so I expect 25-50 minutes, which is quite acceptable.
 
Last edited by a moderator:
Wow, that must be why all the iphone developers do their compiling on a phone.

Well, if you want to keep up with the Joneses, be my guest. But the real reason they don't do any compiling on the phone is because they simply can't - the developer tools don't exist on the iPhone, they're only available (because Apple says so) in a form that promotes the purchase of *another* computer (XCode/Mac OSX).

Look, you may not like the idea of on-board compiling, but its a fact that this has been a normal way of developing software for years - cross-compiling, when necessary, is an option but it is *not* the only option and it is sometimes a lot more hassle to set up a cross-compiling environment, on other expensive hardware, than it should be. Me, personally .. I'll be perfectly content with having one of my Pandoras serve as a build farm for the others in the room, and thanks to the fact that I organize my projects properly I won't be waiting long between updates for it to spit out a usable binary .. I've already been using my Touchbook and Beagleboard to build their own software, on the machines themselves, and it works really, really well.. plus, no cross-compiling/compatibility/library-admin dilemna to work through, at all .. things just build and run.
 
Back
Top