DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] meson: wrong dependency in cross compilation on ARM
@ 2020-12-21 12:19 Hemant Agrawal
  2020-12-21 14:04 ` Bruce Richardson
  0 siblings, 1 reply; 13+ messages in thread
From: Hemant Agrawal @ 2020-12-21 12:19 UTC (permalink / raw)
  To: dev

Hi,
                I am trying to cross compile DPDK for arm64 on a ubuntu machine, which has a zlib pre-installed for native env.

I am encountering following build error in net_bnx2x as it has dependency on zlib.  It is trying to link with x86 arch based zlib.

Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, Is their an easy way to disable these dependencies?



b10814@dpdk-xeon:~/dpdk-up$ meson arm-build --cross-file config/arm/arm64_armv8_linux_gcc
Configuration found that :
Run-time dependency zlib found: YES 1.2.11
(NOTE: it seems meson is detecting the default x86 based zlib for linking)

Note that this machine has ARM tool chain installed by Ubuntu
sudo apt-get install gcc-aarch64-linux-gnu

b10814@dpdk-xeon:~/dpdk-up$ ninja -C arm-build
ninja: Entering directory `arm-build'
[1289/2375] Linking target drivers/librte_net_bnx2x.so.21.1
FAILED: drivers/librte_net_bnx2x.so.21.1
aarch64-linux-gnu-gcc  -o drivers/librte_net_bnx2x.so.21.1 drivers/librte_net_bnx2x.so.21.1.p/meson-generated_.._rte_net_bnx2x.pmd.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x_ethdev.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x_rxtx.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x_stats.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x_vfpf.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_ecore_sp.c.o drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_elink.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librte_net_bnx2x.so.21 -Wl,--no-as-needed -pthread -lm -ldl lib/librte_ethdev.so.21.1 lib/librte_eal.so.21.1 lib/librte_kvargs.so.21.1 lib/librte_telemetry.so.21.1 lib/librte_net.so.21.1 lib/librte_mbuf.so.21.1 lib/librte_mempool.so.21.1 lib/librte_ring.so.21.1 lib/librte_meter.so.21.1 drivers/librte_bus_pci.so.21.1 lib/librte_pci.so.21.1 drivers/librte_bus_vdev.so.21.1 -Wl,--version-script=/home/b10814/dpdk-up/drivers/net/bnx2x/version.map /usr/lib/x86_64-linux-gnu/libz.so -Wl,--end-group '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/' -Wl,-rpath-link,/home/b10814/dpdk-up/arm-build/lib -Wl,-rpath-link,/home/b10814/dpdk-up/arm-build/drivers
/usr/lib/x86_64-linux-gnu/libz.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
[1314/2375] Compiling C object drivers/net/ice/base/libice_base.a.p/ice_switch.c.o
ninja: build stopped: subcommand failed.


Regards,
Hemant


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2020-12-21 12:19 [dpdk-dev] meson: wrong dependency in cross compilation on ARM Hemant Agrawal
@ 2020-12-21 14:04 ` Bruce Richardson
  2020-12-21 14:28   ` Hemant Agrawal
  2021-01-15 18:40   ` Ferruh Yigit
  0 siblings, 2 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-12-21 14:04 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev

On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> Hi,
>                 I am trying to cross compile DPDK for arm64 on a ubuntu machine, which has a zlib pre-installed for native env.
> 
> I am encountering following build error in net_bnx2x as it has dependency on zlib.  It is trying to link with x86 arch based zlib.
> 
> Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, Is their an easy way to disable these dependencies?
> 
Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
PKG_CONFIG_PATH simply extends the search locations, which means that
host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
default path, eliminating the host-based search paths.

/Bruce

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2020-12-21 14:04 ` Bruce Richardson
@ 2020-12-21 14:28   ` Hemant Agrawal
  2020-12-21 14:47     ` Bruce Richardson
  2021-01-22 10:20     ` Juraj Linkeš
  2021-01-15 18:40   ` Ferruh Yigit
  1 sibling, 2 replies; 13+ messages in thread
From: Hemant Agrawal @ 2020-12-21 14:28 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Bruce Richardson
> 
> On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> > Hi,
> >                 I am trying to cross compile DPDK for arm64 on a ubuntu machine,
> which has a zlib pre-installed for native env.
> >
> > I am encountering following build error in net_bnx2x as it has dependency
> on zlib.  It is trying to link with x86 arch based zlib.
> >
> > Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue.
> But, Is their an easy way to disable these dependencies?
> >
> Can you try with setting PKG_CONFIG_LIBDIR rather than
> PKG_CONFIG_PATH?
> PKG_CONFIG_PATH simply extends the search locations, which means that
> host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
> default path, eliminating the host-based search paths.

