我正在尝试在 Ubuntu 12.04 上安装 GCC 4.8,但在 make 过程中出现如下所示的错误,编译中止。(据我所知,我已经满足所有先决条件,因为我已经在系统上编译、安装并运行了 gcc 4.7.2。我使用包管理器“stow”管理不同版本的 gcc。)
有人有解决方案或解决方案的线索吗?
$ ./configure --prefix /usr/local/stow/gcc-4.8.0
...
$ make
[ -f stage_final ] || echo stage3 > stage_final
make[1]: Entering directory `/home/me/Downloads/gcc-4.8.0'
make[2]: Entering directory `/home/me/Downloads/gcc-4.8.0'
make[3]: Entering directory `/home/me/Downloads/gcc-4.8.0'
rm -f stage_current
make[3]: Leaving directory `/home/me/Downloads/gcc-4.8.0'
make[2]: Leaving directory `/home/me/Downloads/gcc-4.8.0'
make[2]: Entering directory `/home/me/Downloads/gcc-4.8.0'
make[3]: Entering directory `/home/me/Downloads/gcc-4.8.0/host-i686-pc-linux-gnu/libiberty'
if [ x"-fpic" != x ] && [ ! -d pic ]; then \
mkdir pic; \
else true; fi
touch stamp-picdir
CONFIG_FILES= CONFIG_HEADERS=config.h:../.././libiberty/config.in /bin/bash ./config.status
config.status: creating config.h
config.status: executing default commands
if [ x"-fpic" != x ]; then \
gcc -c -DHAVE_CONFIG_H -g -I. -I../.././libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -fpic ../.././libiberty/regex.c -o pic/regex.o; \
else true; fi
In file included from ../.././libiberty/regex.c:52:0:
/usr/include/i386-linux-gnu/sys/types.h:99:17: error: two or more data types in declaration specifiers
/usr/include/i386-linux-gnu/sys/types.h:110:19: error: two or more data types in declaration specifiers
../.././libiberty/regex.c:132:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
../.././libiberty/regex.c:132:7: warning: conflicting types for built-in function ‘malloc’ [enabled by default]
../.././libiberty/regex.c:133:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
../.././libiberty/regex.c:133:7: warning: conflicting types for built-in function ‘realloc’ [enabled by default]
In file included from ../.././libiberty/regex.c:640:0:
../.././libiberty/regex.c: In function ‘byte_regex_compile’:
../.././libiberty/regex.c:2441:7: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
../.././libiberty/regex.c:2441:33: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c:2502:17: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c:2535:36: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c:2642:28: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c:3645:26: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c:4152:5: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c: In function ‘byte_re_compile_fastmap’:
../.././libiberty/regex.c:4837:11: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration]
../.././libiberty/regex.c:4837:11: warning: incompatible implicit declaration of built-in function ‘abort’ [enabled by default]
../.././libiberty/regex.c: In function ‘byte_re_match_2_internal’:
../.././libiberty/regex.c:7426:11: warning: incompatible implicit declaration of built-in function ‘abort’ [enabled by default]
../.././libiberty/regex.c: In function ‘xregcomp’:
../.././libiberty/regex.c:7980:4: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c: In function ‘xregexec’:
../.././libiberty/regex.c:8055:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
../.././libiberty/regex.c: In function ‘xregerror’:
../.././libiberty/regex.c:8083:5: warning: incompatible implicit declaration of built-in function ‘abort’ [enabled by default]
../.././libiberty/regex.c: In function ‘xregfree’:
../.././libiberty/regex.c:8116:3: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
make[3]: *** [regex.o] Error 1
make[3]: Leaving directory `/home/me/Downloads/gcc-4.8.0/host-i686-pc-linux-gnu/libiberty'
make[2]: *** [all-stage1-libiberty] Error 2
make[2]: Leaving directory `/home/me/Downloads/gcc-4.8.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/me/Downloads/gcc-4.8.0'
make: *** [all] Error 2
更新:
我在 build-dir/host-i686-pc-linux-gnu/libiberty/config.log 中发现以下错误日志
$ more ./host-i686-pc-linux-gnu/libiberty/config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ /home/me/Downloads/gcc-4.8.0/libiberty/configure --cache-file=./config.cache --prefix /usr/local/stow/gcc-4.8.0/ --enable-languages=c,c++,fortran,java,lto,objc --program-tr
ansform-name=s,y,y, --disable-option-checking --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --srcdir=../.././libiberty --disable-intermodule --enable-c
hecking=yes,types --disable-coverage --enable-languages=c,c++,lto --enable-shared
## --------- ##
## Platform. ##
## --------- ##
hostname = ubuntu
uname -m = i686
uname -r = 3.5.0-26-generic
uname -s = Linux
uname -v = #42~precise1-Ubuntu SMP Mon Mar 11 22:19:42 UTC 2013
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/lib/lightdm/lightdm
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2223: creating cache ./config.cache
configure:2374: checking whether to enable maintainer-specific portions of Makefiles
configure:2384: result: no
configure:2399: checking for makeinfo
configure:2426: result: makeinfo --split-size=5000000 --split-size=5000000
configure:2466: checking for perl
configure:2482: found /usr/bin/perl
configure:2493: result: perl
configure:2512: checking build system type
configure:2526: result: i686-pc-linux-gnu
configure:2546: checking host system type
configure:2559: result: i686-pc-linux-gnu
configure:2584: checking for i686-pc-linux-gnu-ar
configure:2611: result: ar
configure:2676: checking for i686-pc-linux-gnu-ranlib
configure:2703: result: ranlib
configure:2796: checking for i686-pc-linux-gnu-gcc
configure:2823: result: gcc
configure:3092: checking for C compiler version
configure:3101: gcc --version >&5
gcc (GCC) 4.7.2
Copyright (C) 2012 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.
configure:3112: $? = 0
configure:3101: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/stow/gcc-4.7.2/libexec/gcc/i686-pc-linux-gnu/4.7.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/usr/local/stow/gcc-4.7.2/
Thread model: posix
gcc version 4.7.2 (GCC)
configure:3112: $? = 0
configure:3101: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3112: $? = 1
configure:3101: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3112: $? = 1
configure:3128: gcc -o conftest -g -static-libstdc++ -static-libgcc conftest.c >&5
configure:3131: $? = 0
configure:3160: checking for C compiler default output file name
configure:3182: gcc -g -static-libstdc++ -static-libgcc conftest.c >&5
configure:3186: $? = 0
configure:3223: result: a.out
configure:3239: checking whether the C compiler works
configure:3248: ./a.out
configure:3252: $? = 0
configure:3267: result: yes
configure:3274: checking whether we are cross compiling
configure:3276: result: no
configure:3279: checking for suffix of executables
configure:3286: gcc -o conftest -g -static-libstdc++ -static-libgcc conftest.c >&5
configure:3290: $? = 0
configure:3312: result:
configure:3319: checking for suffix of object files
configure:3341: gcc -c -g conftest.c >&5
configure:3345: $? = 0
configure:3366: result: o
configure:3370: checking whether we are using the GNU C compiler
configure:3389: gcc -c -g conftest.c >&5
configure:3389: $? = 0
configure:3398: result: yes
configure:3407: checking whether gcc accepts -g
configure:3427: gcc -c -g conftest.c >&5
configure:3427: $? = 0
configure:3468: result: yes
configure:3485: checking for gcc option to accept ISO C89
configure:3549: gcc -c -g conftest.c >&5
In file included from /usr/include/features.h:389:0,
from /usr/include/stdio.h:28,
from conftest.c:10:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
compilation terminated.
...
[The logfile continues with several other errors similar to this.]
答案1
仅供参考,我切换到 Ubuntu 12.04 x84_64,一切都运行正常。只需安装依赖项,就不会出现任何错误。不过,我不知道为什么它不能与 Ubuntu 12.04 i386 一起使用。