1

当我尝试在 OpenBSD 6.3 上构建 gcc 8.2.0 时出现以下错误:

/bin/sh ./libtool --tag=CC   --mode=compile /home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/xgcc -B/home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/bin/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/lib/ -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/include -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/sys-include    -DHAVE_CONFIG_H -I../.././libatomic/config/x86 -I../.././libatomic/config/posix -I../.././libatomic -I.    -march=i486 -mtune=i386 -fomit-frame-pointer -Wall -Werror   -pthread -g -O2 -MT fence.lo -MD -MP -MF .deps/fence.Tpo -c -o fence.lo ../.././libatomic/fence.c
libtool: compile:  /home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/xgcc -B/home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/bin/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/lib/ -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/include -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/sys-include -DHAVE_CONFIG_H -I../.././libatomic/config/x86 -I../.././libatomic/config/posix -I../.././libatomic -I. -march=i486 -mtune=i386 -fomit-frame-pointer -Wall -Werror -pthread -g -O2 -MT fence.lo -MD -MP -MF .deps/fence.Tpo -c ../.././libatomic/fence.c  -fPIC -DPIC -o .libs/fence.o
../.././libatomic/fence.c:26:10: fatal error: stdatomic.h: No such file or directory
 #include <stdatomic.h>
      ^~~~~~~~~~~~~
compilation terminated.
gmake[4]: *** [Makefile:491: fence.lo] Error 1
gmake[4]: Leaving directory '/home/shane/gcc-8.2.0/i386-unknown-openbsd6.3/libatomic'
gmake[3]: *** [Makefile:524: all-recursive] Error 1
gmake[3]: Leaving directory '/home/shane/gcc-8.2.0/i386-unknown openbsd6.3/libatomic'
gmake[2]: *** [Makefile:360: all] Error 2
gmake[2]: Leaving directory '/home/shane/gcc-8.2.0/i386-unknown-openbsd6.3/libatomic'
gmake[1]: *** [Makefile:21680: all-target-libatomic] Error 2
gmake[1]: Leaving directory '/home/shane/gcc-8.2.0'
gmake: *** [Makefile:943: all] Error 2

我的过程:

  • 安装 OpenBSD(使用默认值)
  • 运行系统补丁
  • 添加一些包:

    # pkg_add wget
    # pkg_add gmp mpfr libmpc
    # pkg_add gmake
    
  • 获取源码:

    $ wget ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz
    $ tar xzf gcc-8.2.0.tar.gz
    $ cd gcc-8.2.0
    
  • 建造:

    $ ./configure --prefix=/opt/gcc-8.2.0 --with-gmp=/usr/local --enable-languages=c,c++
    $ gmake
    

这也以类似的方式在 gcc 8.1.0 中失败。

我还尝试使用 clang 而不是 gcc 来构建,如下所示:

$ CC=cc CXX=c++ ./configure --prefix=/opt/gcc-8.2.0 --with-gmp=/usr/local --enable-languages=c,c++

这没有什么区别,这很有意义,因为它显然在第 3 阶段失败了(gcc 再次编译自身以进行最终检查)。

烦人的是,压缩包中有一个文件stdatomic.h

$ find gcc-8.2.0 -name stdatomic.h                             
gcc-8.2.0/gcc/ginclude/stdatomic.h

所以我不知道我错过了什么。

有没有人成功建造过这个?如何?

4

0 回答 0