【发布时间】:2019-08-12 04:45:30
【问题描述】:
我有一个应用程序需要在我的 64 位 CentOS 7 上编译为 32 位。我为此使用了 -m32 标志。我还需要 c++17 的功能,所以我想安装 gcc 8.x。我发现devtoolset 8 附带 gcc 8.2.1,这对我有好处。
应用程序编译正常,但问题在于链接 - 它找不到一些 32 位库:
[100%] Linking CXX executable cherrySim_runner
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: cannot find /usr/lib/libstdc++.so.6
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: skipping incompatible /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: cannot find -lstdc++_nonshared
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: cannot find /lib/libgcc_s.so.1
我发现 devtoolset 准备了一些 32 位库,但这些是指向不存在路径的链接,例如:/opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/32/libstdc++_nonshared.a -> ../../../i686-redhat-linux/8/libstdc++_nonshared.a。根本没有 /opt/rh/devtoolset-8/root/usr/lib/gcc/i686-redhat-linux 目录。我尝试了几件事,但似乎没有任何效果。
我开始怀疑我正在尝试做的事情是否可能。
米哈乌
【问题讨论】: