DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: Hemant Agrawal <hemant.agrawal@nxp.com>,
	Akhil Goyal <akhil.goyal@nxp.com>, "dev@dpdk.org" <dev@dpdk.org>,
	David Marchand <david.marchand@redhat.com>
Subject: Re: [dpdk-dev] meson: wrong dependency in cross compilation on ARM
Date: Mon, 18 Jan 2021 12:16:04 +0000
Message-ID: <45a28b53-25b1-ef06-4c05-56b23dca3b76@intel.com> (raw)
In-Reply-To: <17596e93-78a9-c38e-261c-28949a0caa9b@intel.com>

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

  reply	other threads:[~2021-01-18 12:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 12:19 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 [this message]
2021-01-18 13:29             ` Bruce Richardson
2021-01-22 12:47             ` Hemant Agrawal
2021-01-18 13:28         ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45a28b53-25b1-ef06-4c05-56b23dca3b76@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git