DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container
@ 2020-10-13 15:54 Renata Saiakhova
  2020-10-13 16:04 ` Bruce Richardson
  0 siblings, 1 reply; 4+ messages in thread
From: Renata Saiakhova @ 2020-10-13 15:54 UTC (permalink / raw)
  To: users, Bruce Richardson

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




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

* Re: [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container
  2020-10-13 15:54 [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container Renata Saiakhova
@ 2020-10-13 16:04 ` Bruce Richardson
  2020-10-13 16:28   ` Renata Saiakhova
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2020-10-13 16:04 UTC (permalink / raw)
  To: Renata Saiakhova; +Cc: 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

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

* Re: [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container
  2020-10-13 16:04 ` Bruce Richardson
@ 2020-10-13 16:28   ` Renata Saiakhova
  2020-10-13 16:31     ` Bruce Richardson
  0 siblings, 1 reply; 4+ messages in thread
From: Renata Saiakhova @ 2020-10-13 16:28 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: users

Hi Bruce,

thanks, the second variant is indeed easy! Is there any advantage to create a cross-file instead of just passing an option to compiler and linker and specifying pkg-config libdir? or would it be more "canonical"?

Kind regards,
Renata
________________________________
From: Bruce Richardson <bruce.richardson@intel.com>
Sent: Tuesday, October 13, 2020 6:04 PM
To: Renata Saiakhova <renata.saiakhova@ekinops.com>
Cc: users@dpdk.org <users@dpdk.org>
Subject: Re: Compiling 32-bit dpdk with meson in 64-bit container

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

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

* Re: [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container
  2020-10-13 16:28   ` Renata Saiakhova
@ 2020-10-13 16:31     ` Bruce Richardson
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2020-10-13 16:31 UTC (permalink / raw)
  To: Renata Saiakhova; +Cc: users

On Tue, Oct 13, 2020 at 04:28:16PM +0000, Renata Saiakhova wrote:
>    Hi Bruce,
> 
>    thanks, the second variant is indeed easy! Is there any advantage to
>    create a cross-file instead of just passing an option to compiler and
>    linker and specifying pkg-config libdir? or would it be more
>    "canonical"?
>

The cross-file might give you more flexibility in setting additional
options and the like, but I believe just setting the '-m32' flag works
fine.

/Bruce
 
>      __________________________________________________________________
> 
>    From: Bruce Richardson <bruce.richardson@intel.com>
>    Sent: Tuesday, October 13, 2020 6:04 PM
>    To: Renata Saiakhova <renata.saiakhova@ekinops.com>
>    Cc: users@dpdk.org <users@dpdk.org>
>    Subject: Re: Compiling 32-bit dpdk with meson in 64-bit container
> 
>    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

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

end of thread, other threads:[~2020-10-13 16:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 15:54 [dpdk-users] Compiling 32-bit dpdk with meson in 64-bit container Renata Saiakhova
2020-10-13 16:04 ` Bruce Richardson
2020-10-13 16:28   ` Renata Saiakhova
2020-10-13 16:31     ` 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).