string_view: No such file or directory
std::string_view
is not available in GCC until version 7.
root@ubuntu:~/c++# gcc --version gcc (Ubuntu/Linaro 5.5.0-12ubuntu1) 5.5.0 20171010 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. root@ubuntu:~/c++#
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
root@cloud:~/gcc-7.5.0# ./contrib/download_prerequisites 2021-07-02 15:02:50 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1] 2021-07-02 15:02:59 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1] 2021-07-02 15:03:05 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1] 2021-07-02 15:03:15 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [1626446] -> "./isl-0.16.1.tar.bz2" [1] gmp-6.1.0.tar.bz2: OK mpfr-3.1.4.tar.bz2: OK mpc-1.0.3.tar.gz: OK isl-0.16.1.tar.bz2: OK All prerequisites downloaded successfully. root@cloud:~/gcc-7.5.0#
root@cloud:~/gcc-7.5.0# mkdir gcc-build-7.5 root@cloud:~/gcc-7.5.0# cd gcc-build-7.5/ root@cloud:~/gcc-7.5.0/gcc-build-7.5# ../configure --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --disable-multilib
root@cloud:~/gcc-7.5.0# ./contrib/download_prerequisites 2021-07-02 15:02:50 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1] 2021-07-02 15:02:59 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1] 2021-07-02 15:03:05 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1] 2021-07-02 15:03:15 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [1626446] -> "./isl-0.16.1.tar.bz2" [1] gmp-6.1.0.tar.bz2: OK mpfr-3.1.4.tar.bz2: OK mpc-1.0.3.tar.gz: OK isl-0.16.1.tar.bz2: OK All prerequisites downloaded successfully. root@cloud:~/gcc-7.5.0# cd - /root/gcc-7.5.0/gcc-build-7.5 root@cloud:~/gcc-7.5.0/gcc-build-7.5# ../configure --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --disable-multilib checking build system type... aarch64-unknown-linux-gnu checking host system type... aarch64-unknown-linux-gnu checking target system type... aarch64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether ln works... yes checking whether ln -s works... yes checking for a sed that does not truncate output... /bin/sed checking for gawk... gawk checking for libatomic support... yes checking for libcilkrts support... no checking for libitm support... yes checking for libsanitizer support... yes checking for libvtv support... yes checking for libmpx support... no checking for libhsail-rt support... no
checking if mkdir takes one argument... no This target does not support --with-tune. Valid --with options are: abi cpu arch Makefile:4282: recipe for target 'configure-stage1-gcc' failed make[2]: *** [configure-stage1-gcc] Error 1 make[2]: Leaving directory '/root/gcc-7.5.0/gcc-build-7.5' Makefile:25895: recipe for target 'stage1-bubble' failed make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory '/root/gcc-7.5.0/gcc-build-7.5' Makefile:939: recipe for target 'all' failed make: *** [all] Error 2 root@cloud:~/gcc-7.5.0/gcc-build-7.5#
configure的最后一个参数是关闭32位库,只编译64位库, 。如果想要同时编译32位和64位,可以使用-enable-multilib
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib