Passing TARGET_ARCH=XYZ to make gives "No such file or directory"


#1

I am compiling a Juce project to be tested on several architectures, thus I want to provide the TARGET_ARCH=x86 or similar to make when running the build. However, this gives me the error

g++: error: x86: No such file or directory

My Makefile is used as spit out from the Introjucer when I save my project. so it is nothing fancy; it is "identical" to the HelloWorld example. The same error arises when compiling this example project; make works fine, while make TARGET_ARCH=x86 (or whatever I put in instead of x86) makes the build process fail with the above error. It does not complain if I use CONFIG=Release variable. The order of arguments does not matter - the error comes anyway.

What can be wrong here?

Note that I am far from being an expert on build processes and compilers, so I might have misunderstood something basic here.


#2

Hi Krøllebølle,

TARGET_ARCH is simply passed as additional parameters to the compiler, so you need to specify the full command-line parameters. For example:

make TARGET_ARCH="-march=core2 -mtune=core2 -msse"

will compile for Intel's Core 2 series of processors (the -msse is not necessary in this case but I just added it as an example). 

However, I doubt that you can cross-compile for a completely different architecture with this as "-march" only specifies the sub-architecure. You would need to use a completely different compiler for each architecure. You can do this by using the CXX variable to specify which compiler to use. For example, if you would like to cross-compile to an arm platform, you could use:

make CXX=arm-linux-gnueabi-g++

However, this assumes that you have gcc for arm installed on your computer. On ubuntu you can install this with :

sudo apt-get install g++-arm-linux-gnueabi

Does this help?

Fabian