在 64 位 Ubuntu 上编译 x32 位LD_PRELOAD
Compiling x32 bit LD_PRELOAD on 64 bit Ubuntu
我正在尝试在x64平台(Ubuntu)上编译x32 LD_PRELOAD,我的命令:
g++ -fPIC -m32 -shared -Wl,-soname,test.so -ldl -o test.so test.cpp
但是我收到错误:
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
我该如何解决这个问题?谢谢!
您需要安装发行版提供的 32 位开发包。 您看到此错误是因为您没有要链接的 32 位 libstdc++。
尝试安装 Ubuntu 的 g++-multilib
软件包。
相关文章:
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- C++ 中的编译错误:未定义对"主"的引用 collect2:错误:ld 返回 1 个退出状态
- /usr/bin/ld: cannot find -lc++
- 解决"ld: library not found for -ltensorflow_framework.2.3.0"
- 编译 Boost 时在 OS X 上的"ld:未知选项:-soname"
- 使 ld 忽略来自 /etc/ld.so.conf 的目录
- 编译问题:在函数"_start"中:未定义对"主"的引用 collect2:错误:ld 返回 1 个退出状态
- 试图在崇高中奔跑. 错误 已发生: 收集2.exe: 错误: ld 返回 1 退出状态
- collect2:错误:ld 返回 1 个退出状态未定义的引用
- LD:尝试编译项目时找不到架构x86_64符号
- Linux ld 如何解释 -lSomething::AnotherSomething(如 /usr/bin/ld: 找
- LD 找不到生成的函数
- 几个 Nt 函数在 Windows 7 x32 上返回STATUS_WAIT_0
- C++ collect2:错误:ld 返回 1 退出状态
- OS X: ld: 找不到 -lstdc++ 的库
- Mac Snow Leopard 上的 Qt 5.3.2:ld:在架构x86_64 [clang、Objective-C
- 找不到 -llibmysqld Collect2.exe:错误:ld 返回 1 退出状态
- ld 链接器错误,未定义对主函数的引用
- 使用 Arduino 对 ATtiny10 进行编程 ( "ld.exe" 错误)
- 每次我要使用外部资源时,我都会得到:collect2。exe:错误 ld 返回 1 退出状态