为 ARM 交叉编译 zlib

Tho*_*van 3 gcc arm compiler-errors makefile zlib

我尝试为 arm-poky-linux-gnueabi 交叉编译 zlib,但在启动 make 时出现错误:

...:~/zlib-1.2.11$ AR=$HOST-ar CC=$HOST-gcc RANLIB=$HOST-ranlib ./configure --prefix=$HOME/zlibARM 
Checking for shared library support... 
Building shared library libz.so.1.2.11 with arm-poky-linux-gnueabi-gcc. 
Checking for size_t... Yes. 
Checking for off64_t... Yes. 
Checking for fseeko... Yes. 
Checking for strerror... Yes. 
Checking for unistd.h... Yes. 
Checking for stdarg.h... Yes. 
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf(). 
Checking for vsnprintf() in stdio.h... Yes. 
Checking for return value of vsnprintf()... Yes. 
Checking for attribute(visibility) support... Yes.

...:~/zlib-1.2.11$ make
arm-poky-linux-gnueabi-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
make: execvp: arm-poky-linux-gnueabi-gcc : Trop de niveaux de liens symboliques
Makefile:147: recipe for target 'example.o' failed
make: *** [example.o] Error 127
Run Code Online (Sandbox Code Playgroud)

你能帮助我吗 ?

bou*_*erp 8

我知道这篇文章已经有 7 个月了,但是我能够使用以下配置命令成功地为 ARM(在 MacOS 上)交叉编译 zlib:

CHOST=arm \
CC=<PATH_TO_CROSS_GCC> \
AR=<PATH_TO_CROSS_AR> \
RANLIB=<PATH_TO_CROSS_RANLIB> \
./configure \
--prefix=<INSTALL_PATH>
Run Code Online (Sandbox Code Playgroud)

在哪里PATH_TO_CROSS_GCCPATH_TO_CROSS_ARPATH_TO_CROSS_GCC指向交叉编译工具(在我的例子中,我使用 crosstool-NG)。

最终使它对我CHOST=arm有用的是指定了,这导致它实际使用指定的ar.

希望这可以帮助某人下线。