سؤال

I'm trying to cross-compile libSDL version 1.2 for a custom made, debian based Linux system. The toolchain I'm using is already configured properly so that I just run gcc/g++ on my the desired code and the resulting output is compatible with the target machine.

When I run ./configure --help in the libSDL source directory, I see that I can basically just set some environment variables to point to my cross-compiler.

However, I also see the following options:

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

I looked into the configure.in, build-scripts/config.sub, and build-scripts/config.guess files but couldn't really figure out how it works.

Are these options required? If not, is it a good idea to use them?

هل كانت مفيدة؟

المحلول

With autotools, --build is what you are building on and --host is what you want it to run on (there's also --target, but that's only important if what you're compiling is itself a compiler). Autotools will generally figure out --build on their own, so don't specify it if you don't have to (but look in /usr/lib/gcc to see what your compiler probably thinks --build should be)

So, eg, if you're building for i686 on x86_64, do

./configure --host=i686-linux-gnu 

(And use the -m32 options in CFLAGS, etc., but it sounds like you already have that ready.)

Whereas if you're building for x86_64 on i686, do

./configure --host=x86_64-linux-gnu

(You can build for all kinds of crazy hosts: rs6000-ibm-aix, sparc-sun-solaris, mips-idt-ecoff, etc..., assuming you have the appropriate gcc cross-compilers installed...)

GNU's page on it is here:

http://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top