【问题标题】:Compiling x32 bit LD_PRELOAD on 64 bit Ubuntu在 64 位 Ubuntu 上编译 x32 位 LD_PRELOAD
【发布时间】:2012-06-12 20:45:18
【问题描述】:

我正在尝试在 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

我该如何解决这个问题? 谢谢!

【问题讨论】:

  • 您可能缺少一些 multilib 包,或者您的 32 位标准 C++ 库不在 lib 路径中。

标签: c++ compilation 64-bit ld-preload


【解决方案1】:

您需要安装您的发行版提供的 32 位开发包。您看到此错误是因为您没有要链接的 32 位 libstdc++。

尝试安装 Ubuntu 的 g++-multilib 包。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-22
    • 2015-01-20
    • 1970-01-01
    • 2013-10-20
    • 1970-01-01
    • 2023-03-20
    相关资源
    最近更新 更多