gcc - Problems with building binutils - Stack Overflow

admin2025-05-02  0

I am trying to build binutils-2.43. My system is debian linux. I am following section 3.1 of sourceware/binutils/binutils-porting-guide.txt it is failing at below command. Please see command and error below.

I tried with CC=g++ and CC=clang, but it gives the same result.

If I try to build version 2.34, it compiles without any extra options. This issue is happening only for binutils 2.43

Minimum reproducible example:

  1. Download source code of binutils
    .43.tar.gz

  2. extract source

  3. cd binutils-2.43

  4. mkdir build

  5. cd build

  6. ../configure

  7. make

Command

/bin/bash ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../gprofng/libcollector  -U_ASM -I.. -I../../../gprofng/libcollector -I../../../gprofng/libcollector/../common -I../../../gprofng/libcollector/../src -I../../../gprofng/libcollector/../../include  -I../../bfd -I../../../gprofng/libcollector/../..  -Wall -Wno-nonnull-compare -g -O2     -MT libgp_collector_la-mmaptrace.lo -MD -MP -MF .deps/libgp_collector_la-mmaptrace.Tpo -c -o libgp_collector_la-mmaptrace.lo `test -f 'mmaptrace.c' || echo '../../../gprofng/libcollector/'`mmaptrace.c

Error

In file included from ../../../gprofng/libcollector/../src/elf.h:30,
                 from ../../../gprofng/libcollector/mmaptrace.c:32:
../../../gprofng/libcollector/../src/Data_window.h:33:1: error: unknown type name ‘class’
   33 | class Data_window
      | ^~~~~
../../../gprofng/libcollector/../src/Data_window.h:34:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
   34 | {
      | ^
In file included from ../../../gprofng/libcollector/../src/Emsg.h:25,
                 from ../../../gprofng/libcollector/../src/elf.h:31:
../../../gprofng/libcollector/../src/vec.h:40:8: error: expected identifier or ‘(’ before string constant
   40 | extern "C"
      |        ^~~
../../../gprofng/libcollector/../src/vec.h:75:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
   75 | template <class ITEM> void

转载请注明原文地址:http://anycun.com/QandA/1746134922a92055.html