From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CFFF8A04B7 for ; Tue, 13 Oct 2020 18:04:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B81531DDBF; Tue, 13 Oct 2020 18:04:32 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id A04A21DDBE for ; Tue, 13 Oct 2020 18:04:31 +0200 (CEST) IronPort-SDR: v/sVsTEgZNzFGn4ycRRzsXTNX8AicRCvhGZ0QYcRTjd2hijAROP5isP2J1C/mKEvjp4rtwv5uh NA6YLyCYRrhw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="145253756" X-IronPort-AV: E=Sophos;i="5.77,371,1596524400"; d="scan'208";a="145253756" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2020 09:04:28 -0700 IronPort-SDR: D7UW/VI5GHvik0pMyw4lzM5ODcjs/fep3wgeyQ8v6Jcbz56FIiSaytnqBlT5o4JPGeYUS6J4UJ BOeGU0rfUYTA== X-IronPort-AV: E=Sophos;i="5.77,371,1596524400"; d="scan'208";a="345314240" Received: from bricha3-mobl.ger.corp.intel.com ([10.213.245.209]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 13 Oct 2020 09:04:27 -0700 Date: Tue, 13 Oct 2020 17:04:21 +0100 From: Bruce Richardson To: Renata Saiakhova Cc: "users@dpdk.org" Message-ID: <20201013160421.GE1496@bricha3-MOBL.ger.corp.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" On Tue, Oct 13, 2020 at 03:54:13PM +0000, Renata Saiakhova wrote: > Hi all, hi Bruce, > > I have an issue to compile 32 bit dpdk (version 20.08) with meson in a > 64-bit container. > > As I can see from meson.build, it deducts the arch from the cc sizeof: > > dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8) > > The attempts to workaround it and set RTE_ARCH_64 to false gives good > values in build/rte_build_config.h: > > #define RTE_ARCH i686 > #undef RTE_ARCH_64 > #define RTE_ARCH_I686 1 > #define RTE_ARCH_X86 1 > #define RTE_CACHE_LINE_SIZE 64 > but, nevertheless, dpdk is compiled for 64 bit and not for 32 bit. > Before, with make build system, RTE_ARCH_ values defined arch and > compilation flags for x86 (like -m32 for i686), but with meson it seems > to be more complicated? > Is there a way to compile 32 bit dpdk (version 20.08) with meson in a > 64-bit environment? > Kind regards, > Renata Hi Renata, there are two ways to do this - firstly one can create and use a cross-file, but secondly, and easier, one just needs to tell the compiler to create 32-bit binaries using the -m32 flag. In this second case, the only additional complication is that you need to ensure that pkg-config looks for the relevant .pc files in a 32-bit lib directory rather than a 64-bit one. Based on that, on my Ubuntu system, the following commands will work to do a 32-bit build of DPDK: $ PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig/ meson -Dc_args='-m32' \ -Dc_link_args='-m32' build-32bit $ ninja -C build-32bit Checking the resulting binary: $ file build-32bit/app/dpdk-testpmd build-32bit/app/dpdk-testpmd: ELF 32-bit LSB shared object, Intel 80386, \ version 1 (SYSV), dynamically linked, ... Depending on your Linux distribution, the pkg-config libdir you need to specify may be different, e.g. /usr/lib32/pkgconfig, perhaps. Note also that it's the "_LIBDIR" variable rather than "PKG_CONFIG_PATH" that must be set, since the latter just appends to the search paths rather than replacing them with 32-bit versions. Regards, /Bruce