Opened 12 years ago

Closed 12 years ago

#36472 closed defect (fixed)

gdb build failure

Reported by: mkae (Marko Käning) Owned by: dweber@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: blair (Blair Zajac), mkb-prime@…, dershow, anddam (Andrea D'Amore), maehne (Torsten Maehne), evandrix (Lee Wei Yeong), david.brockley@…
Port: gdb

Description

I just upgraded my install and gdb didn't build anymore. Here's what the log file returned:

:info:build make[3]: Leaving directory `/opt/macports-test/var/macports/build/_opt_macports-test_var_macports_sources_rsync.macports.org_release_ports_devel_gdb/gdb/work/gdb-7.5/gdb'
:info:build /usr/bin/gcc-4.2 -pipe -O2 -I/opt/macports-test/include -arch x86_64   -I. -I. -I./common -I./config -DLOCALEDIR="\"/opt/macports-test/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../read
line/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/opt/macports-test/include -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.
7/include/python2.7 -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunu
sed-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement  -c -o gdb.o -MT gdb.o -MMD -MP -MF .deps/gdb.Tpo gdb.c
:info:build /usr/bin/gcc-4.2 -pipe -O2 -I/opt/macports-test/include -arch x86_64   -I. -I. -I./common -I./config -DLOCALEDIR="\"/opt/macports-test/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../read
line/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/opt/macports-test/include -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.
7/include/python2.7 -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunu
sed-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement  -c -o amd64-tdep.o -MT amd64-tdep.o -MMD -MP -MF .deps/amd64-tdep.Tpo amd64-tdep.c
:info:build In file included from symfile.h:24,:info:build                  from dictionary.h:26,:info:build                  from block.h:23,:info:build                  from amd64-tdep.c:26:
:info:build symtab.h:149: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build symtab.h:341: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build In file included from symfile.h:24,
:info:build                  from dictionary.h:26,
:info:build                  from block.h:23,
:info:build                  from amd64-tdep.c:26:
:info:build symtab.h:586: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build /usr/bin/gcc-4.2 -pipe -O2 -I/opt/macports-test/include -arch x86_64   -I. -I. -I./common -I./config -DLOCALEDIR="\"/opt/macports-test/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../read
line/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/opt/macports-test/include -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.
7/include/python2.7 -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunu
sed-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement  -c -o i386-tdep.o -MT i386-tdep.o -MMD -MP -MF .deps/i386-tdep.Tpo i386-tdep.c
:info:build In file included from value.h:488,
:info:build                  from breakpoint.h:23,
:info:build                  from inferior.h:37,
:info:build                  from amd64-tdep.c:31:
:info:build gdbtypes.h:402: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build gdbtypes.h:963: error: field ‘loc’ has incomplete type
:info:build gdbtypes.h:966: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build gdbtypes.h:980: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build In file included from value.h:487,
:info:build                  from breakpoint.h:23,
:info:build                  from inferior.h:37,
:info:build                  from i386-tdep.c:30:
:info:build symtab.h:149: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build symtab.h:341: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build In file included from value.h:487,
:info:build                  from breakpoint.h:23,
:info:build                  from inferior.h:37,
:info:build                  from i386-tdep.c:30:
:info:build symtab.h:586: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build In file included from value.h:488,
:info:build                  from breakpoint.h:23,
:info:build                  from inferior.h:37,
:info:build                  from i386-tdep.c:30:
:info:build gdbtypes.h:402: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build gdbtypes.h:963: error: field ‘loc’ has incomplete type
:info:build gdbtypes.h:966: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build gdbtypes.h:980: error: expected specifier-qualifier-list before ‘ENUM_BITFIELD’
:info:build amd64-tdep.c: In function ‘amd64_non_pod_p’:
:info:build amd64-tdep.c:437: error: ‘struct main_type’ has no member named ‘code’
:info:build amd64-tdep.c:437: error: ‘struct main_type’ has no member named ‘type_specific_field’
:info:build amd64-tdep.c:437: error: ‘struct main_type’ has no member named ‘type_specific’
:info:build amd64-tdep.c:437: error: ‘struct main_type’ has no member named ‘type_specific’
:info:build amd64-tdep.c: In function ‘amd64_classify_aggregate’:
:info:build amd64-tdep.c:468: error: ‘struct main_type’ has no member named ‘code’
:info:build amd64-tdep.c:470: error: ‘struct main_type’ has no member named ‘target_type’
:info:build amd64-tdep.c:482: error: ‘struct main_type’ has no member named ‘code’
:info:build amd64-tdep.c:482: error: ‘struct main_type’ has no member named ‘code’
:info:build amd64-tdep.c:485: error: ‘struct main_type’ has no member named ‘nfields’
:info:build amd64-tdep.c:487: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build amd64-tdep.c:488: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build amd64-tdep.c:490: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build amd64-tdep.c:495: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build amd64-tdep.c:498: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build amd64-tdep.c: In function ‘amd64_classify’:
:info:build amd64-tdep.c:554: error: ‘struct main_type’ has no member named ‘code’
:info:build make[2]: *** [amd64-tdep.o] Error 1
:info:build make[2]: *** Waiting for unfinished jobs....
:info:build i386-tdep.c: In function ‘i386_16_byte_align_p’:
:info:build i386-tdep.c:2316: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2317: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2317: error: ‘struct main_type’ has no member named ‘flag_vector’
:info:build i386-tdep.c:2320: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2321: error: ‘struct main_type’ has no member named ‘target_type’
:info:build i386-tdep.c:2322: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2323: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2326: error: ‘struct main_type’ has no member named ‘nfields’
:info:build i386-tdep.c:2328: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build i386-tdep.c: In function ‘i386_extract_return_value’:
:info:build i386-tdep.c:2465: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c: In function ‘i386_store_return_value’:
:info:build i386-tdep.c:2515: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c: In function ‘i386_reg_struct_return_p’:
:info:build i386-tdep.c:2592: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2606: error: ‘struct main_type’ has no member named ‘nfields’
:info:build i386-tdep.c:2608: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build i386-tdep.c:2609: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c: In function ‘i386_return_value’:
:info:build i386-tdep.c:2627: error: ‘struct main_type’ has no member named ‘code’
:info:build i386-tdep.c:2671: error: ‘struct main_type’ has no member named ‘nfields’
:info:build i386-tdep.c:2673: error: ‘struct main_type’ has no member named ‘flds_bnds’
:info:build i386-tdep.c: In function ‘i386_ymm_type’:
:info:build i386-tdep.c:2746: error: ‘struct main_type’ has no member named ‘flag_vector’
:info:build i386-tdep.c:2747: error: ‘struct main_type’ has no member named ‘name’
:info:build i386-tdep.c: In function ‘i386_mmx_type’:
:info:build i386-tdep.c:2788: error: ‘struct main_type’ has no member named ‘flag_vector’
:info:build i386-tdep.c:2789: error: ‘struct main_type’ has no member named ‘name’
:info:build make[2]: *** [i386-tdep.o] Error 1
.
.
.

Attachments (3)

pre-out.c (592.8 KB) - added by mkae (Marko Käning) 12 years ago.
pre-processor's output
pre-out.c.gz (104.7 KB) - added by mkae (Marko Käning) 12 years ago.
Ooops, ok, did so now.
main.log (272.1 KB) - added by cdeil (Christoph Deil) 12 years ago.

Download all attachments as: .zip

Change History (26)

comment:1 Changed 12 years ago by blair (Blair Zajac)

gdb built fine for my on one system and then failed on another, which turned out being due to cctools-headers being installed. Do you have that package installed? If so:

  1. port deactivate cctools-headers
  2. port clean gdb
  3. port install gdb
  4. port activate cctools-headers

comment:2 Changed 12 years ago by mkae (Marko Käning)

No, I don't have this port installed on my end.

comment:3 Changed 12 years ago by blair (Blair Zajac)

I cannot tell what's causing it to fail, but my guess is you have a port that is providing a header file that gdb is picking up before its own. You'll need to look at the header files and see what it found versus what it expected. What I normally do is have gcc/g++/clang/clang++ provided the output following the C-preprocessor phase so I can see the paths it picked up. In your case, something like removing everything from -c to .deps/amd64-tdep.Tpo and replacing it with -E would help:

/usr/bin/gcc-4.2 -pipe -O2 -I/opt/macports-test/include -arch x86_64 -I. -I. -I./common -I./config -DLOCALEDIR="\"/opt/macports-test/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./gnulib/import -Ibuild-gnulib/import -DTUI=1 -I/opt/macports-test/include -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/macports-test/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -E amd64-tdep.c | less

Something else to do is find all the .h files in gdb's source and use find /opt/macports-test -name to see if it's there also.

Once you find the offending port, I can check for it in the Portfile to warn people that they'll need to have it deactivated.

Blair

Version 0, edited 12 years ago by blair (Blair Zajac) (next)

comment:4 Changed 12 years ago by mkae (Marko Käning)

Running the above command produced this on stderr:

In file included from amd64-tdep.c:22:
defs.h:29:52: error: config.h: No such file or directory
In file included from defs.h:824,
                 from amd64-tdep.c:22:
./common/common-utils.h:23:20: error: config.h: No such file or directory
In file included from ./common/vec.h:26,
                 from symtab.h:24,
                 from symfile.h:24,
                 from dictionary.h:26,
                 from block.h:23,
                 from amd64-tdep.c:26:
./gdb_string.h:51:22: error: macro "memset" requires 3 arguments, but only 1 given
./gdb_string.h:52:22: error: macro "memcpy" requires 3 arguments, but only 1 given
./gdb_string.h:53:23: error: macro "memmove" requires 3 arguments, but only 1 given

I don't know whether that's something to worry about.

Changed 12 years ago by mkae (Marko Käning)

Attachment: pre-out.c added

pre-processor's output

comment:5 Changed 12 years ago by mkae (Marko Käning)

In gdb/defs.h one finds in line 29:

#include "config.h"     /* Generated by configure.  */

where it's pointed out that config.h gets generated by configure. But, although I ran "port configure" initially the file config.h is nowhere to be found in the work/gdb-7.5/

comment:6 Changed 12 years ago by blair (Blair Zajac)

It won't create the config.h until you've built it. Do 'port build gdb' and then cd into gdb and run the gcc command again (assuming it's the exact same failure).

Changed 12 years ago by mkae (Marko Käning)

Attachment: pre-out.c.gz added

Ooops, ok, did so now.

comment:7 Changed 12 years ago by mkb-prime@…

Cc: mkb-prime@… added

Cc Me!

comment:8 Changed 12 years ago by dershow

Cc: dersh@… added

Cc Me!

comment:9 in reply to:  description ; Changed 12 years ago by j.hafey@…

Replying to mk@…: I suspect that the problem is that /opt/.../include is being included before ../include which is most likely using the (old) ansidecl.h from /opt/.../include which does not have the ENUM_BITFIELD macro which symtab.h is relying on. If this is what is causing the problem, you should be able to install after deactivating the offending package (sudo port deactivate gdb && sudo port install gdb).

comment:10 Changed 12 years ago by anddam (Andrea D'Amore)

Cc: and.damore@… added

Cc Me!

comment:11 Changed 12 years ago by maehne (Torsten Maehne)

Cc: Torsten.Maehne@… added

Cc Me!

comment:12 in reply to:  9 Changed 12 years ago by mkae (Marko Käning)

Resolution: worksforme
Status: newclosed

Replying to j.hafey@…:

you should be able to install after deactivating the offending package (sudo port deactivate gdb && sudo port install gdb).

Which is indeed the case. After deactivation of the old gdb I was able to install the current version.

Thanks, J.!!! :-)

I guess this port would need a pre-build phase which automatically deactivates an existing gdb!

comment:13 Changed 12 years ago by anddam (Andrea D'Amore)

Has duplicate #36510.

comment:14 Changed 12 years ago by eborisch (Eric A. Borisch)

Not sure this ticket should be closed just yet... Shouldn't this (and handling of the cctools-headers conflict) be described in a notes or ui_msg item in the port? Something to alert the user that they are about to run into a known issue, and "here is how to work around it?"

comment:15 Changed 12 years ago by blair (Blair Zajac)

There is a check for cctools-headers I put in, so it'll error early. There isn't a check for an existing gdb install though, that could be added.

The best fix is to update the include file path so it doesn't matter what's installed.

comment:16 in reply to:  1 ; Changed 12 years ago by evandrix (Lee Wei Yeong)

FTFY

  1. sudo port -f deactivate cctools-headers
  2. sudo port -f clean --all gdb
  3. sudo port -d install gdb
  4. sudo port activate cctools-headers

Replying to blair@…:

gdb built fine for my on one system and then failed on another, which turned out being due to cctools-headers being installed. Do you have that package installed? If so:

  1. port deactivate cctools-headers
  2. port clean gdb
  3. port install gdb
  4. port activate cctools-headers

comment:17 Changed 12 years ago by evandrix (Lee Wei Yeong)

Cc: evandrix@… added

Cc Me!

comment:18 in reply to:  16 Changed 12 years ago by mkae (Marko Käning)

Resolution: worksforme
Status: closedreopened

Replying to evandrix@…:

FTFY

Would be best if the described workflow would be suggested by port gdb itself, requiring that the port detects whether it's already installed on the system.

That's why I follow eborisch's doubt that this issue shouldn't be closed.

comment:19 Changed 12 years ago by david.brockley@…

Cc: david.brockley@… added

Cc Me!

comment:20 Changed 12 years ago by cdeil (Christoph Deil)

Trying to update 7.3_1 to 7.5_0 I got similar (bug not identical) gdb compile errors as the ones shown above. I'm on OS X 10.8.2 (12C60) with XCode 4.5.1 (4G1004) and Macports tried to use this compiler to build gdb:

$ /usr/bin/clang --version
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

Full log attached.

Here's the commands I executed:

$ port outdated
The following installed ports are outdated:
gdb                            7.3_1 < 7.5_0             

$ sudo port upgrade gdb
--->  Computing dependencies for gdb
--->  Configuring gdb
Error: gdb cannot be built while cctools-headers is active.
Error: Please deactivate cctools-headers and try again.
Error: You can reactivate cctools-headers again later.
Error: org.macports.configure for port gdb returned: cctools-headers is active
Please see the log file for port gdb for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_gdb/gdb/main.log
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets

# Following the advice in Macports ticket 36637
$ sudo port -f deactivate cctools-headers
--->  Deactivating cctools-headers @829_0
--->  Unable to deactivate cctools-headers @829_0, the following ports depend on it:
--->  	cctools @829_2+llvm31
Warning: Deactivate forced.  Proceeding despite dependencies.
--->  Cleaning cctools-headers

$ sudo port upgrade gdb
--->  Computing dependencies for gdb
--->  Configuring gdb
--->  Building gdb
Error: org.macports.build for port gdb returned: command execution failed

# For now re-activate cctools-headers
$ sudo port activate cctools-headers
Password:
--->  Activating cctools-headers @829_0
--->  Cleaning cctools-headers

Changed 12 years ago by cdeil (Christoph Deil)

Attachment: main.log added

comment:21 Changed 12 years ago by blair (Blair Zajac)

@Deil best if you can see what's on your system that's causing the compile failure, either by debugging the build and seeing which header file is being included by manually running:

/usr/bin/clang -pipe -O2 -I/opt/local/include -Wno-unused-value -arch x86_64   -I. -I. -I./common -I./config -DLOCALEDIR="\"/opt/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -MT ser-base.o -MMD -MP -MF .deps/ser-base.Tpo ser-base.c -E | less

or deactivating ports that look like they could cause gdb a build issue.

comment:22 in reply to:  20 Changed 12 years ago by mkae (Marko Käning)

Replying to Deil.Christoph@…:

Trying to update 7.3_1 to 7.5_0 I got similar (bug not identical) gdb compile errors

Did you try deactivating your current gdb before upgrading?

comment:23 Changed 12 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.