【问题标题】:Is it possible to compile 32bit target on CentOS 7 with gcc >= 8?是否可以使用 gcc >= 8 在 CentOS 7 上编译 32 位目标?
【发布时间】: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 目录。我尝试了几件事,但似乎没有任何效果。

我开始怀疑我正在尝试做的事情是否可能。

米哈乌

【问题讨论】:

    标签: gcc centos 32-bit


    【解决方案1】:

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

    我的 docker 映像需要这个,但由于无法做到这一点,我切换到 ubuntu i386 16.04,它可以非常轻松地安装 gcc 8.2。

    【讨论】:

      猜你喜欢
      • 2011-01-22
      • 2021-11-03
      • 2018-09-13
      • 1970-01-01
      • 2022-07-09
      • 1970-01-01
      • 1970-01-01
      • 2016-05-03
      • 2015-01-21
      相关资源
      最近更新 更多