c++ - 无法从源代码构建 GCC 10

标签 c++ gcc

在 Oracle Linux 上,我尝试通过以下内容构建 GCC 工具链:

  • 海湾合作委员会10.1.0
  • binutils 2.34
  • GDB 9.2.0

所有这些都是截至今天最新发布的来源。 我的配置如下:

../gcc10-toolchain/configure \
    --prefix=/opt/gcc10-toolchain \
    --with-diagnostics-color=auto \
    --with-system-zlib \
    --with-system-lzma \
    --enable-languages="c,c++,lto" \
    --enable-shared \
    --enable-static \
    --enable-gold=default \
    --enable-install-libbfd \
    --enable-plugins \
    --enable-default-pie \
    --enable-linker-build-id \
    --enable-threads=posix \
    --enable-checking=release \
    --enable-__cxa_atexit \
    --enable-initfini-array \
    --enable-gnu-indirect-function \
    --enable-tui \
    --enable-bootstrap \
    --disable-multilib \
    --disable-libgcj \
    --disable-nls \
    --disable-lto \
    --disable-libstdcxx-debug

但是,当使用 make 构建时,我收到以下错误:

../../gcc10-toolchain/gcc/lto-streamer-out.c: In function ‘void write_symbol_extension_info(tree)’: ../../gcc10-toolchain/gcc/lto-streamer-out.c:2790:10: error: ‘GCCST_VARIABLE’ was not declared in this scope
        ? GCCST_VARIABLE : GCCST_FUNCTION);
          ^ ../../gcc10-toolchain/gcc/lto-streamer-out.c:2790:27: error: ‘GCCST_FUNCTION’ was not declared in this scope
        ? GCCST_VARIABLE : GCCST_FUNCTION);
                           ^ ../../gcc10-toolchain/gcc/lto-streamer-out.c:2797:18: error: ‘GCCSSK_BSS’ was not declared in this scope   section_kind |= GCCSSK_BSS;

不幸的是,我在网上找不到任何相关内容,并且不知道从哪里开始寻找。

最佳答案

问题在于我将源代码复制在一起的顺序。 binutils-2.34 比 gcc-10.1.0 旧,因此 gcc-10.1.0 应该被复制到最后,这样它就会覆盖与 binutils 共享的文件,而不是相反。

关于c++ - 无法从源代码构建 GCC 10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62281987/

相关文章:

c - GCC#define 语句字节顺序错误

c - 简单的C语言解析器不编译linux机器

c++ - 我是否误解了这个默认参数 shared_ptr 的范围?

c++ - 什么是形式参数?

c++ - 如何为 a[x][y] 形式创建重载运算符?

c++ - 在不使用对象的情况下调用类方法?

c++ - 一种为 c 执行 c++ "typedef struct foo foo;"的方法

c++ - GLUT_ICON 不适用于左上角窗口

c++ - 编译我的 flex 和 bison 代码时,G++ 无法识别我的 C++ 类

C++ 静态初始化 vs __attribute__((constructor))