[v8,6/6] build: use dependency for pcap and fallback to find_library
diff mbox series

Message ID 20190226174637.27452-6-luca.boccassi@gmail.com
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • [v8,1/6] build: bump minimum Meson version to 0.47.1
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Luca Boccassi Feb. 26, 2019, 5:46 p.m. UTC
From: Luca Boccassi <luca.boccassi@microsoft.com>

pcap has historically shipped a custom pcap-config binary tool which
does the job of pkg-config. It was never compatible with cross
compilation.
Meson uses it when using dependency(), which then means cross
compilation fails.
Set pcap-config to empty in the meson cross compilation files so
that Meson will not use it, and add a fallback in case
dependency() fails.
libpcap 1.9.0 finally ships a pkg-config file so everything will
work out of the box in the future.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
---
v8: added back pcap change separately. Tested with bootlin
    cross-compilation toolchain, everything seems to work.

 config/arm/arm64_armv8_linuxapp_gcc    |  1 +
 config/arm/arm64_dpaa2_linuxapp_gcc    |  1 +
 config/arm/arm64_dpaa_linuxapp_gcc     |  1 +
 config/arm/arm64_thunderx_linuxapp_gcc |  1 +
 drivers/net/pcap/meson.build           | 16 ++++++++++++----
 5 files changed, 16 insertions(+), 4 deletions(-)

Comments

Luca Boccassi Feb. 26, 2019, 5:49 p.m. UTC | #1
On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <luca.boccassi@microsoft.com>
> 
> pcap has historically shipped a custom pcap-config binary tool which
> does the job of pkg-config. It was never compatible with cross
> compilation.
> Meson uses it when using dependency(), which then means cross
> compilation fails.
> Set pcap-config to empty in the meson cross compilation files so
> that Meson will not use it, and add a fallback in case
> dependency() fails.
> libpcap 1.9.0 finally ships a pkg-config file so everything will
> work out of the box in the future.
> 
> Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> ---
> v8: added back pcap change separately. Tested with bootlin
>     cross-compilation toolchain, everything seems to work.

I had some time to invest so I added back this change, in a way that
works with cross compilation too. Given the series wasn't merged yet
and there was a conflict I've done a v8 rather than a single separate
patch, but it's independent from the rest.

More testing is of course welcome!
Thomas Monjalon Feb. 27, 2019, 8:33 a.m. UTC | #2
26/02/2019 18:49, Luca Boccassi:
> On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > 
> > pcap has historically shipped a custom pcap-config binary tool which
> > does the job of pkg-config. It was never compatible with cross
> > compilation.
> > Meson uses it when using dependency(), which then means cross
> > compilation fails.
> > Set pcap-config to empty in the meson cross compilation files so
> > that Meson will not use it, and add a fallback in case
> > dependency() fails.
> > libpcap 1.9.0 finally ships a pkg-config file so everything will
> > work out of the box in the future.
> > 
> > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > ---
> > v8: added back pcap change separately. Tested with bootlin
> >     cross-compilation toolchain, everything seems to work.
> 
> I had some time to invest so I added back this change, in a way that
> works with cross compilation too. Given the series wasn't merged yet
> and there was a conflict I've done a v8 rather than a single separate
> patch, but it's independent from the rest.
> 
> More testing is of course welcome!

I still see the same error when cross-compiling:

/usr/include/stdint.h:109: error: "__INT64_C" redefined
Bruce Richardson Feb. 27, 2019, 9:47 a.m. UTC | #3
On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> 26/02/2019 18:49, Luca Boccassi:
> > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > 
> > > pcap has historically shipped a custom pcap-config binary tool which
> > > does the job of pkg-config. It was never compatible with cross
> > > compilation.
> > > Meson uses it when using dependency(), which then means cross
> > > compilation fails.
> > > Set pcap-config to empty in the meson cross compilation files so
> > > that Meson will not use it, and add a fallback in case
> > > dependency() fails.
> > > libpcap 1.9.0 finally ships a pkg-config file so everything will
> > > work out of the box in the future.
> > > 
> > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > ---
> > > v8: added back pcap change separately. Tested with bootlin
> > >     cross-compilation toolchain, everything seems to work.
> > 
> > I had some time to invest so I added back this change, in a way that
> > works with cross compilation too. Given the series wasn't merged yet
> > and there was a conflict I've done a v8 rather than a single separate
> > patch, but it's independent from the rest.
> > 
> > More testing is of course welcome!
> 
> I still see the same error when cross-compiling:
> 
> /usr/include/stdint.h:109: error: "__INT64_C" redefined
> 
Can patches 1-5 be merged anyway, leaving 6 for later?

