无法为 uclibc 交叉编译 dropbear

Unable to cross-compile dropbear for uclibc

我正在尝试为缺少 glibc 的 x86 机器交叉编译 Dropbear,而是使用 uclibc。为此,我使用自定义 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.hProjects/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

有什么解决办法吗?提前致谢。

解决了将 --with-zlib=/home/msainz/Projects/zlib_install/ 添加到 ./configure 调用的问题。