Cross compilation: Difference between revisions

From flashrom
Jump to navigation Jump to search
(Initial frustration writeup.)
 
m (random notes)
Line 10: Line 10:
* openSUSE has a repository with extra cross compilers in Torsten Duwe's home project at the Open Build Service.
* openSUSE has a repository with extra cross compilers in Torsten Duwe's home project at the Open Build Service.
* Cross compilers and binutils are going to end up in /opt/cross/ .
* Cross compilers and binutils are going to end up in /opt/cross/ .
== Notes ==
Random stuff which was written down during compilation...
Libraries have been installed in:
  /opt/cross/x86_64-pc-freebsd9/lib64
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  - use the `-Wl,-rpath -Wl,LIBDIR' linker flag

Revision as of 22:10, 6 May 2013

Cross building on Linux for non-Windows/non-DOS operating systems is what can generally be described as a nightmare. Prepackaged cross compilers are not available, and various websites on the net explain how to build toolchains for either totally obsolete operating system releases or the solutions simply don't work. Having a recent native gcc on the host makes things a lot worse because older gcc versions and their support libraries can't be compiled with recent gcc. If in doubt, gcc documentation should not be followed unless you want to experience failure firsthand.

This page is an attempt to list what worked, what didn't work and where instructions are just crap.

First things first:

  • Get everything in a clean state. If you have any previous unfinished/non-working/working cross compiler, binutils, include files or libraries for a given target, use rm -rf liberally and start from scratch.
  • If you can download a prepackaged cross compiler for DOS (DJGPP) or Windows (cross MinGW), use it! I'm not going to cover this if I can help it.
  • If you can download a prepackaged cross compiler for non-x86 Linux, use it!
  • These instructions are for a host running an x86_64 installation of openSUSE Linux 12.2, but they should work on other distributions.
  • openSUSE has a repository with extra cross compilers in Torsten Duwe's home project at the Open Build Service.
  • Cross compilers and binutils are going to end up in /opt/cross/ .


Notes

Random stuff which was written down during compilation...

Libraries have been installed in:

  /opt/cross/x86_64-pc-freebsd9/lib64

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  - use the `-Wl,-rpath -Wl,LIBDIR' linker flag