/Bruce
Luca Boccassi Feb. 27, 2019, 10:50 a.m. UTC | #4
On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > 26/02/2019 18:49, Luca Boccassi:
> > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > 
> > > > pcap has historically shipped a custom pcap-config binary tool
> > > > which
> > > > does the job of pkg-config. It was never compatible with cross
> > > > compilation.
> > > > Meson uses it when using dependency(), which then means cross
> > > > compilation fails.
> > > > Set pcap-config to empty in the meson cross compilation files
> > > > so
> > > > that Meson will not use it, and add a fallback in case
> > > > dependency() fails.
> > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > will
> > > > work out of the box in the future.
> > > > 
> > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > ---
> > > > v8: added back pcap change separately. Tested with bootlin
> > > >     cross-compilation toolchain, everything seems to work.
> > > 
> > > I had some time to invest so I added back this change, in a way
> > > that
> > > works with cross compilation too. Given the series wasn't merged
> > > yet
> > > and there was a conflict I've done a v8 rather than a single
> > > separate
> > > patch, but it's independent from the rest.
> > > 
> > > More testing is of course welcome!
> > 
> > I still see the same error when cross-compiling:
> > 
> > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > 
> Can patches 1-5 be merged anyway, leaving 6 for later?
> 
> /Bruce

Yes please...

Thomas, could you please give me detailed instructions on how to repro?
I used the bootlin toolchain you linked me last time, and passed --
cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and everything
built fine both with and without an arm64 build of libpcap in the
sysroot. With the previous version that I removed it would fail. Not
sure what I'm missing!
Thomas Monjalon Feb. 27, 2019, 10:56 a.m. UTC | #5
27/02/2019 11:50, Luca Boccassi:
> On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > 26/02/2019 18:49, Luca Boccassi:
> > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com wrote:
> > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > 
> > > > > pcap has historically shipped a custom pcap-config binary tool
> > > > > which
> > > > > does the job of pkg-config. It was never compatible with cross
> > > > > compilation.
> > > > > Meson uses it when using dependency(), which then means cross
> > > > > compilation fails.
> > > > > Set pcap-config to empty in the meson cross compilation files
> > > > > so
> > > > > that Meson will not use it, and add a fallback in case
> > > > > dependency() fails.
> > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > will
> > > > > work out of the box in the future.
> > > > > 
> > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > ---
> > > > > v8: added back pcap change separately. Tested with bootlin
> > > > >     cross-compilation toolchain, everything seems to work.
> > > > 
> > > > I had some time to invest so I added back this change, in a way
> > > > that
> > > > works with cross compilation too. Given the series wasn't merged
> > > > yet
> > > > and there was a conflict I've done a v8 rather than a single
> > > > separate
> > > > patch, but it's independent from the rest.
> > > > 
> > > > More testing is of course welcome!
> > > 
> > > I still see the same error when cross-compiling:
> > > 
> > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > 
> > Can patches 1-5 be merged anyway, leaving 6 for later?
> > 
> > /Bruce
> 
> Yes please...

Yes, sure. I am checking other patches to push them.

> Thomas, could you please give me detailed instructions on how to repro?
> I used the bootlin toolchain you linked me last time, and passed --
> cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and everything
> built fine both with and without an arm64 build of libpcap in the
> sysroot. With the previous version that I removed it would fail. Not
> sure what I'm missing!

I'm running devtools/test-meson-builds.sh on my ArchLinux which has
aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
Luca Boccassi Feb. 27, 2019, 12:03 p.m. UTC | #6
On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> 27/02/2019 11:50, Luca Boccassi:
> > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > wrote:
> > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > 
> > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > tool
> > > > > > which
> > > > > > does the job of pkg-config. It was never compatible with
> > > > > > cross
> > > > > > compilation.
> > > > > > Meson uses it when using dependency(), which then means
> > > > > > cross
> > > > > > compilation fails.
> > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > files
> > > > > > so
> > > > > > that Meson will not use it, and add a fallback in case
> > > > > > dependency() fails.
> > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > will
> > > > > > work out of the box in the future.
> > > > > > 
> > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > ---
> > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > 
> > > > > I had some time to invest so I added back this change, in a
> > > > > way
> > > > > that
> > > > > works with cross compilation too. Given the series wasn't
> > > > > merged
> > > > > yet
> > > > > and there was a conflict I've done a v8 rather than a single
> > > > > separate
> > > > > patch, but it's independent from the rest.
> > > > > 
> > > > > More testing is of course welcome!
> > > > 
> > > > I still see the same error when cross-compiling:
> > > > 
> > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > 
> > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > 
> > > /Bruce
> > 
> > Yes please...
> 
> Yes, sure. I am checking other patches to push them.

Thanks!

> > Thomas, could you please give me detailed instructions on how to
> > repro?
> > I used the bootlin toolchain you linked me last time, and passed --
> > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > everything
> > built fine both with and without an arm64 build of libpcap in the
> > sysroot. With the previous version that I removed it would fail.
> > Not
> > sure what I'm missing!
> 
> I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.

The script is working fine too - I have the toolchain in /tmp so I
simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
fine including the arm targets.

The key part in the patch was adding pcap-config = '' to the various
arm configs, could you please double check that it was applied
correctly? Without that, Meson finds and calls the native pcap-config
which gives wrong (native) flags and causes the errors you are seeing.
Otherwise I'm a bit lost, I can't understand why it's all working here
and not there.

meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
The Meson build system
Version: 0.49.2
Source dir: /home/bluca/git/dpdk
Build dir: /home/bluca/git/dpdk/build-arm64-armv8
Build type: cross build
Project name: DPDK
Project version: 19.05.0-rc0
Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
Host machine cpu family: aarch64
Host machine cpu: armv8-a
Target machine cpu family: aarch64
Target machine cpu: armv8-a
<...>
$ file build-arm64-armv8/lib/librte_eal.so.9.1 
build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
Bruce Richardson Feb. 27, 2019, 1:53 p.m. UTC | #7
On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > 27/02/2019 11:50, Luca Boccassi:
> > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > > wrote:
> > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > 
> > > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > > tool
> > > > > > > which
> > > > > > > does the job of pkg-config. It was never compatible with
> > > > > > > cross
> > > > > > > compilation.
> > > > > > > Meson uses it when using dependency(), which then means
> > > > > > > cross
> > > > > > > compilation fails.
> > > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > > files
> > > > > > > so
> > > > > > > that Meson will not use it, and add a fallback in case
> > > > > > > dependency() fails.
> > > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > > will
> > > > > > > work out of the box in the future.
> > > > > > > 
> > > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > ---
> > > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > > 
> > > > > > I had some time to invest so I added back this change, in a
> > > > > > way
> > > > > > that
> > > > > > works with cross compilation too. Given the series wasn't
> > > > > > merged
> > > > > > yet
> > > > > > and there was a conflict I've done a v8 rather than a single
> > > > > > separate
> > > > > > patch, but it's independent from the rest.
> > > > > > 
> > > > > > More testing is of course welcome!
> > > > > 
> > > > > I still see the same error when cross-compiling:
> > > > > 
> > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > 
> > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > 
> > > > /Bruce
> > > 
> > > Yes please...
> > 
> > Yes, sure. I am checking other patches to push them.
> 
> Thanks!
> 
> > > Thomas, could you please give me detailed instructions on how to
> > > repro?
> > > I used the bootlin toolchain you linked me last time, and passed --
> > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > > everything
> > > built fine both with and without an arm64 build of libpcap in the
> > > sysroot. With the previous version that I removed it would fail.
> > > Not
> > > sure what I'm missing!
> > 
> > I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> 
> The script is working fine too - I have the toolchain in /tmp so I
> simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
> fine including the arm targets.
> 
> The key part in the patch was adding pcap-config = '' to the various
> arm configs, could you please double check that it was applied
> correctly? Without that, Meson finds and calls the native pcap-config
> which gives wrong (native) flags and causes the errors you are seeing.
> Otherwise I'm a bit lost, I can't understand why it's all working here
> and not there.
> 
> meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> The Meson build system
> Version: 0.49.2
> Source dir: /home/bluca/git/dpdk
> Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> Build type: cross build
> Project name: DPDK
> Project version: 19.05.0-rc0
> Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
> Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> Host machine cpu family: aarch64
> Host machine cpu: armv8-a
> Target machine cpu family: aarch64
> Target machine cpu: armv8-a
> <...>
> $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
> 

I'm testing on Fedora 29 and this patch works fine with the cross-builds
too. Maybe it's something special in Arch Linux again. I'll trying testing
it out in an Arch VM - though sadly Arch linux is failing to update for me,
so I won't have exactly Thomas' setup.

/Bruce
Bruce Richardson Feb. 28, 2019, 5:40 p.m. UTC | #8
On Wed, Feb 27, 2019 at 01:53:32PM +0000, Bruce Richardson wrote:
> On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> > On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > > 27/02/2019 11:50, Luca Boccassi:
> > > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > > > wrote:
> > > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > 
> > > > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > > > tool
> > > > > > > > which
> > > > > > > > does the job of pkg-config. It was never compatible with
> > > > > > > > cross
> > > > > > > > compilation.
> > > > > > > > Meson uses it when using dependency(), which then means
> > > > > > > > cross
> > > > > > > > compilation fails.
> > > > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > > > files
> > > > > > > > so
> > > > > > > > that Meson will not use it, and add a fallback in case
> > > > > > > > dependency() fails.
> > > > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > > > will
> > > > > > > > work out of the box in the future.
> > > > > > > > 
> > > > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > ---
> > > > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > > > 
> > > > > > > I had some time to invest so I added back this change, in a
> > > > > > > way
> > > > > > > that
> > > > > > > works with cross compilation too. Given the series wasn't
> > > > > > > merged
> > > > > > > yet
> > > > > > > and there was a conflict I've done a v8 rather than a single
> > > > > > > separate
> > > > > > > patch, but it's independent from the rest.
> > > > > > > 
> > > > > > > More testing is of course welcome!
> > > > > > 
> > > > > > I still see the same error when cross-compiling:
> > > > > > 
> > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > 
> > > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > > 
> > > > > /Bruce
> > > > 
> > > > Yes please...
> > > 
> > > Yes, sure. I am checking other patches to push them.
> > 
> > Thanks!
> > 
> > > > Thomas, could you please give me detailed instructions on how to
> > > > repro?
> > > > I used the bootlin toolchain you linked me last time, and passed --
> > > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > > > everything
> > > > built fine both with and without an arm64 build of libpcap in the
> > > > sysroot. With the previous version that I removed it would fail.
> > > > Not
> > > > sure what I'm missing!
> > > 
> > > I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> > > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> > 
> > The script is working fine too - I have the toolchain in /tmp so I
> > simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
> > fine including the arm targets.
> > 
> > The key part in the patch was adding pcap-config = '' to the various
> > arm configs, could you please double check that it was applied
> > correctly? Without that, Meson finds and calls the native pcap-config
> > which gives wrong (native) flags and causes the errors you are seeing.
> > Otherwise I'm a bit lost, I can't understand why it's all working here
> > and not there.
> > 
> > meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> > The Meson build system
> > Version: 0.49.2
> > Source dir: /home/bluca/git/dpdk
> > Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> > Build type: cross build
> > Project name: DPDK
> > Project version: 19.05.0-rc0
> > Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
> > Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> > Host machine cpu family: aarch64
> > Host machine cpu: armv8-a
> > Target machine cpu family: aarch64
> > Target machine cpu: armv8-a
> > <...>
> > $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> > build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
> > 
> 
> I'm testing on Fedora 29 and this patch works fine with the cross-builds
> too. Maybe it's something special in Arch Linux again. I'll trying testing
> it out in an Arch VM - though sadly Arch linux is failing to update for me,
> so I won't have exactly Thomas' setup.
> 

