./configure seems to ignore the parameters passed to it for header directories and always references /usr/include in the generated Makefile: ... INCLS = -I. -I/usr/include ... This causes compilation failures when cross-compiling (below for ARM): ... tcpdump-4.9.2: # define ntohs(x) __bswap_16 (x) tcpdump-4.9.2: ^ tcpdump-4.9.2: /usr/include/bits/byteswap-16.h:31:14: note: expanded from macro '__bswap_16' tcpdump-4.9.2: __asm__ ("rorw $8, %w0" \ tcpdump-4.9.2: ^ tcpdump-4.9.2: ./print-bgp.c:2441:35: error: unexpected token in operand tcpdump-4.9.2: /usr/include/netinet/in.h:402:21: note: expanded from macro 'ntohs' tcpdump-4.9.2: # define ntohs(x) __bswap_16 (x) tcpdump-4.9.2: ^ tcpdump-4.9.2: /usr/include/bits/byteswap-16.h:31:14: note: expanded from macro '__bswap_16' tcpdump-4.9.2: __asm__ ("rorw $8, %w0" \ tcpdump-4.9.2: ^ tcpdump-4.9.2: <inline asm>:1:11: note: instantiated into assembly here tcpdump-4.9.2: rorw $8, tcpdump-4.9.2: ^ tcpdump-4.9.2: 6 errors generated. ...
Created attachment 587880 [details, diff] Proposed patch Proposed patch attached
Can you attach build.log and `${CHOST}-emerge --info` to get the idea where /usr/include leak comes from? Ideally that should be fixed in the package source, not the ebuild.
(In reply to Sergei Trofimovich from comment #2) > Can you attach build.log and `${CHOST}-emerge --info` to get the idea where > /usr/include leak comes from? No need for that. > Ideally that should be fixed in the package > source, not the ebuild. The ebuild patches the source code...
# pcap-config --cflags -I/usr/include
On second thoughts, it would be interesting to see why pkg-config failed causing configure to check for pcap-config instead. Perhaps the root path isn't set properly? config.log should tell.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a14f74fb4da41d0c6ac8ff511a33b3209fb56fd1 commit a14f74fb4da41d0c6ac8ff511a33b3209fb56fd1 Author: Jeroen Roovers <jer@gentoo.org> AuthorDate: 2019-08-24 10:10:50 +0000 Commit: Jeroen Roovers <jer@gentoo.org> CommitDate: 2019-08-24 10:11:32 +0000 net-libs/libpcap: pcap-config: Do not hardcode includedir Package-Manager: Portage-2.3.72, Repoman-2.3.17 Bug: https://bugs.gentoo.org/692772 Signed-off-by: Jeroen Roovers <jer@gentoo.org> .../libpcap-1.9.0-pcap-config-includedir.patch | 36 ++++++++++ net-libs/libpcap/libpcap-1.9.0-r1.ebuild | 78 ++++++++++++++++++++++ net-libs/libpcap/libpcap-9999.ebuild | 1 + 3 files changed, 115 insertions(+)
Created attachment 588236 [details] Generated Makefile in workdir for tcpdump-4.9.2 It appears that -I/usr/include is no longer part of incls, but now part of CFLAGS with net-libs/libpcap-1.9.0-r1 in https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a14f74fb4da41d0c6ac8ff511a33b3209fb56fd1. Attaching the generated Makefile from the workdir for reference.
(In reply to Jack Rosenthal from comment #7) > Created attachment 588236 [details] > Generated Makefile in workdir for tcpdump-4.9.2 > > It appears that -I/usr/include is no longer part of incls, but now part of > CFLAGS with net-libs/libpcap-1.9.0-r1 in > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > ?id=a14f74fb4da41d0c6ac8ff511a33b3209fb56fd1. > > Attaching the generated Makefile from the workdir for reference. You did not attach the config.log requested in comment #2 and comment #5 yet.
Created attachment 588270 [details] config.log
Created attachment 588272 [details] build.log
(In reply to Jack Rosenthal from comment #9) > Created attachment 588270 [details] > config.log PCAP_CONFIG='/build/kevin/build/bin/armv7a-cros-linux-gnueabihf-pcap-config' (In reply to Jack Rosenthal from comment #10) > Created attachment 588272 [details] > build.log checking for armv7a-cros-linux-gnueabihf-pcap-config... /build/kevin/build/bin/armv7a-cros-linux-gnueabihf-pcap-config Is that the very same pcap-config script installed by net-libs/libpcap which I updated to exclude the include path causing this bug?
(In reply to Jeroen Roovers from comment #11) > (In reply to Jack Rosenthal from comment #9) > > Created attachment 588270 [details] > > config.log > > PCAP_CONFIG='/build/kevin/build/bin/armv7a-cros-linux-gnueabihf-pcap-config' > > (In reply to Jack Rosenthal from comment #10) > > Created attachment 588272 [details] > > build.log > > checking for armv7a-cros-linux-gnueabihf-pcap-config... > /build/kevin/build/bin/armv7a-cros-linux-gnueabihf-pcap-config > > Is that the very same pcap-config script installed by net-libs/libpcap which > I updated to exclude the include path causing this bug? Yes, wrapper script... appears to produce same cflags: $ SYSROOT=/build/kevin /build/kevin/build/bin/armv7a-cros-linux-gnueabihf-pcap-config --cflags (output is just a newline)
-I/usr/include in CFLAGS comes from --with-crypto=.... From configure: CFLAGS="-I$withval/include $CFLAGS" LIBS="-L$withval/lib $LIBS"
(In reply to Alexander Tsoy from comment #13) > -I/usr/include in CFLAGS comes from --with-crypto=.... From configure: > > CFLAGS="-I$withval/include $CFLAGS" > LIBS="-L$withval/lib $LIBS" Ugh, how did I miss that one?
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f061abdd02c8cf63129bb71d677114892386e5eb commit f061abdd02c8cf63129bb71d677114892386e5eb Author: Jeroen Roovers <jer@gentoo.org> AuthorDate: 2019-08-27 19:39:33 +0000 Commit: Jeroen Roovers <jer@gentoo.org> CommitDate: 2019-08-27 19:39:55 +0000 net-analyzer/tcpdump: Remove automatically added include directories Package-Manager: Portage-2.3.73, Repoman-2.3.17 Bug: https://bugs.gentoo.org/692772 Signed-off-by: Jeroen Roovers <jer@gentoo.org> .../tcpdump/files/tcpdump-4.9.2-includedir.patch | 65 +++++++++++++ net-analyzer/tcpdump/tcpdump-4.9.2-r1.ebuild | 106 +++++++++++++++++++++ net-analyzer/tcpdump/tcpdump-9999.ebuild | 4 +- 3 files changed, 173 insertions(+), 2 deletions(-)
The commit in comment #15 seems to resolve the issue. Thanks all! :-)