[Hemant] I will try. 

Also, is there a way to disable certain drivers (e.g. bnx2x) and libraries (e.g. compress) in meson config file statically, so that they don't get build.
Using disable_driver options is still not working as the dpdk-test has dependency on zlib. 

> 
> /Bruce

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2020-12-21 14:28   ` Hemant Agrawal
@ 2020-12-21 14:47     ` Bruce Richardson
  2021-01-22 10:20     ` Juraj Linkeš
  1 sibling, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-12-21 14:47 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev

On Mon, Dec 21, 2020 at 02:28:42PM +0000, Hemant Agrawal wrote:
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Bruce Richardson
> > 
> > On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> > > Hi,
> > >                 I am trying to cross compile DPDK for arm64 on a ubuntu machine,
> > which has a zlib pre-installed for native env.
> > >
> > > I am encountering following build error in net_bnx2x as it has dependency
> > on zlib.  It is trying to link with x86 arch based zlib.
> > >
> > > Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue.
> > But, Is their an easy way to disable these dependencies?
> > >
> > Can you try with setting PKG_CONFIG_LIBDIR rather than
> > PKG_CONFIG_PATH?
> > PKG_CONFIG_PATH simply extends the search locations, which means that
> > host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
> > default path, eliminating the host-based search paths.
> 
> [Hemant] I will try. 
> 
> Also, is there a way to disable certain drivers (e.g. bnx2x) and libraries (e.g. compress) in meson config file statically, so that they don't get build.
> Using disable_driver options is still not working as the dpdk-test has dependency on zlib. 
> 
No support to disable libraries has been put in place yet, but the autotest
binary should be possible to disable using the "tests" build time option
(and as you already know individual drivers can be disabled too).
Setting PKG_CONFIG_LIBDIR to a new location should for all these cases
prevent detection of the host-installed zlib-dev package.

/Bruce

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2020-12-21 14:04 ` Bruce Richardson
  2020-12-21 14:28   ` Hemant Agrawal
@ 2021-01-15 18:40   ` Ferruh Yigit
  2021-01-18 10:51     ` Bruce Richardson
  1 sibling, 1 reply; 13+ messages in thread
From: Ferruh Yigit @ 2021-01-15 18:40 UTC (permalink / raw)
  To: Bruce Richardson, Hemant Agrawal, Akhil Goyal; +Cc: dev, David Marchand

On 12/21/2020 2:04 PM, Bruce Richardson wrote:
> On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
>> Hi,
>>                  I am trying to cross compile DPDK for arm64 on a ubuntu machine, which has a zlib pre-installed for native env.
>>
>> I am encountering following build error in net_bnx2x as it has dependency on zlib.  It is trying to link with x86 arch based zlib.
>>
>> Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, Is their an easy way to disable these dependencies?
>>
> Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
> PKG_CONFIG_PATH simply extends the search locations, which means that
> host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
> default path, eliminating the host-based search paths.
> 

The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil reported a 
32bit build error when zlib is missing, I can reproduce the same.

I have only 64bit version of the library:

$ pkg-config --path zlib
/usr/lib64/pkgconfig/zlib.pc

$ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
<no output>
$ echo $?
1

When I run the meson as following:
"PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32 
-Dc_link_args=-m32 -Dexamples=all build32"

It still detects the zlib:
Run-time dependency zlib found: YES 1.2.11

And build fails:
/usr/bin/ld: /usr/lib64/libz.so: error adding symbols: file in wrong format


If I install the 32 bit version of the zlib, everything works as expected:
$ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
/usr/lib/pkgconfig//zlib.pc


As far as I can see there is a meson 'pkg_config_libdir' property, putting it to 
the config/arm/arm64_* can solve the issue for arm, @Hemant can you please try it?
Some more details on:
github.com/mesonbuild/meson/blob/master/docs/markdown/Cross-compilation.md


But not sure how to solve issue for 32bit build, any idea?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-15 18:40   ` Ferruh Yigit
@ 2021-01-18 10:51     ` Bruce Richardson
  2021-01-18 11:58       ` Ferruh Yigit
  0 siblings, 1 reply; 13+ messages in thread
From: Bruce Richardson @ 2021-01-18 10:51 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand

On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
> On 12/21/2020 2:04 PM, Bruce Richardson wrote:
> > On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> > > Hi,
> > >                  I am trying to cross compile DPDK for arm64 on a ubuntu machine, which has a zlib pre-installed for native env.
> > > 
> > > I am encountering following build error in net_bnx2x as it has dependency on zlib.  It is trying to link with x86 arch based zlib.
> > > 
> > > Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, Is their an easy way to disable these dependencies?
> > > 
> > Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
> > PKG_CONFIG_PATH simply extends the search locations, which means that
> > host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
> > default path, eliminating the host-based search paths.
> > 
> 
> The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
> reported a 32bit build error when zlib is missing, I can reproduce the same.
> 
> I have only 64bit version of the library:
> 
> $ pkg-config --path zlib
> /usr/lib64/pkgconfig/zlib.pc
> 
> $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
> <no output>
> $ echo $?
> 1
> 
> When I run the meson as following:
> "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
> -Dc_link_args=-m32 -Dexamples=all build32"
> 
> It still detects the zlib:
> Run-time dependency zlib found: YES 1.2.11
> 

I've just tried this on my system and it works as expected: the 32-bit lib
is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR and it is
found, but linking fails due to "file in wrong format" errors, again as
expected.

In your case, I suspect it might be meson falling back to cmake in the
detection logic. If you have cmake installed on your system, can you
perhaps temporarily remove it, and retry the 32-bit build? If that is the
cause, we can modify the dependency call to add "method: 'pkg-config'" to
it, to force pkg-config searches only.

/Bruce

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-18 10:51     ` Bruce Richardson
@ 2021-01-18 11:58       ` Ferruh Yigit
  2021-01-18 12:05         ` Ferruh Yigit
  2021-01-18 13:28         ` Bruce Richardson
  0 siblings, 2 replies; 13+ messages in thread
From: Ferruh Yigit @ 2021-01-18 11:58 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand

On 1/18/2021 10:51 AM, Bruce Richardson wrote:
> On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
>> On 12/21/2020 2:04 PM, Bruce Richardson wrote:
>>> On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
>>>> Hi,
>>>>                   I am trying to cross compile DPDK for arm64 on a ubuntu machine, which has a zlib pre-installed for native env.
>>>>
>>>> I am encountering following build error in net_bnx2x as it has dependency on zlib.  It is trying to link with x86 arch based zlib.
>>>>
>>>> Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, Is their an easy way to disable these dependencies?
>>>>
>>> Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
>>> PKG_CONFIG_PATH simply extends the search locations, which means that
>>> host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
>>> default path, eliminating the host-based search paths.
>>>
>>
>> The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
>> reported a 32bit build error when zlib is missing, I can reproduce the same.
>>
>> I have only 64bit version of the library:
>>
>> $ pkg-config --path zlib
>> /usr/lib64/pkgconfig/zlib.pc
>>
>> $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
>> <no output>
>> $ echo $?
>> 1
>>
>> When I run the meson as following:
>> "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
>> -Dc_link_args=-m32 -Dexamples=all build32"
>>
>> It still detects the zlib:
>> Run-time dependency zlib found: YES 1.2.11
>>
> 
> I've just tried this on my system and it works as expected: the 32-bit lib
> is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR and it is
> found, but linking fails due to "file in wrong format" errors, again as
> expected.
> 
> In your case, I suspect it might be meson falling back to cmake in the
> detection logic. If you have cmake installed on your system, can you
> perhaps temporarily remove it, and retry the 32-bit build? If that is the
> cause, we can modify the dependency call to add "method: 'pkg-config'" to
> it, to force pkg-config searches only.
> 

Yes I have cmake, I will try without it.

Meanwhile I have Fedora, and it seems it is using different version of the 
pkg-config (pkgconf), not sure if this can be a problem.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-18 11:58       ` Ferruh Yigit
@ 2021-01-18 12:05         ` Ferruh Yigit
  2021-01-18 12:16           ` Ferruh Yigit
  2021-01-18 13:28         ` Bruce Richardson
  1 sibling, 1 reply; 13+ messages in thread
From: Ferruh Yigit @ 2021-01-18 12:05 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand

On 1/18/2021 11:58 AM, Ferruh Yigit wrote:
> On 1/18/2021 10:51 AM, Bruce Richardson wrote:
>> On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
>>> On 12/21/2020 2:04 PM, Bruce Richardson wrote:
>>>> On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
>>>>> Hi,
>>>>>                   I am trying to cross compile DPDK for arm64 on a ubuntu 
>>>>> machine, which has a zlib pre-installed for native env.
>>>>>
>>>>> I am encountering following build error in net_bnx2x as it has dependency 
>>>>> on zlib.  It is trying to link with x86 arch based zlib.
>>>>>
>>>>> Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, 
>>>>> Is their an easy way to disable these dependencies?
>>>>>
>>>> Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
>>>> PKG_CONFIG_PATH simply extends the search locations, which means that
>>>> host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
>>>> default path, eliminating the host-based search paths.
>>>>
>>>
>>> The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
>>> reported a 32bit build error when zlib is missing, I can reproduce the same.
>>>
>>> I have only 64bit version of the library:
>>>
>>> $ pkg-config --path zlib
>>> /usr/lib64/pkgconfig/zlib.pc
>>>
>>> $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
>>> <no output>
>>> $ echo $?
>>> 1
>>>
>>> When I run the meson as following:
>>> "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
>>> -Dc_link_args=-m32 -Dexamples=all build32"
>>>
>>> It still detects the zlib:
>>> Run-time dependency zlib found: YES 1.2.11
>>>
>>
>> I've just tried this on my system and it works as expected: the 32-bit lib
>> is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR and it is
>> found, but linking fails due to "file in wrong format" errors, again as
>> expected.
>>
>> In your case, I suspect it might be meson falling back to cmake in the
>> detection logic. If you have cmake installed on your system, can you
>> perhaps temporarily remove it, and retry the 32-bit build? If that is the
>> cause, we can modify the dependency call to add "method: 'pkg-config'" to
>> it, to force pkg-config searches only.
>>
> 
> Yes I have cmake, I will try without it.
> 
> Meanwhile I have Fedora, and it seems it is using different version of the 
> pkg-config (pkgconf), not sure if this can be a problem.
> 

I confirm removing the 'cmake' solved the issue, now I am getting:
"Run-time dependency zlib found: NO (tried pkgconfig and cmake)"

And zlib dependent modules not enabled, so build runs successfully.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-18 12:05         ` Ferruh Yigit
@ 2021-01-18 12:16           ` Ferruh Yigit
  2021-01-18 13:29             ` Bruce Richardson
  2021-01-22 12:47             ` Hemant Agrawal
  0 siblings, 2 replies; 13+ messages in thread
From: Ferruh Yigit @ 2021-01-18 12:16 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand

On 1/18/2021 12:05 PM, Ferruh Yigit wrote:
> On 1/18/2021 11:58 AM, Ferruh Yigit wrote:
>> On 1/18/2021 10:51 AM, Bruce Richardson wrote:
>>> On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
>>>> On 12/21/2020 2:04 PM, Bruce Richardson wrote:
>>>>> On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
>>>>>> Hi,
>>>>>>                   I am trying to cross compile DPDK for arm64 on a ubuntu 
>>>>>> machine, which has a zlib pre-installed for native env.
>>>>>>
>>>>>> I am encountering following build error in net_bnx2x as it has dependency 
>>>>>> on zlib.  It is trying to link with x86 arch based zlib.
>>>>>>
>>>>>> Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, 
>>>>>> Is their an easy way to disable these dependencies?
>>>>>>
>>>>> Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
>>>>> PKG_CONFIG_PATH simply extends the search locations, which means that
>>>>> host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
>>>>> default path, eliminating the host-based search paths.
>>>>>
>>>>
>>>> The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
>>>> reported a 32bit build error when zlib is missing, I can reproduce the same.
>>>>
>>>> I have only 64bit version of the library:
>>>>
>>>> $ pkg-config --path zlib
>>>> /usr/lib64/pkgconfig/zlib.pc
>>>>
>>>> $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
>>>> <no output>
>>>> $ echo $?
>>>> 1
>>>>
>>>> When I run the meson as following:
>>>> "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
>>>> -Dc_link_args=-m32 -Dexamples=all build32"
>>>>
>>>> It still detects the zlib:
>>>> Run-time dependency zlib found: YES 1.2.11
>>>>
>>>
>>> I've just tried this on my system and it works as expected: the 32-bit lib
>>> is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR and it is
>>> found, but linking fails due to "file in wrong format" errors, again as
>>> expected.
>>>
>>> In your case, I suspect it might be meson falling back to cmake in the
>>> detection logic. If you have cmake installed on your system, can you
>>> perhaps temporarily remove it, and retry the 32-bit build? If that is the
>>> cause, we can modify the dependency call to add "method: 'pkg-config'" to
>>> it, to force pkg-config searches only.
>>>
>>
>> Yes I have cmake, I will try without it.
>>
>> Meanwhile I have Fedora, and it seems it is using different version of the 
>> pkg-config (pkgconf), not sure if this can be a problem.
>>
> 
> I confirm removing the 'cmake' solved the issue, now I am getting:
> "Run-time dependency zlib found: NO (tried pkgconfig and cmake)"
> 
> And zlib dependent modules not enabled, so build runs successfully.