I've also run this on Arch with the cross compiler installed and see no
issues. Thomas, can you look at the log below and see what differs from
your setup?

/Bruce

meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_thunderx_linuxapp_gcc /home/bruce/dpdk/devtools/.. build-arm64-thunderx
The Meson build system
Version: 0.49.2
Source dir: /home/bruce/dpdk
Build dir: /home/bruce/dpdk/build-arm64-thunderx
Build type: cross build
Project name: DPDK
Project version: 19.05.0-rc0
Native C compiler: gcc (gcc 8.2.1 "gcc (GCC) 8.2.1 20181127")
Cross C compiler: aarch64-linux-gnu-gcc (gcc 8.2.1)
Host machine cpu family: aarch64
Host machine cpu: armv8-a
Target machine cpu family: aarch64
Target machine cpu: armv8-a
Build machine cpu family: x86_64
Build machine cpu: x86_64
Checking for size of "void *" : 8
Library numa found: NO
Cross dependency libbsd found: NO (tried pkgconfig and cmake)
Compiler for C supports arguments -Wsign-compare: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wno-address-of-packed-member -Waddress-of-packed-member: NO
Message: Implementer : Cavium
Message: ['-march=armv8-a+crc+crypto', '-mcpu=thunderx']
Fetching value of define "__ARM_NEON" : 1
Fetching value of define "__ARM_FEATURE_CRC32" : 1
Fetching value of define "__ARM_FEATURE_CRYPTO" : 1
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Has header "linux/userfaultfd.h" : YES
Cross dependency libelf found: NO (tried pkgconfig and cmake)
Cross dependency jansson found: NO (tried pkgconfig and cmake)
Program gen-pmdinfo-cfile.sh found: YES (/home/bruce/dpdk/buildtools/gen-pmdinfo-cfile.sh)
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Library libmusdk found: NO
Compiler for C supports arguments -Wno-cast-qual -Wcast-qual: YES
Compiler for C supports arguments -Wno-pointer-to-int-cast -Wpointer-to-int-cast: YES
Cross dependency zlib found: NO (tried pkgconfig and cmake)
Compiler for C supports arguments -Wno-uninitialized -Wuninitialized: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-misleading-indentation -Wmisleading-indentation: YES
Compiler for C supports arguments -Wno-implicit-fallthrough -Wimplicit-fallthrough: YES
Compiler for C supports arguments -mavx2: NO
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-format-extra-args -Wformat-extra-args: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-missing-field-initializers -Wmissing-field-initializers: YES
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-format -Wformat: YES
Compiler for C supports arguments -Wno-error=format-security -Werror=format-security: NO
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Cross dependency libmnl found: NO (tried pkgconfig and cmake)
Cross dependency libmlx4 found: NO (tried pkgconfig and cmake)
Cross dependency libibverbs found: NO (tried pkgconfig and cmake)
Cross dependency libmnl found: NO (tried pkgconfig and cmake)
Cross dependency libmlx5 found: NO (tried pkgconfig and cmake)
Cross dependency libibverbs found: NO (tried pkgconfig and cmake)
Library libmusdk found: NO
Library libmusdk found: NO
Found pcap-config None NO
Cross dependency pcap found: NO (tried pkgconfig and config-tool)
Library pcap found: NO
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-missing-prototypes -Wmissing-prototypes: YES
Compiler for C supports arguments -Wno-cast-qual -Wcast-qual: YES
Compiler for C supports arguments -Wno-unused-function -Wunused-function: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-missing-prototypes -Wmissing-prototypes: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-format-nonliteral -Wformat-nonliteral: YES
Compiler for C supports arguments -Wno-shift-negative-value -Wshift-negative-value: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wno-missing-declarations -Wmissing-declarations: YES
Compiler for C supports arguments -Wno-maybe-uninitialized -Wmaybe-uninitialized: YES
Compiler for C supports arguments -Wno-strict-prototypes -Wstrict-prototypes: YES
Compiler for C supports arguments -Wno-shift-negative-value -Wshift-negative-value: YES
Compiler for C supports arguments -Wno-implicit-fallthrough -Wimplicit-fallthrough: YES
Compiler for C supports arguments -Wno-format-extra-args -Wformat-extra-args: YES
Compiler for C supports arguments -Wno-visibility -Wvisibility: NO
Compiler for C supports arguments -Wno-empty-body -Wempty-body: YES
Compiler for C supports arguments -Wno-invalid-source-encoding -Winvalid-source-encoding: NO
Compiler for C supports arguments -Wno-sometimes-uninitialized -Wsometimes-uninitialized: NO
Compiler for C supports arguments -Wno-pointer-bool-conversion -Wpointer-bool-conversion: NO
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wextra: YES
Compiler for C supports arguments -Wdisabled-optimization: YES
Compiler for C supports arguments -Waggregate-return: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wbad-function-cast: YES
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-variable -Wunused-variable: YES
Compiler for C supports arguments -Wno-empty-body -Wempty-body: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Library sze2 found: NO
Header <linux/pkt_cls.h> has symbol "TCA_FLOWER_UNSPEC" : YES
Header <linux/pkt_cls.h> has symbol "TCA_FLOWER_KEY_VLAN_PRIO" : YES
Header <linux/pkt_cls.h> has symbol "TCA_BPF_UNSPEC" : YES
Header <linux/pkt_cls.h> has symbol "TCA_BPF_FD" : YES
Header <linux/tc_act/tc_bpf.h> has symbol "TCA_ACT_BPF_UNSPEC" : YES
Header <linux/tc_act/tc_bpf.h> has symbol "TCA_ACT_BPF_FD" : YES
Configuring tap_autoconf.h using configuration
Compiler for C supports arguments -fno-prefetch-loop-arrays: YES
Compiler for C supports arguments -Wno-maybe-uninitialized -Wmaybe-uninitialized: YES
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wextra: YES
Compiler for C supports arguments -D_BSD_SOURCE: YES
Compiler for C supports arguments -D_DEFAULT_SOURCE: YES
Compiler for C supports arguments -D_XOPEN_SOURCE=600: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-format-extra-args -Wformat-extra-args: YES
Library IPSec_MB found: NO
Library IPSec_MB found: NO
Cross dependency libcrypto found: NO (tried pkgconfig and cmake)
Library libsso_kasumi found: NO
Library libmusdk found: NO
Cross dependency libcrypto found: NO (tried pkgconfig and cmake)
Cross dependency libcrypto found: NO (tried pkgconfig and cmake)
Library libsso_zuc found: NO
Cross dependency libisal found: NO (tried pkgconfig and cmake)
Cross dependency zlib found: NO (tried pkgconfig and cmake)
Compiler for C supports arguments -Wno-sign-compare -Wsign-compare: YES
Compiler for C supports arguments -Wno-unused-value -Wunused-value: YES
Compiler for C supports arguments -Wno-format -Wformat: YES
Compiler for C supports arguments -Wno-error=format-security -Werror=format-security: NO
Compiler for C supports arguments -Wno-strict-aliasing -Wstrict-aliasing: YES
Compiler for C supports arguments -Wno-unused-but-set-variable -Wunused-but-set-variable: YES
Library execinfo found: NO
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Cross dependency zlib found: NO (tried pkgconfig and cmake)
Library execinfo found: NO
Program doxygen found: NO
Program sphinx-build found: NO
Library execinfo found: NO
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES
Message: Skipping example "bpf"
Message: Skipping example "ethtool"
Has header "sys/epoll.h" : YES
Library pqos found: NO
Message: Skipping example "l2fwd-cat"
Library rt found: YES
Message: Skipping example "multi_process"
Message: Skipping example "netmap_compat"
Message: Skipping example "performance-thread"
Message: Skipping example "quota_watermark"
Message: Skipping example "server_node_efd"
Has header "virtio_scsi.h" : NO
Message: Skipping example "vhost_scsi"
Library virt found: NO
Cross dependency jansson found: NO (tried pkgconfig and cmake)
Message: Skipping example "vm_power_manager"
kernel/linux/meson.build:13: WARNING: Need "kernel_dir" option for kmod compilation when cross-compiling
Configuring rte_build_config.h using configuration
Program buildtools/symlink-drivers-solibs.sh found: YES (/bin/sh /home/bruce/dpdk/buildtools/symlink-drivers-solibs.sh)
Message: 
=================
Libraries Enabled
=================

