DPDK usage discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Renata Saiakhova <renata.saiakhova@ekinops.com>
Cc: "users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container
Date: Tue, 13 Oct 2020 17:04:21 +0100
Message-ID: <20201013160421.GE1496@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <MRXP264MB01207ABAEC5C18FC73B14D5192040@MRXP264MB0120.FRAP264.PROD.OUTLOOK.COM>

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.


  reply	other threads:[~2020-10-13 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 15:54 Renata Saiakhova
2020-10-13 16:04 ` Bruce Richardson [this message]
2020-10-13 16:28   ` Renata Saiakhova
2020-10-13 16:31     ` 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:

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

  git send-email \
    --in-reply-to=20201013160421.GE1496@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=renata.saiakhova@ekinops.com \
    --cc=users@dpdk.org \


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

DPDK usage discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/users/0 users/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 users users/ https://inbox.dpdk.org/users \
	public-inbox-index users

Example config snippet for mirrors.
Newsgroup available over NNTP:

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