标签:修改 org gcc ges check pre let poi oca
1. 下载源码
wget http://mirrors.kernel.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz
2. 解压
sudo tar -xvf gcc-5.4.0.tar.gz
3. 下载编译所需依赖项:
cd gcc-5.4.0
sudo ./contrib/download_prerequisites //下载依赖项,只能在此目录下执行
cd ..
4. 建立编译输出目录
sudo mkdir gcc-build-5.4.0
5. 进入输出目录,执行以下命令,并生成makefile文件
cd gcc-build-5.4.0
sudo ../gcc-5.4.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
6. 编译
sudo make -j4
(若编译出错且没有报错信息,使用sudo make编译,此处时间较长)
7. 安装
sudo make install
8. 检查版本
gcc --version
附编译报错信息:
1. 报错:configure: error: in `/usr/local/src/gcc-5.4.0/build‘:
解决:缺少gcc需要先安装一个任意gcc版本
2. 报错:dereferencing pointer to incomplete type ‘struct ucontext‘
解决:将61行左右struct ucontext * uc_ = context->cfa
改成 struct ucontext_t * uc_ = context->cfa
3. 报错:/sanitizer_stoptheworld_linux_libcdep.cc:237:22:
error: aggregate ‘sigaltstack handler_stack‘ has incomplete type and cannot be defined struct sigaltstack handler_stack;
解决:将/sanitizer_stoptheworld_linux_libcdep.cc中第237行
struct sigaltstack handler_stack;
修改为:stack_t handler_stack;
4. 报错:……// sanitizer_linux.h
解决:将第二行注释
struct link_map; // Opaque type returned by dlopen().
struct sigaltstack;
将 uptr internal_sigaltstack(const struct sigaltstack* ss, struct sigaltstack* oss);
修改为:uptr internal_sigaltstack(const void* ss, void* oss);
5. 报错:……// sanitizer_linux.cc
将uptr internal_sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss)
修改为:uptr internal_sigaltstack(const void *ss, void *oss)
6. 报错:……// sanitizer_stoptheworld_linux_libcdep.cc
将struct sigaltstack handler_stack;
修改为: stack_t handler_stack;
7. 报错:……//tsan_platform_linux.cc
将res_state *statp = (__res_state*)state;
修改为:struct __res_state *statp = (struct __res_state*)state;
8. 报错:……// asan_linux.cc
解决:在asan_linux.cc中添加头文件#include <signal.h>即可
标签:修改 org gcc ges check pre let poi oca
原文地址:https://www.cnblogs.com/yu121/p/12853419.html