gpt4 book ai didi

c++ - 如何使用交叉链接器而不是 native 链接器

转载 作者:太空宇宙 更新时间:2023-11-04 04:32:16 25 4
gpt4 key购买 nike

我正在尝试使用 OpenWRT 提供的工具链为 MIPS 架构交叉编译一个包。我在制作过程中遇到以下错误:

/usr/bin/ld: skipping incompatible /home/user/package/zlib/zlib-1.2.8/libz.so when searching for -lz

在这种情况下,zlib 已经针对 MIPS 进行了交叉编译,但 make 使用的是“/usr/bin/ld”而不是“mipsel-openwrt-linux-ld”。我试过 ./configure 与 --with-ld 选项,但它说 '--with-ld' 是未知选项。

最佳答案

您是否检查了以下页面,https://wiki.openwrt.org/doc/devel/crosscompile

Pass the host and build to the build system of the package to trigger cross-compile

For GNU configure, use --build=architecture-unkown-linux-gnu --host=architecture-openwrt-linux-uclibc (for example: ./configure --build=x86_64-unkown-linux-gnu –host=mips-openwrt-linux-uclibc)

Run ./config.guess to get the --build= option.

Check the output and ensure that 'checking whether we are cross compiling… yes' is yes.

For GNU make, override the CC and LD environment variables (usually not needed if GNU configure was used)

make CC=architecture-openwrt-linux-uclibc-gcc LD=architecture-openwrt-linux-uclibc-ld

关于c++ - 如何使用交叉链接器而不是 native 链接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34605717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com