libs:
	kvargs, eal, cmdline, ring, mempool, mbuf, net, meter, 
	ethdev, pci, metrics, hash, timer, acl, bbdev, bitratestats, 
	cfgfile, compressdev, cryptodev, distributor, efd, eventdev, gro, gso, 
	ip_frag, jobstats, kni, latencystats, lpm, member, power, pdump, 
	rawdev, reorder, sched, security, vhost, ipsec, port, table, 
	pipeline, flow_classify, bpf, 

Message: 
===============
Drivers Enabled
===============

common:
	cpt, dpaax, octeontx, 
bus:
	dpaa, fslmc, ifpga, pci, vdev, vmbus, 
mempool:
	bucket, dpaa, dpaa2, octeontx, ring, stack, 
net:
	af_packet, ark, atlantic, avf, avp, axgbe, bond, bnxt, 
	cxgbe, dpaa, dpaa2, e1000, ena, enetc, enic, failsafe, 
	fm10k, i40e, ice, ifc, ixgbe, kni, liquidio, netvsc, 
	nfp, null, octeontx, qede, ring, softnic, tap, thunderx, 
	vdev_netvsc, vhost, virtio, vmxnet3, 
crypto:
	caam_jr, dpaa_sec, dpaa2_sec, null_crypto, octeontx_crypto, crypto_scheduler, virtio_crypto, 
