构建 gcc 时遇到问题(libiberty obstack.c 无法编译)

构建 gcc 时遇到问题(libiberty obstack.c 无法编译)

我正在运行 openSUSE 11.4,它有点旧了,所以我正在尝试为我想要构建的另一个东西构建一些更新的依赖项。

我已经下载了源代码gcc-6.4.0(也尝试了最新的 - 没有用)。

我在跑../gcc-6.4.0/configure --prefix=/usr2/aakhavan/local --disable-multilib --enable-languages=c,c++ --disable-bootstrap --disable-libmpx --with-system-zlib

使用

gcc-build>gcc -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.3 --enable-linux-futex --without-system-libunwind --with-cpu=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux)

失败的原因make如下:

gcc -c -DHAVE_CONFIG_H -g -O2 -I/usr2/aakhavan/local/src/gcc-chain/local/include -I. -I../../../gcc-6.4.0/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE ../../../gcc-6.4.0/libiberty/physmem.c -o physmem.o
In file included from ../../../gcc-6.4.0/libiberty/partition.c:27:
/usr2/aakhavan/local/src/gcc-chain/local/include/stdlib.h:424: warning: ISO C90 does not support ‘long long’
In file included from ../../../gcc-6.4.0/libiberty/partition.c:27:
/usr2/aakhavan/local/src/gcc-chain/local/include/stdlib.h:521:1: warning: C++ style comments are not allowed in ISO C90
/usr2/aakhavan/local/src/gcc-chain/local/include/stdlib.h:521:1: warning: (this will be reported only once per input file)
In file included from ../../../gcc-6.4.0/libiberty/obstack.c:63:
/usr2/aakhavan/local/src/gcc-chain/local/include/stdlib.h:424: warning: ISO C90 does not support ‘long long’
In file included from ../../../gcc-6.4.0/libiberty/obstack.c:63:
/usr2/aakhavan/local/src/gcc-chain/local/include/stdlib.h:521:1: warning: C++ style comments are not allowed in ISO C90
/usr2/aakhavan/local/src/gcc-chain/local/include/stdlib.h:521:1: warning: (this will be reported only once per input file)
../../../gcc-6.4.0/libiberty/obstack.c: In function ‘call_chunkfun’:
../../../gcc-6.4.0/libiberty/obstack.c:92: error: request for member ‘extra’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c:94: error: request for member ‘plain’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c: In function ‘call_freefun’:
../../../gcc-6.4.0/libiberty/obstack.c:101: error: request for member ‘extra’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c:103: error: request for member ‘plain’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c: At top level:
../../../gcc-6.4.0/libiberty/obstack.c:115: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c:115: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c: In function ‘_obstack_begin_worker’:
../../../gcc-6.4.0/libiberty/obstack.c:119: error: ‘alignment’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c:119: error: (Each undeclared identifier is reported only once
../../../gcc-6.4.0/libiberty/obstack.c:119: error: for each function it appears in.)
../../../gcc-6.4.0/libiberty/obstack.c:121: error: ‘size’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c: At top level:
../../../gcc-6.4.0/libiberty/obstack.c:157: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c:157: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c:156: error: conflicting types for ‘_obstack_begin’
/usr2/aakhavan/local/src/gcc-chain/local/include/obstack.h:183: error: previous declaration of ‘_obstack_begin’ was here
../../../gcc-6.4.0/libiberty/obstack.c: In function ‘_obstack_begin’:
../../../gcc-6.4.0/libiberty/obstack.c:161: error: request for member ‘plain’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c:162: error: request for member ‘plain’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c:164: error: ‘size’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c:164: error: ‘alignment’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c:164: error: too many arguments to function ‘_obstack_begin_worker’
../../../gcc-6.4.0/libiberty/obstack.c: At top level:
../../../gcc-6.4.0/libiberty/obstack.c:169: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c:169: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c:168: error: conflicting types for ‘_obstack_begin_1’
/usr2/aakhavan/local/src/gcc-chain/local/include/obstack.h:185: error: previous declaration of ‘_obstack_begin_1’ was here
../../../gcc-6.4.0/libiberty/obstack.c: In function ‘_obstack_begin_1’:
../../../gcc-6.4.0/libiberty/obstack.c:174: error: request for member ‘extra’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c:175: error: request for member ‘extra’ in something not a structure or union
../../../gcc-6.4.0/libiberty/obstack.c:178: error: ‘size’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c:178: error: ‘alignment’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c:178: error: too many arguments to function ‘_obstack_begin_worker’
../../../gcc-6.4.0/libiberty/obstack.c: At top level:
../../../gcc-6.4.0/libiberty/obstack.c:188: error: expected declaration specifiers or ‘...’ before ‘_OBSTACK_SIZE_T’
../../../gcc-6.4.0/libiberty/obstack.c:188: error: conflicting types for ‘_obstack_newchunk’
/usr2/aakhavan/local/src/gcc-chain/local/include/obstack.h:182: error: previous declaration of ‘_obstack_newchunk’ was here
../../../gcc-6.4.0/libiberty/obstack.c: In function ‘_obstack_newchunk’:
../../../gcc-6.4.0/libiberty/obstack.c:196: error: ‘length’ undeclared (first use in this function)
../../../gcc-6.4.0/libiberty/obstack.c:201: warning: comparison between signed and unsigned
../../../gcc-6.4.0/libiberty/obstack.c: At top level:
../../../gcc-6.4.0/libiberty/obstack.c:298: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_obstack_memory_used’
make[2]: *** [obstack.o] Error 1

我尝试禁用 libiberty,但它却抱怨构建 libtools。在网上搜索了一番,但找不到任何答案。到底发生了什么?

答案1

从编译中的错误 堆栈对象,很明显你没有正确的环境来构建gcc-6.4.0。

我注意到可以通过以下命令安装 gcc:

sudo zypper install gcc

你可以找到包 gcc6-6.5.0+r265524-2.1.x86_64.rpm 在存储库中 下载.opensuse.org/repositories/devel:/gcc/SLE-11/x86_64/,无需编译任何东西。

事实上,复制旧软件包最初编译时的确切环境是极其困难的。找到它的发布版本要容易得多,也省时得多。因为 glibc 确实 向下兼容,即使您环境中的 glibc 较新,这也会起作用,因此即使您无法再编译该程序,因为您的头文件不是正确的版本。

相关内容