Bug 25632 - #error config.h must be #included before system headers
Summary: #error config.h must be #included before system headers
Status: RESOLVED WORKSFORME
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-05 02:54 UTC by Halley Tsai
Modified: 2020-03-13 02:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halley Tsai 2020-03-05 02:54:10 UTC
I'm seeing this from a clean build from scratch on :

gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/binutils  -I. -I../../binutils-gdb/binutils -I../bfd -I../../binutils-gdb/binutils/../bfd -I../../binutils-gdb/binutils/../include -DLOCALEDIR="\"/home/hftsai/Workshops/test_gdb/build.install/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I../../binutils-gdb/binutils/../zlib -g -O2 -MT arparse.o -MD -MP -MF .deps/arparse.Tpo -c -o arparse.o `test -f arparse.c || echo ../../binutils-gdb/binutils/`arparse.c 
In file included from ../../binutils-gdb/binutils/../include/alloca-conf.h:16:0,
                 from ../../binutils-gdb/binutils/sysdep.h:23,
                 from ../../binutils-gdb/binutils/arparse.y:29:
./config.h:7:4: error: #error config.h must be #included before system headers
 #  error config.h must be #included before system headers
    ^~~~~

After checking with some possible duplicates, I guess this issue is not related to bfd.h.


Repository: git://sourceware.org/git/binutils-gdb.git
Commit: 899016d4 gdb-9.1-release
OS: Ubuntu 18.04.1
gcc version: 7.4.0
configuration parameters: --disable-werror
Comment 1 Alan Modra 2020-03-10 04:25:43 UTC
Please attach a file with the results of running

gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/binutils  -I. -I../../binutils-gdb/binutils -I../bfd -I../../binutils-gdb/binutils/../bfd -I../../binutils-gdb/binutils/../include -DLOCALEDIR="\"/home/hftsai/Workshops/test_gdb/build.install/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I../../binutils-gdb/binutils/../zlib -g -O2 -E -dD `test -f arparse.c || echo ../../binutils-gdb/binutils/`arparse.c

ie. the command line you posted without "-MT arparse.o -MD -MP -MF .deps/arparse.Tpo -c -o arparse.o" and adding -E -dD.
Comment 2 Halley Tsai 2020-03-13 02:22:13 UTC
I was able to get pass this issue by installing libipt-dev and libbabeltrace-dev packages, and cannot reproduce the same issue on my machine anymore. No idea what changes I made resolved this issue.