Following is fixing the problem [1], but isn't this a generic problem when 64bit 
version of a library installed but 32bit version of it is missing and 'cmake' 
exists?

Should all library discovery reduced to the 'pkg-config' only?



[1]
diff --git a/app/test/meson.build b/app/test/meson.build
index 94fd39fecb82..bdbc61947637 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -406,7 +406,7 @@ cflags += ['-DALLOW_INTERNAL_API']

  test_dep_objs = []
  if dpdk_conf.has('RTE_LIB_COMPRESSDEV')
-       compress_test_dep = dependency('zlib', required: false)
+       compress_test_dep = dependency('zlib', required: false, method: 
'pkg-config')
         if compress_test_dep.found()
                 test_dep_objs += compress_test_dep
                 test_sources += 'test_compressdev.c'
diff --git a/drivers/compress/zlib/meson.build b/drivers/compress/zlib/meson.build
index b19a6d2b161f..82cf0dddd649 100644
--- a/drivers/compress/zlib/meson.build
+++ b/drivers/compress/zlib/meson.build
@@ -1,7 +1,7 @@
  # SPDX-License-Identifier: BSD-3-Clause
  # Copyright(c) 2018 Cavium Networks

-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
  if not dep.found()
         build = false
         reason = 'missing dependency, "zlib"'
diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build
index 8837ef424760..e260b75926ec 100644
--- a/drivers/net/bnx2x/meson.build
+++ b/drivers/net/bnx2x/meson.build
@@ -7,7 +7,7 @@ if is_windows
         subdir_done()
  endif

-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
  build = dep.found()
  reason = 'missing dependency, "zlib"'
  ext_deps += dep

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-18 11:58       ` Ferruh Yigit
  2021-01-18 12:05         ` Ferruh Yigit
@ 2021-01-18 13:28         ` Bruce Richardson
  1 sibling, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2021-01-18 13:28 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand

On Mon, Jan 18, 2021 at 11:58:40AM +0000, Ferruh Yigit wrote:
> On 1/18/2021 10:51 AM, Bruce Richardson wrote:
> > On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
> > > On 12/21/2020 2:04 PM, Bruce Richardson wrote:
> > > > On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> > > > > Hi,
> > > > >                   I am trying to cross compile DPDK for arm64 on a ubuntu machine, which has a zlib pre-installed for native env.
> > > > > 
> > > > > I am encountering following build error in net_bnx2x as it has dependency on zlib.  It is trying to link with x86 arch based zlib.
> > > > > 
> > > > > Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue. But, Is their an easy way to disable these dependencies?
> > > > > 
> > > > Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
> > > > PKG_CONFIG_PATH simply extends the search locations, which means that
> > > > host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
> > > > default path, eliminating the host-based search paths.
> > > > 
> > > 
> > > The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
> > > reported a 32bit build error when zlib is missing, I can reproduce the same.
> > > 
> > > I have only 64bit version of the library:
> > > 
> > > $ pkg-config --path zlib
> > > /usr/lib64/pkgconfig/zlib.pc
> > > 
> > > $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
> > > <no output>
> > > $ echo $?
> > > 1
> > > 
> > > When I run the meson as following:
> > > "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
> > > -Dc_link_args=-m32 -Dexamples=all build32"
> > > 
> > > It still detects the zlib:
> > > Run-time dependency zlib found: YES 1.2.11
> > > 
> > 
> > I've just tried this on my system and it works as expected: the 32-bit lib
> > is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR and it is
> > found, but linking fails due to "file in wrong format" errors, again as
> > expected.
> > 
> > In your case, I suspect it might be meson falling back to cmake in the
> > detection logic. If you have cmake installed on your system, can you
> > perhaps temporarily remove it, and retry the 32-bit build? If that is the
> > cause, we can modify the dependency call to add "method: 'pkg-config'" to
> > it, to force pkg-config searches only.
> > 
> 
> Yes I have cmake, I will try without it.
> 
> Meanwhile I have Fedora, and it seems it is using different version of the
> pkg-config (pkgconf), not sure if this can be a problem.
>
pkgconf as pkg-config is fairly normal, and is not a problem.

I think I'll pre-emptively do up a patch to force pkg-config use for all
our dependency() calls. I believe that everything we call "dependency()"
for in meson supports pkg-config.

/Bruce

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-18 12:16           ` Ferruh Yigit
@ 2021-01-18 13:29             ` Bruce Richardson
  2021-01-22 12:47             ` Hemant Agrawal
  1 sibling, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2021-01-18 13:29 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand

On Mon, Jan 18, 2021 at 12:16:04PM +0000, Ferruh Yigit wrote:
> On 1/18/2021 12:05 PM, Ferruh Yigit wrote:
> > On 1/18/2021 11:58 AM, Ferruh Yigit wrote:
> > > On 1/18/2021 10:51 AM, Bruce Richardson wrote:
> > > > On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
> > > > > On 12/21/2020 2:04 PM, Bruce Richardson wrote:
> > > > > > On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> > > > > > > Hi,
> > > > > > >                   I am trying to cross compile DPDK
> > > > > > > for arm64 on a ubuntu machine, which has a zlib
> > > > > > > pre-installed for native env.
> > > > > > > 
> > > > > > > I am encountering following build error in net_bnx2x
> > > > > > > as it has dependency on zlib.  It is trying to link
> > > > > > > with x86 arch based zlib.
> > > > > > > 
> > > > > > > Cross compiling zlib and setting the PKG_CONFIG_PATH
> > > > > > > solve the issue. But, Is their an easy way to
> > > > > > > disable these dependencies?
> > > > > > > 
> > > > > > Can you try with setting PKG_CONFIG_LIBDIR rather than PKG_CONFIG_PATH?
> > > > > > PKG_CONFIG_PATH simply extends the search locations, which means that
> > > > > > host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces the
> > > > > > default path, eliminating the host-based search paths.
> > > > > > 
> > > > > 
> > > > > The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
> > > > > reported a 32bit build error when zlib is missing, I can reproduce the same.
> > > > > 
> > > > > I have only 64bit version of the library:
> > > > > 
> > > > > $ pkg-config --path zlib
> > > > > /usr/lib64/pkgconfig/zlib.pc
> > > > > 
> > > > > $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
> > > > > <no output>
> > > > > $ echo $?
> > > > > 1
> > > > > 
> > > > > When I run the meson as following:
> > > > > "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
> > > > > -Dc_link_args=-m32 -Dexamples=all build32"
> > > > > 
> > > > > It still detects the zlib:
> > > > > Run-time dependency zlib found: YES 1.2.11
> > > > > 
> > > > 
> > > > I've just tried this on my system and it works as expected: the 32-bit lib
> > > > is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR and it is
> > > > found, but linking fails due to "file in wrong format" errors, again as
> > > > expected.
> > > > 
> > > > In your case, I suspect it might be meson falling back to cmake in the
> > > > detection logic. If you have cmake installed on your system, can you
> > > > perhaps temporarily remove it, and retry the 32-bit build? If that is the
> > > > cause, we can modify the dependency call to add "method: 'pkg-config'" to
> > > > it, to force pkg-config searches only.
> > > > 
> > > 
> > > Yes I have cmake, I will try without it.
> > > 
> > > Meanwhile I have Fedora, and it seems it is using different version
> > > of the pkg-config (pkgconf), not sure if this can be a problem.
> > > 
> > 
> > I confirm removing the 'cmake' solved the issue, now I am getting:
> > "Run-time dependency zlib found: NO (tried pkgconfig and cmake)"
> > 
> > And zlib dependent modules not enabled, so build runs successfully.
> 
> Following is fixing the problem [1], but isn't this a generic problem when
> 64bit version of a library installed but 32bit version of it is missing and
> 'cmake' exists?
> 
> Should all library discovery reduced to the 'pkg-config' only?
> 
Yes, I'm in the process of doing up a patch for this.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2020-12-21 14:28   ` Hemant Agrawal
  2020-12-21 14:47     ` Bruce Richardson
@ 2021-01-22 10:20     ` Juraj Linkeš
  1 sibling, 0 replies; 13+ messages in thread
