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