compress:
	octeontx_compress, qat, 
event:
	dpaa, dpaa2, octeontx, opdl, skeleton, sw, dsw, 
baseband:
	bbdev_null, 
raw:
	skeleton_rawdev, dpaa2_cmdif, dpaa2_qdma, ifpga_rawdev, 

Build targets in project: 437
Option default_library is: shared [default: static]
Found ninja-1.9.0 at /usr/bin/ninja
ninja -C build-arm64-thunderx
ninja: Entering directory `build-arm64-thunderx'
[1486/1486] Linking target examples/dpdk-load_balancer.
[0]
bruce@arch-vm:~/dpdk%
Thomas Monjalon March 1, 2019, 1:13 p.m. UTC | #9
28/02/2019 18:40, Bruce Richardson:
> On Wed, Feb 27, 2019 at 01:53:32PM +0000, Bruce Richardson wrote:
> > On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> > > On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > > > 27/02/2019 11:50, Luca Boccassi:
> > > > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon wrote:
> > > > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > > > On Tue, 2019-02-26 at 17:46 +0000, luca.boccassi@gmail.com
> > > > > > > > wrote:
> > > > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > > 
> > > > > > > > > pcap has historically shipped a custom pcap-config binary
> > > > > > > > > tool
> > > > > > > > > which
> > > > > > > > > does the job of pkg-config. It was never compatible with
> > > > > > > > > cross
> > > > > > > > > compilation.
> > > > > > > > > Meson uses it when using dependency(), which then means
> > > > > > > > > cross
> > > > > > > > > compilation fails.
> > > > > > > > > Set pcap-config to empty in the meson cross compilation
> > > > > > > > > files
> > > > > > > > > so
> > > > > > > > > that Meson will not use it, and add a fallback in case
> > > > > > > > > dependency() fails.
> > > > > > > > > libpcap 1.9.0 finally ships a pkg-config file so everything
> > > > > > > > > will
> > > > > > > > > work out of the box in the future.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > > ---
> > > > > > > > > v8: added back pcap change separately. Tested with bootlin
> > > > > > > > >     cross-compilation toolchain, everything seems to work.
> > > > > > > > 
> > > > > > > > I had some time to invest so I added back this change, in a
> > > > > > > > way
> > > > > > > > that
> > > > > > > > works with cross compilation too. Given the series wasn't
> > > > > > > > merged
> > > > > > > > yet
> > > > > > > > and there was a conflict I've done a v8 rather than a single
> > > > > > > > separate
> > > > > > > > patch, but it's independent from the rest.
> > > > > > > > 
> > > > > > > > More testing is of course welcome!
> > > > > > > 
> > > > > > > I still see the same error when cross-compiling:
> > > > > > > 
> > > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > > 
> > > > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > > > 
> > > > > > /Bruce
> > > > > 
> > > > > Yes please...
> > > > 
> > > > Yes, sure. I am checking other patches to push them.
> > > 
> > > Thanks!
> > > 
> > > > > Thomas, could you please give me detailed instructions on how to
> > > > > repro?
> > > > > I used the bootlin toolchain you linked me last time, and passed --
> > > > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson, and
> > > > > everything
> > > > > built fine both with and without an arm64 build of libpcap in the
> > > > > sysroot. With the previous version that I removed it would fail.
> > > > > Not
> > > > > sure what I'm missing!
> > > > 
> > > > I'm running devtools/test-meson-builds.sh on my ArchLinux which has
> > > > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> > > 
> > > The script is working fine too - I have the toolchain in /tmp so I
> > > simply run it with PATH=/tmp/toolchain/bin:$PATH and everything built
> > > fine including the arm targets.
> > > 
> > > The key part in the patch was adding pcap-config = '' to the various
> > > arm configs, could you please double check that it was applied
> > > correctly? Without that, Meson finds and calls the native pcap-config
> > > which gives wrong (native) flags and causes the errors you are seeing.
> > > Otherwise I'm a bit lost, I can't understand why it's all working here
> > > and not there.
> > > 
> > > meson --werror -Dexamples=all --default-library=shared --cross-file config/arm/arm64_armv8_linuxapp_gcc /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> > > The Meson build system
> > > Version: 0.49.2
> > > Source dir: /home/bluca/git/dpdk
> > > Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> > > Build type: cross build
> > > Project name: DPDK
> > > Project version: 19.05.0-rc0
> > > Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 8.2.0")
> > > Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> > > Host machine cpu family: aarch64
> > > Host machine cpu: armv8-a
> > > Target machine cpu family: aarch64
> > > Target machine cpu: armv8-a
> > > <...>
> > > $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> > > build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
> > > 
> > 
> > I'm testing on Fedora 29 and this patch works fine with the cross-builds
> > too. Maybe it's something special in Arch Linux again. I'll trying testing
> > it out in an Arch VM - though sadly Arch linux is failing to update for me,
> > so I won't have exactly Thomas' setup.
> 
> I've also run this on Arch with the cross compiler installed and see no
> issues. Thomas, can you look at the log below and see what differs from
> your setup?

I'm sorry for the noise.
It compiles fine after cleaning the build directory :/
Thomas Monjalon March 1, 2019, 1:22 p.m. UTC | #10
26/02/2019 18:46, luca.boccassi@gmail.com:
> From: Luca Boccassi <luca.boccassi@microsoft.com>
> 
> pcap has historically shipped a custom pcap-config binary tool which
> does the job of pkg-config. It was never compatible with cross
> compilation.
> Meson uses it when using dependency(), which then means cross
> compilation fails.
> Set pcap-config to empty in the meson cross compilation files so
> that Meson will not use it, and add a fallback in case
> dependency() fails.
> libpcap 1.9.0 finally ships a pkg-config file so everything will
> work out of the box in the future.
> 
> Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> ---
> v8: added back pcap change separately. Tested with bootlin
>     cross-compilation toolchain, everything seems to work.

Applied separately of the rest, because I initially thought
there was an issue, but it appears to be a transient issue
solved by cleaning the build directory.
Thanks Luca.
Luca Boccassi March 1, 2019, 3:13 p.m. UTC | #11
On Fri, 2019-03-01 at 14:13 +0100, Thomas Monjalon wrote:
> 28/02/2019 18:40, Bruce Richardson:
> > On Wed, Feb 27, 2019 at 01:53:32PM +0000, Bruce Richardson wrote:
> > > On Wed, Feb 27, 2019 at 12:03:48PM +0000, Luca Boccassi wrote:
> > > > On Wed, 2019-02-27 at 11:56 +0100, Thomas Monjalon wrote:
> > > > > 27/02/2019 11:50, Luca Boccassi:
> > > > > > On Wed, 2019-02-27 at 09:47 +0000, Bruce Richardson wrote:
> > > > > > > On Wed, Feb 27, 2019 at 09:33:12AM +0100, Thomas Monjalon
> > > > > > > wrote:
> > > > > > > > 26/02/2019 18:49, Luca Boccassi:
> > > > > > > > > On Tue, 2019-02-26 at 17:46 +0000, 
> > > > > > > > > luca.boccassi@gmail.com
> > > > > > > > > wrote:
> > > > > > > > > > From: Luca Boccassi <luca.boccassi@microsoft.com>
> > > > > > > > > > 
> > > > > > > > > > pcap has historically shipped a custom pcap-config
> > > > > > > > > > binary
> > > > > > > > > > tool
> > > > > > > > > > which
> > > > > > > > > > does the job of pkg-config. It was never compatible
> > > > > > > > > > with
> > > > > > > > > > cross
> > > > > > > > > > compilation.
> > > > > > > > > > Meson uses it when using dependency(), which then
> > > > > > > > > > means
> > > > > > > > > > cross
> > > > > > > > > > compilation fails.
> > > > > > > > > > Set pcap-config to empty in the meson cross
> > > > > > > > > > compilation
> > > > > > > > > > files
> > > > > > > > > > so
> > > > > > > > > > that Meson will not use it, and add a fallback in
> > > > > > > > > > case
> > > > > > > > > > dependency() fails.
> > > > > > > > > > libpcap 1.9.0 finally ships a pkg-config file so
> > > > > > > > > > everything
> > > > > > > > > > will
> > > > > > > > > > work out of the box in the future.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Luca Boccassi <
> > > > > > > > > > luca.boccassi@microsoft.com>
> > > > > > > > > > ---
> > > > > > > > > > v8: added back pcap change separately. Tested with
> > > > > > > > > > bootlin
> > > > > > > > > >     cross-compilation toolchain, everything seems
> > > > > > > > > > to work.
> > > > > > > > > 
> > > > > > > > > I had some time to invest so I added back this
> > > > > > > > > change, in a
> > > > > > > > > way
> > > > > > > > > that
> > > > > > > > > works with cross compilation too. Given the series
> > > > > > > > > wasn't
> > > > > > > > > merged
> > > > > > > > > yet
> > > > > > > > > and there was a conflict I've done a v8 rather than a
> > > > > > > > > single
> > > > > > > > > separate
> > > > > > > > > patch, but it's independent from the rest.
> > > > > > > > > 
> > > > > > > > > More testing is of course welcome!
> > > > > > > > 
> > > > > > > > I still see the same error when cross-compiling:
> > > > > > > > 
> > > > > > > > /usr/include/stdint.h:109: error: "__INT64_C" redefined
> > > > > > > > 
> > > > > > > Can patches 1-5 be merged anyway, leaving 6 for later?
> > > > > > > 
> > > > > > > /Bruce
> > > > > > 
> > > > > > Yes please...
> > > > > 
> > > > > Yes, sure. I am checking other patches to push them.
> > > > 
> > > > Thanks!
> > > > 
> > > > > > Thomas, could you please give me detailed instructions on
> > > > > > how to
> > > > > > repro?
> > > > > > I used the bootlin toolchain you linked me last time, and
> > > > > > passed --
> > > > > > cross-file config/arm/arm64_armv8_linuxapp_gcc to Meson,
> > > > > > and
> > > > > > everything
> > > > > > built fine both with and without an arm64 build of libpcap
> > > > > > in the
> > > > > > sysroot. With the previous version that I removed it would
> > > > > > fail.
> > > > > > Not
> > > > > > sure what I'm missing!
> > > > > 
> > > > > I'm running devtools/test-meson-builds.sh on my ArchLinux
> > > > > which has
> > > > > aarch64-linux-gnu-gcc 8.2.0 but no arm pcap I guess.
> > > > 
> > > > The script is working fine too - I have the toolchain in /tmp
> > > > so I
> > > > simply run it with PATH=/tmp/toolchain/bin:$PATH and everything
> > > > built
> > > > fine including the arm targets.
> > > > 
> > > > The key part in the patch was adding pcap-config = '' to the
> > > > various
> > > > arm configs, could you please double check that it was applied
> > > > correctly? Without that, Meson finds and calls the native pcap-
> > > > config
> > > > which gives wrong (native) flags and causes the errors you are
> > > > seeing.
> > > > Otherwise I'm a bit lost, I can't understand why it's all
> > > > working here
> > > > and not there.
> > > > 
> > > > meson --werror -Dexamples=all --default-library=shared --cross-
> > > > file config/arm/arm64_armv8_linuxapp_gcc
> > > > /home/bluca/git/dpdk/devtools/.. build-arm64-armv8
> > > > The Meson build system
> > > > Version: 0.49.2
> > > > Source dir: /home/bluca/git/dpdk
> > > > Build dir: /home/bluca/git/dpdk/build-arm64-armv8
> > > > Build type: cross build
> > > > Project name: DPDK
> > > > Project version: 19.05.0-rc0
> > > > Native C compiler: ccache gcc (gcc 8.2.0 "gcc (Debian 8.2.0-21) 
> > > > 8.2.0")
> > > > Cross C compiler: aarch64-linux-gnu-gcc (gcc 7.3.0)
> > > > Host machine cpu family: aarch64
> > > > Host machine cpu: armv8-a
> > > > Target machine cpu family: aarch64
> > > > Target machine cpu: armv8-a
> > > > <...>
> > > > $ file build-arm64-armv8/lib/librte_eal.so.9.1 
> > > > build-arm64-armv8/lib/librte_eal.so.9.1: ELF 64-bit LSB pie
> > > > executable, ARM aarch64, version 1 (SYSV), dynamically linked,
> > > > not stripped
> > > > 
> > > 
> > > I'm testing on Fedora 29 and this patch works fine with the
> > > cross-builds
> > > too. Maybe it's something special in Arch Linux again. I'll
> > > trying testing
> > > it out in an Arch VM - though sadly Arch linux is failing to
> > > update for me,
> > > so I won't have exactly Thomas' setup.
> > 
> > I've also run this on Arch with the cross compiler installed and
> > see no
> > issues. Thomas, can you look at the log below and see what differs
> > from
> > your setup?
> 
> I'm sorry for the noise.
> It compiles fine after cleaning the build directory :/

No worries, thanks for checking again!

Patch
diff mbox series

diff --git a/config/arm/arm64_armv8_linuxapp_gcc b/config/arm/arm64_armv8_linuxapp_gcc
index 987c02fbb..513760917 100644
--- a/config/arm/arm64_armv8_linuxapp_gcc
+++ b/config/arm/arm64_armv8_linuxapp_gcc
@@ -3,6 +3,7 @@  c = 'aarch64-linux-gnu-gcc'
 cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/config/arm/arm64_dpaa2_linuxapp_gcc b/config/arm/arm64_dpaa2_linuxapp_gcc
index 7ec74ec4b..0df8c8f7d 100644
--- a/config/arm/arm64_dpaa2_linuxapp_gcc
+++ b/config/arm/arm64_dpaa2_linuxapp_gcc
@@ -4,6 +4,7 @@  cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-ar'
 as = 'aarch64-linux-gnu-as'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/config/arm/arm64_dpaa_linuxapp_gcc b/config/arm/arm64_dpaa_linuxapp_gcc
index 73a8f0b81..f4b85a84b 100644
--- a/config/arm/arm64_dpaa_linuxapp_gcc
+++ b/config/arm/arm64_dpaa_linuxapp_gcc
@@ -4,6 +4,7 @@  cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-ar'
 as = 'aarch64-linux-gnu-as'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc
index 967d9d46d..14b801998 100644
--- a/config/arm/arm64_thunderx_linuxapp_gcc
+++ b/config/arm/arm64_thunderx_linuxapp_gcc
@@ -3,6 +3,7 @@  c = 'aarch64-linux-gnu-gcc'
 cpp = 'aarch64-linux-gnu-cpp'
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
+pcap-config = ''
 
 [host_machine]
 system = 'linux'
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 0c4e0201a..2c2fd11e4 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -1,12 +1,20 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-pcap_dep = cc.find_library('pcap', required: false)
-if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found()
 	build = true
 else
-	build = false
+	# pcap got a pkg-config file only in 1.9.0 and before that meson uses
+	# an internal pcap-config finder, which is not compatible with
+	# cross-compilation, so try to fallback to find_library
+	pcap_dep = cc.find_library('pcap', required: false)
+	if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
+		build = true
+		pkgconfig_extra_libs += '-lpcap'
+	else
+		build = false
+	endif
 endif
 sources = files('rte_eth_pcap.c')
 ext_deps += pcap_dep
-pkgconfig_extra_libs += '-lpcap'