Bug 29158 - 0.187 fails to build with gcc-10: #error "Please include config.h first."
Summary: 0.187 fails to build with gcc-10: #error "Please include config.h first."
Status: RESOLVED WONTFIX
Alias: None
Product: elfutils
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-19 21:24 UTC by yuri
Modified: 2023-10-06 11:02 UTC (History)
2 users (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 yuri 2022-05-19 21:24:56 UTC
In file included from color.c:34:
/usr/local/share/gnulib/lib/argp.h:583:3: error: #error "Please include config.h first."
  583 |  #error "Please include config.h first."
      |   ^~~~~
/usr/local/share/gnulib/lib/argp.h:585:1: error: unknown type name '_GL_INLINE_HEADER_BEGIN'
  585 | _GL_INLINE_HEADER_BEGIN
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/share/gnulib/lib/argp.h:616:9: error: expected ';' before 'void'
  616 | ARGP_EI void
      |         ^~~~
/usr/local/share/gnulib/lib/argp.h:622:9: error: expected ';' before 'int'
  622 | ARGP_EI int
      |         ^~~
/usr/local/share/gnulib/lib/argp.h:634:9: error: expected ';' before 'int'
  634 | ARGP_EI int
      |         ^~~
/usr/local/share/gnulib/lib/argp.h:645:22: error: expected ';' before 'struct'
  645 | _GL_INLINE_HEADER_END
      |                      ^
      |                      ;



OS: FreeBSD 13
Comment 1 Mark Wielaard 2022-05-20 00:43:17 UTC
Normally glibc provides argp.
I think this means you integrated gnulib argp incorrectly.
How do you configure and what does config.log say about argp?
Comment 2 yuri 2022-05-20 01:07:00 UTC
configure arguments:
> --program-prefix=eu- --disable-debuginfod --enable-nls --prefix=/usr/local

configure output:
> checking for library containing argp_parse... none required

config.log file: https://people.freebsd.org/~yuri/elfutils-config.log
Comment 3 yuri 2022-05-20 01:23:11 UTC
Also:
* the problem only exists with gcc, and not with clang-12.
* 0.179 didn't have such problem, so this is a regression.
Comment 4 Mark Wielaard 2022-05-20 01:25:16 UTC
You might want to ask someone who knows about how freebsd provides argp to see if they understand why your CFLAGS seem to contain -I/usr/local/share/gnulib/lib and your LDFLAGS contain /usr/local/lib/libargp.so. That seems to confuse the build.
Comment 5 yuri 2022-05-20 01:26:53 UTC
The port adds -I/usr/local/share/gnulib/lib and LDFLAGS=/usr/local/lib/libargp.so - otherwise it doesn't find argp.
Comment 6 Mark Wielaard 2022-05-20 02:00:08 UTC
Sorry you have to ask whoever added -I/usr/local/share/gnulib/lib to CFLAGS how that is supposed to work. Obviously the argp.h header found there isn't usable as is. Normally people build against glibc or argp-standalone.
Comment 7 yuri 2022-05-20 02:01:51 UTC
(In reply to Mark Wielaard from comment #6)
> Sorry you have to ask whoever added -I/usr/local/share/gnulib/lib to CFLAGS
> how that is supposed to work. Obviously the argp.h header found there isn't
> usable as is. Normally people build against glibc or argp-standalone.

I added these flags to solve build failures.

This works when built with clang.
Comment 8 yuri 2022-05-20 02:04:31 UTC
It might be that clang-built and gcc-built code is just compatible.
Not sure if this is the case here.
Comment 9 Mark Wielaard 2023-10-06 11:02:02 UTC
This is not an elfutils problem, but an issue with the argp replacement configure/flags used.