Ubuntu Xenial,x86_64
编译6.3.0 gcc
nativ gcc版本是5.4.0
错误来源:
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -I. -Ibuild -I../../gcc-6.3.0/gcc -I../../gcc-6.3.0/gcc/build -I../../gcc-6.3.0/gcc/../include -I../../gcc-6.3.0/gcc/../libcpp/include \
-o build/genmddeps.o ../../gcc-6.3.0/gcc/genmddeps.c
错误:
In file included from ./bconfig.h:3:0,
from ../../gcc-6.3.0/gcc/genmddeps.c:18:
./auto-host.h:2321:16: error: declaration does not declare anything [-fpermissive]
#define rlim_t long
^
In file included from ../../gcc-6.3.0/gcc/genmddeps.c:19:0:
../../gcc-6.3.0/gcc/system.h:488:23: error: conflicting declaration of C function ‘void* sbrk(int)’
extern void *sbrk (int);
^
我正在尝试从头开始编译gcc。我的配置选项是
../gcc-6.3.0/configure --target=arm-eabi --prefix=/local/development/arm-project/tools/ --enable-languages=c --with-newlib --without-headers
有人可以帮忙调试吗?
答案 0 :(得分:1)
我可以通过安装gmp-devel
,mpfr-devel
和libmpc-devel
解决此问题。有关详细信息,请参见GCC docs。
还有一些其他requirements for GCC 9.1.0,例如DejaGnu 1.6.2和GDB 8.3(解决了我的随意性使目标错误)。
如果安装了多个编译器,请使用GCC编译器:
export CC=gcc
export CXX=g++
答案 1 :(得分:0)
尝试(并相应地编辑):
tar xzf gcc-6.3.0.tar.gz
cd gcc-6.3.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-6.3.0/configure --prefix=$HOME/GCC-6.3.0 --enable-languages=c,c++
make
make install