我正在尝试为缺少 glibc 而使用 uclibc 的 x86 机器交叉编译Dropbear 。为此,我使用自定义 crosstool-ng 工具链为同一指令集交叉编译了 zlib,并将其安装到自定义位置。
msainz@ubuntu:~$ ls Projects/zlib_install/lib
libz.a libz.so libz.so.1 libz.so.1.2.11 pkgconfig
我已经复制Projects/zlib_install/include/zlib.h
和Projects/zlib/include/zconf.h
到Projects/dropbear/zlibincludes/
.
我以这种方式设置了我的环境变量:
msainz@ubuntu:~$ echo $PATH
usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
/usr/local/games:/snap/bin:/home/msainz/x-tools/x86_64-multilib-linux-uclibc/bin
msainz@ubuntu:~/Projects/dropbear$ echo $LDFLAGS
/home/msainz/Projects/zlib_install/lib/libz.a
msainz@ubuntu:~/Projects/dropbear$ echo $CFLAGS
-Izlibincludes -I../zlibincludes
我以这种方式启动配置脚本:./configure --prefix=/home/msainz/Projects/tmp_top_dir --host=x86
执行终止并出现以下错误:
configure:4851: x86_64-multilib-linux-uclibc-gcc -o conftest -Izlibincludes -I../zlibincludes -Wno-
pointer-sign -fno-strict-overflow -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -mfunction-
return=thunk -mindirect-branch=thunk /home/msainz/Projects/zlib_install/lib/libz.a -pie -Wl,-z,now -
Wl,-z,relro conftest.c -lz >&5
/home/msainz/x-tools/x86_64-multilib-linux-uclibc/bin/../lib/gcc/x86_64-multilib-linux-
uclibc/8.3.0/../../../../x86_64-multilib-linux-uclibc/bin/ld.bfd: cannot find -lz
collect2: error: ld returned 1 exit status
有什么想法可以解决这个问题吗?提前致谢。