I informed about cross-compiling and found many information on how to create one, but very little information on how to use it.

I would like to compile the tool bluez-utils-3.36 from this site with my own compiler. I found the cross compiler (arm-linux-gcc-4.4.3.tgz) on this site. My gcc version is 4.4.3, so i assume that this is the right one.

Host machine (machine where i build the code)

Processor: Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz
OS Version: Linux 2.6.32-44 generic

Target machine: (the target on which the compiled file should run)

Processor: ARM926EJ-S rev 5 (v5l)
OS Version: Linux

How can i use this new compiler to compile bluez-utils-3.36?

3 Answers 3


There is a GNU standard naming scheme for compilers and other parts of the toolchain:

<target triplet>-<tool name>

The target triplet is of the form


And the tool name is gcc for the compiler, or another tool name like ld or strip or ar, etc...

The default compiler, the one that compiles native binaries (is not a cross compiler) is just called as gcc without the triplet.

The triplet of the compiler that is inside the file you mentioned in your question is arm-none-linux-gnueabi (looks like a quadruplet, I know, but that's what it is). So to use it, just call arm-none-linux-gnueabi-gcc instead of plain gcc.

If you are building something which uses a Makefile, you can often get that Makefile to use the compiler you want by running CC=arm-none-linux-gnueabi-gcc make instead of plain make. If you are building something which uses a GNU configure script, you can specify the target triplet for that too.

  • Does not work. I tried to compile a simple hello world program. With gcc main.c -o main it works fine. But if i try arm-none-linux-gnueabi-gcc main.c -o main then i get the error message arm-none-linux-gnueabi-gcc: command not found.
    – Black
    Aug 25, 2015 at 13:01
  • Solved: You have to add the path to your cross compiler to the PATH variable e.g. export PATH=~/opt/FriendlyARM/toolschain/4.4.3/bin:$PATH
    – Black
    Aug 25, 2015 at 13:06
  • The building of a Makefile did also worked with CC=arm-none-linux-gnueabi-gcc make, but it is not creating the necessary files anymore :(
    – Black
    Aug 25, 2015 at 13:31
  • I noticed this error in the build log: /usr/lib/libgmodule-2.0.so: could not read symbols: File in wrong format
    – Black
    Aug 26, 2015 at 6:29
  • 1
    "File in wrong format" sounds like either (1) you previously built for the native platform and now that file is interfering with the cross build for the other platform. Best to "make clean" after changing platforms. Or (2) the Makefile is incorrectly building some targets for the native platform and others for the cross platform. Even though you specified an alternate compiler maybe a native platform compiler is hardcoded somewhere in the Makefile. For that, you're have to find what needs updating in the Makefile and improve it.
    – Celada
    Aug 28, 2015 at 12:07

More than a cross-compiler, what you need is a toolchain, since there are more steps involving the process of getting an executable out of source code. These steps are

  1. Compile (source code to assembler)
  2. Assemble (assembler code to machine code)
  3. Link (routines and libraries in machine code linked together)

The naming standard in GNU toolchains is <target>-<tool>, for example arm-oe-linux-gnueabi-gcc would be the compiler for an ARM architecture, Open Embedded Linux variant, while arm-oe-linux-gnueabi-as is the assembler of the same toolchain, and so on.

However, that is not all that you need to get from source code in the host to executable for the target machine, you need also the headers and libraries from the target machine in your host machine for the linker. That's why you had that build error "could not read symbols. File in wrong format". Of course, once you have the headers and sysroot and everything copied into your host machine, you need to set the corresponding variables for the cross-compiler to find the right ones, and not the original from your host machine.

Generally speaking, source packages contain a Makefile prepared to accept a specific compiler. Seeing from previous comments, I gathered that you solved that much using the CC= variable. As soon as you have all set, just change the CC for your Makefile and call make.

So, long story short, you need to build your own toolchain for your target machine in your host machine or get an already built one.

Good luck and have fun!

  • Thanks for your answer. I already have a toolchain arm-linux-gcc-4.4.3.tgz like i wrote on the first post. I am confused because of targetand host. If i am right, then host is the actual target, on which the application should run, and target is the machine on which i build the application?
    – Black
    Aug 26, 2015 at 14:35
  • 1
    My wording "toolchain" rather than "compiler" was to make a point: you need more than a cross-compiler ;) Wrong: Host is where you make all compilation processes, target is where you run the results. BUT the host needs the libraries and headers of the target to provide them to the toolchain in order to produce finished, executable binaries for the target. Aug 27, 2015 at 6:44
  • Ah ok thank you, some other stack overflow user confused me by writing that host is the system on which the generated program will run. I give you +1 because of your effort
    – Black
    Aug 27, 2015 at 9:05

The host is the machine that you are cross compiling on. Your development machine.
The target is the ARM926EJ-S machine.
A couple of things to watch out for:
ARM926EJ-S is an ARMv5 make sure your cross tool chain compiles for the correct version of arm processor.
The install directory called for in the make file:
INSTALL = /usr/bin/install -c
I think this will install onto your host (development) machine, not what you want.
If you are cross compiling this for a embedded device, you will need to create a 'workingInstall' directory to install bluez into. Then add this to your embedded file system. (nand, sd card).

  • Thank you for your answer. As you can read on the following website: --host: In which system the generated program will run. so if this info is correct, then it means, host is the machine on where i compile my applications? stackoverflow.com/questions/27188116/…
    – Black
    Aug 27, 2015 at 6:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .