Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692772 - net-analyzer/tcpdump-4.9.2 - compilation uses host (instead of target) header files
Summary: net-analyzer/tcpdump-4.9.2 - compilation uses host (instead of target) header...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-23 15:49 UTC by Jack Rosenthal
Modified: 2019-08-27 22:40 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposed patch (0001-net-analyzer-tcpdump-use-target-header-files-bug-692.patch,1.77 KB, patch)
2019-08-23 16:13 UTC, Jack Rosenthal
Details | Diff
Generated Makefile in workdir for tcpdump-4.9.2 (Makefile,10.52 KB, text/plain)
2019-08-26 21:21 UTC, Jack Rosenthal
Details
config.log (config.log,143.66 KB, text/plain)
2019-08-27 14:57 UTC, Jack Rosenthal
Details
build.log (build.log,108.05 KB, text/plain)
2019-08-27 14:59 UTC, Jack Rosenthal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Rosenthal 2019-08-23 15:49:41 UTC
./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.
...
Comment 1 Jack Rosenthal 2019-08-23 16:13:24 UTC
Created attachment 587880 [details, diff]
Proposed patch

Proposed patch attached
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-08-24 08:44:19 UTC
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.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-24 09:14:11 UTC
(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...
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-24 09:47:02 UTC
# pcap-config --cflags
-I/usr/include
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-24 10:01:19 UTC
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.
Comment 6 Larry the Git Cow gentoo-dev 2019-08-24 10:11:36 UTC
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(+)
Comment 7 Jack Rosenthal 2019-08-26 21:21:14 UTC
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.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-27 03:05:06 UTC
(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.
Comment 9 Jack Rosenthal 2019-08-27 14:57:43 UTC
Created attachment 588270 [details]
config.log
Comment 10 Jack Rosenthal 2019-08-27 14:59:39 UTC
Created attachment 588272 [details]
build.log
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-27 17:16:26 UTC
(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?
Comment 12 Jack Rosenthal 2019-08-27 18:22:52 UTC
(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)
Comment 13 Alexander Tsoy 2019-08-27 18:49:28 UTC
-I/usr/include in CFLAGS comes from --with-crypto=.... From configure:

        CFLAGS="-I$withval/include $CFLAGS"
        LIBS="-L$withval/lib $LIBS"
Comment 14 Jeroen Roovers (RETIRED) gentoo-dev 2019-08-27 19:14:37 UTC
(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?
Comment 15 Larry the Git Cow gentoo-dev 2019-08-27 19:39:59 UTC
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(-)
Comment 16 Jack Rosenthal 2019-08-27 22:40:03 UTC
The commit in comment #15 seems to resolve the issue.

Thanks all! :-)