Personal tools
You are here: Home / cm / Wiki / Cross compilers
Navigation
Log in


Forgot your password?
 

Cross compilers

We have setup cross compiles from Linux for win32 using mingw so that you can build executables that run on windows and for old linux (glibc2.1.3) so that exectuables will run on older machines.

To build an executable using a cross compile you just need to ensure the particular compilers and linkers come first in your path. To make this easy I have set up a couple of scripts.

So for win32 run:

$(CMISS_ROOT)/bin/i686-linux/i386-mingw32msvc-cross-make instead of make

or:

$(CMISS_ROOT)/bin/i686-linux/i386-mingw32msvc-cross-configure instead of configure

For glibc2.3 run:

$(CMISS_ROOT)/bin/i686-linux/i386-glibc23-linux-cross-make instead of make

or:

$(CMISS_ROOT)/bin/i686-linux/i386-glibc23-linux-cross-configure instead of configure

Executables built using the glibc 2.3 cross compile environment will work on all Linux machines, by default using the system provided run-time libraries. Sometimes, however, it is useful to be able to test the program using the old glibc and associated libraries. To test your glibc executable is built correctly is a little tricky as you probably cannot use the libc from the cross compile as it probably will have version problems with your /lib/ld-linux.so. If you set your LD_LIBRARY_PATH to the cross-compiled lib directory then even /bin/sh and so on probably will have problems. Instead you can run the ld-linux.so directly:

$(CMISS_ROOT)/cross-compile/i386-glibc23-linux/lib/ld-linux.so.2 --library-path $(CMISS_ROOT)/cross-compile/i386-glibc23-linux/lib   $(CMISS_ROOT)/cm/bin/i686-linux/cm-debug

or to simulate the output of ldd in a csh like shell:

( setenv LD_TRACE_LOADED_OBJECTS 1 ; $(CMISS_ROOT)/cross-compile/i386-glibc23-linux/lib/ld-linux.so.2 --library-path $(CMISS_ROOT)/cross-compile/i386-glibc23-linux/lib $(CMISS_ROOT)/cm/bin/i686-linux/cm-debug )