From: Juraj Linkeš @ 2021-01-22 10:20 UTC (permalink / raw)
  To: Hemant Agrawal, Bruce Richardson; +Cc: dev



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Hemant Agrawal
> Sent: Monday, December 21, 2020 3:29 PM
> To: Bruce Richardson <bruce.richardson@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
> 
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Bruce Richardson
> >
> > On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
> > > Hi,
> > >                 I am trying to cross compile DPDK for arm64 on a
> > > ubuntu machine,
> > which has a zlib pre-installed for native env.
> > >
> > > I am encountering following build error in net_bnx2x as it has
> > > dependency
> > on zlib.  It is trying to link with x86 arch based zlib.
> > >
> > > Cross compiling zlib and setting the PKG_CONFIG_PATH solve the issue.
> > But, Is their an easy way to disable these dependencies?
> > >
> > Can you try with setting PKG_CONFIG_LIBDIR rather than
> > PKG_CONFIG_PATH?
> > PKG_CONFIG_PATH simply extends the search locations, which means that
> > host-paths will still be searched, while PKG_CONFIG_LIBDIR replaces
> > the default path, eliminating the host-based search paths.
> 
> [Hemant] I will try.
> 

Hi Hemant, have you tried this yet?

I have an extra question. Since this is aarch64 cross-compilation, you should be using aarch64-linux-gnu-pkg-config - is that so?
The aarch64 pkg-config should prevent searching in build machine paths. Would this also point to cmake finding these dependencies?

> Also, is there a way to disable certain drivers (e.g. bnx2x) and libraries (e.g.
> compress) in meson config file statically, so that they don't get build.
> Using disable_driver options is still not working as the dpdk-test has dependency
> on zlib.
> 
> >
> > /Bruce



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
  2021-01-18 12:16           ` Ferruh Yigit
  2021-01-18 13:29             ` Bruce Richardson
