[开发|C++] 在deepin V20 上编译gcc6.5.0

参考文献

Ubuntu18.04编译安装gcc6.3

编译环境说明

系统: deepin V20.6
平台: x86_64
gcc编译器版本:gcc version 8.3.0 (Uos 8.3.0.3-3+rebuild)

源代码获取

wget http://mirror.hust.edu.cn/gnu/gcc/gcc-6.5.0/gcc-6.5.0.tar.gz

编译依赖安装

sudo apt update
sudo apt dist-upgrade
sudo apt install libmpc-dev libgmp-dev libmpfr-dev gcc-multilib g++-multilib libisl-0.18-dev texi2html

编译

tar -xf gcc-6.5.0.tar.gz
cd  gcc-6.5.0
mkdir build
cd build
../configure --prefix=/opt/App/gcc-6.5.0
make -j4
make install 

其他编译

编译 gcc-6.3.0

编译
tar -xf gcc-6.3.0.tar.gz
cd  gcc-6.3.0
mkdir build
cd build
../configure --enable-languages=c,c++ --prefix=/opt/App/gcc-6.3.0 --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --without-included-gettext --enable-threads=posix --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
make -j4
make install 
编译过程报错汇总

见Ubuntu16.04下安装gcc5.4.0过程及报错汇总

  1. 报错信息如下
./md-unwind-support.h: In function ‘x86_64_fallback_frame_state’:
./md-unwind-support.h:65:47: error: dereferencing pointer to incomplete type ‘struct ucontext’
       sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;

处理 修改文件 md-unwind-support.h 第61行

struct ucontext *uc_ = context->cfa;
修改为
struct ucontext_t *uc_ = context->cfa;
  1. 报错信息如下
./include/java-signal.h:32:26: error: invalid use of incomplete type ‘struct _Jv_catch_fpe(int, siginfo_t*, void*)::ucontext’
   gregset_t &_gregs = _uc->uc_mcontext.gregs;    

处理 修改文件 java-signal.h 第31行

struct ucontext *_uc = (struct ucontext *)_p;;
修改为
struct ucontext_t *_uc = (struct ucontext_t *)_p;
  1. 报错信息如下
../../../../libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:270:22: error: aggregate ‘sigaltstack handler_stack’ has incomplete type and cannot be defined
   struct sigaltstack handler_stack;

处理见Ubuntu18.04编译安装gcc6.3

  1. 报错信息如下
../../../../libsanitizer/tsan/tsan_platform_linux.cc: In function ‘int __tsan::ExtractResolvFDs(void*, int*, int)’:
../../../../libsanitizer/tsan/tsan_platform_linux.cc:294:16: error: ‘statp’ was not declared in this scope
   __res_state *statp = (__res_state*)state;
                ^~~~~
../../../../libsanitizer/tsan/tsan_platform_linux.cc:294:37: error: expected primary-expression before ‘)’ token
   __res_state *statp = (__res_state*)state;

处理见 Ubuntu18.04编译安装gcc6.3

  1. 报错信息如下
../../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:158:23: fatal error: sys/ustat.h: 没有那个文件或目录
 #include 

处理见 Linux下gcc编译报错:fatal error: sys/ustat.h: No such file or directory 解决办法

你可能感兴趣的:(开发,C++/C,编译器源代码,c,c++编译器)