是否可以在 gcc >= 8 的 CentOS 7 上编译 32 位目标?



我有一个应用程序,需要在我的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/opt/rh/devToolset-8/root/usr/lib/gcc/i686-redhat-linux目录。我尝试了几件事,但似乎没有任何作用。

我开始怀疑我要做什么是否可能是可能的。

michał

不幸的是,我发现没有包含gcc std库的32位版本的gcc> 8的软件包。

我需要我的docker映像,但不能这样做,我切换到ubuntu i386 16.04,它可以轻松安装GCC 8.2。

最新更新