@ 2021-01-22 12:47             ` Hemant Agrawal
  1 sibling, 0 replies; 13+ messages in thread
From: Hemant Agrawal @ 2021-01-22 12:47 UTC (permalink / raw)
  To: Ferruh Yigit, Bruce Richardson
  Cc: Hemant Agrawal, Akhil Goyal, dev, David Marchand


On 1/18/2021 5:46 PM, Ferruh Yigit wrote:
> On 1/18/2021 12:05 PM, Ferruh Yigit wrote:
>> On 1/18/2021 11:58 AM, Ferruh Yigit wrote:
>>> On 1/18/2021 10:51 AM, Bruce Richardson wrote:
>>>> On Fri, Jan 15, 2021 at 06:40:56PM +0000, Ferruh Yigit wrote:
>>>>> On 12/21/2020 2:04 PM, Bruce Richardson wrote:
>>>>>> On Mon, Dec 21, 2020 at 12:19:17PM +0000, Hemant Agrawal wrote:
>>>>>>> Hi,
>>>>>>>                   I am trying to cross compile DPDK for arm64 on 
>>>>>>> a ubuntu machine, which has a zlib pre-installed for native env.
>>>>>>>
>>>>>>> I am encountering following build error in net_bnx2x as it has 
>>>>>>> dependency on zlib.  It is trying to link with x86 arch based zlib.
>>>>>>>
>>>>>>> Cross compiling zlib and setting the PKG_CONFIG_PATH solve the 
>>>>>>> issue. But, Is their an easy way to disable these dependencies?
>>>>>>>
>>>>>> Can you try with setting PKG_CONFIG_LIBDIR rather than 
>>>>>> PKG_CONFIG_PATH?
>>>>>> PKG_CONFIG_PATH simply extends the search locations, which means 
>>>>>> that
>>>>>> host-paths will still be searched, while PKG_CONFIG_LIBDIR 
>>>>>> replaces the
>>>>>> default path, eliminating the host-based search paths.
>>>>>>
>>>>>
>>>>> The 'PKG_CONFIG_LIBDIR' seems not taken into account by meson, Akhil
>>>>> reported a 32bit build error when zlib is missing, I can reproduce 
>>>>> the same.
>>>>>
>>>>> I have only 64bit version of the library:
>>>>>
>>>>> $ pkg-config --path zlib
>>>>> /usr/lib64/pkgconfig/zlib.pc
>>>>>
>>>>> $ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ pkg-config --path zlib
>>>>> <no output>
>>>>> $ echo $?
>>>>> 1
>>>>>
>>>>> When I run the meson as following:
>>>>> "PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/ meson --werror -Dc_args=-m32
>>>>> -Dc_link_args=-m32 -Dexamples=all build32"
>>>>>
>>>>> It still detects the zlib:
>>>>> Run-time dependency zlib found: YES 1.2.11
>>>>>
>>>>
>>>> I've just tried this on my system and it works as expected: the 
>>>> 32-bit lib
>>>> is not found and a build succeeds. Omitting the PKG_CONFIG_LIBDIR 
>>>> and it is
>>>> found, but linking fails due to "file in wrong format" errors, 
>>>> again as
>>>> expected.
>>>>
>>>> In your case, I suspect it might be meson falling back to cmake in the
>>>> detection logic. If you have cmake installed on your system, can you
>>>> perhaps temporarily remove it, and retry the 32-bit build? If that 
>>>> is the
>>>> cause, we can modify the dependency call to add "method: 
>>>> 'pkg-config'" to
>>>> it, to force pkg-config searches only.
>>>>
>>>
>>> Yes I have cmake, I will try without it.
>>>
>>> Meanwhile I have Fedora, and it seems it is using different version 
>>> of the pkg-config (pkgconf), not sure if this can be a problem.
>>>
>>
>> I confirm removing the 'cmake' solved the issue, now I am getting:
>> "Run-time dependency zlib found: NO (tried pkgconfig and cmake)"
>>
>> And zlib dependent modules not enabled, so build runs successfully.
>
> Following is fixing the problem [1], but isn't this a generic problem 
> when 64bit version of a library installed but 32bit version of it is 
> missing and 'cmake' exists?
>
> Should all library discovery reduced to the 'pkg-config' only?
>
>
>
> [1]
> diff --git a/app/test/meson.build b/app/test/meson.build
> index 94fd39fecb82..bdbc61947637 100644
> --- a/app/test/meson.build
> +++ b/app/test/meson.build
> @@ -406,7 +406,7 @@ cflags += ['-DALLOW_INTERNAL_API']
>
>  test_dep_objs = []
>  if dpdk_conf.has('RTE_LIB_COMPRESSDEV')
> -       compress_test_dep = dependency('zlib', required: false)
> +       compress_test_dep = dependency('zlib', required: false, 
> method: 'pkg-config')
>         if compress_test_dep.found()
>                 test_dep_objs += compress_test_dep
>                 test_sources += 'test_compressdev.c'
> diff --git a/drivers/compress/zlib/meson.build 
> b/drivers/compress/zlib/meson.build
> index b19a6d2b161f..82cf0dddd649 100644
> --- a/drivers/compress/zlib/meson.build
> +++ b/drivers/compress/zlib/meson.build
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2018 Cavium Networks
>
> -dep = dependency('zlib', required: false)
> +dep = dependency('zlib', required: false, method: 'pkg-config')
>  if not dep.found()
>         build = false
>         reason = 'missing dependency, "zlib"'
> diff --git a/drivers/net/bnx2x/meson.build 
> b/drivers/net/bnx2x/meson.build
> index 8837ef424760..e260b75926ec 100644
> --- a/drivers/net/bnx2x/meson.build
> +++ b/drivers/net/bnx2x/meson.build
> @@ -7,7 +7,7 @@ if is_windows
>         subdir_done()
>  endif
>
> -dep = dependency('zlib', required: false)
> +dep = dependency('zlib', required: false, method: 'pkg-config')
>  build = dep.found()
>  reason = 'missing dependency, "zlib"'
>  ext_deps += dep



Just tested this patch with my cross compilation env. It works ok.

I will also check now without this patch with aarch64 pkg-config


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-01-22 12:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 12:19 [dpdk-dev] meson: wrong dependency in cross compilation on ARM Hemant Agrawal
2020-12-21 14:04 ` Bruce Richardson
2020-12-21 14:28   ` Hemant Agrawal
2020-12-21 14:47     ` Bruce Richardson
2021-01-22 10:20     ` Juraj Linkeš
2021-01-15 18:40   ` Ferruh Yigit
2021-01-18 10:51     ` Bruce Richardson
2021-01-18 11:58       ` Ferruh Yigit
2021-01-18 12:05         ` Ferruh Yigit
2021-01-18 12:16           ` Ferruh Yigit
2021-01-18 13:29             ` Bruce Richardson
2021-01-22 12:47             ` Hemant Agrawal
2021-01-18 13:28         ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).