很多代码都有 configure文件,需要执行一下 configure 才能产生Makefile。
如果要对这样的代码进行交叉编译,需要做一些设置。
首先,把交叉工具链的位置加入到 PATH里,
然后执行 ./configure --host=cross-compile-prefix
就可以了。
比如,我现在用的 arm gcc名称为arm-linux-gnueabi-gcc, 前缀为 arm-linux-gnueabi
所以在我编一个代码的时候,执行configure的结果如下:
$ ./configure --host=arm-linux-gnueabi
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabi
checking target system type... arm-unknown-linux-gnueabi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-gnueabi-strip... arm-linux-gnueabi-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether #! works in shell scripts... yes
checking for style of include used by make... GNU
checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabi-gcc accepts -g... yes
checking for arm-linux-gnueabi-gcc option to accept ISO C89... none needed
checking dependency style of arm-linux-gnueabi-gcc... gcc3
checking how to run the C preprocessor... arm-linux-gnueabi-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for Minix Amsterdam compiler... no
checking for arm-linux-gnueabi-ar... arm-linux-gnueabi-ar
checking for arm-linux-gnueabi-ranlib... arm-linux-gnueabi-ranlib
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes