From: Bruce Richardson <bruce.richardson@intel.com>
To: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
Cc: dev@dpdk.org, Yongseok Koh <yskoh@mellanox.com>,
Shahaf Shuler <shahafs@mellanox.com>,
Matan Azrad <matan@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support
Date: Wed, 29 Aug 2018 11:01:15 +0100 [thread overview]
Message-ID: <20180829100115.GA27208@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20180829093410.3epizbi3pmx5ses2@laranjeiro-vm.dev.6wind.com>
On Wed, Aug 29, 2018 at 11:34:10AM +0200, Nélio Laranjeiro wrote:
> Hi Bruce,
>
> Thanks for your comments I have address almost all of them in the v3 by
> doing what you suggest, I still have some comments, please see below,
>
Thanks.
> On Tue, Aug 28, 2018 at 04:45:00PM +0100, Bruce Richardson wrote:
> > Thanks for this, comments inline below.
> >
> > /Bruce
> >
> > On Mon, Aug 27, 2018 at 02:42:25PM +0200, Nelio Laranjeiro wrote:
> > > Mellanox drivers remains un-compiled by default due to third party
> > > libraries dependencies. They can be enabled through:
> > > - enable_driver_mlx{4,5}=true or
> > > - enable_driver_mlx{4,5}_glue=true
> > > depending on the needs.
> >
> > The big reason why we wanted a new build system was to move away from this
> > sort of static configuration. Instead, detect if the requirements as
> > present and build the driver if you can.
>
> Ok, I am letting only the glue option for both drivers as suggested at
> the end of your answer.
>
> > > To avoid modifying the whole sources and keep the compatibility with
> > > current build systems (e.g. make), the mlx{4,5}_autoconf.h is still
> > > generated by invoking DPDK scripts though meson's run_command() instead
> > > of using has_types, has_members, ... commands.
> > >
> > > Meson will try to find the required external libraries. When they are
> > > not installed system wide, they can be provided though CFLAGS, LDFLAGS
> > > and LD_LIBRARY_PATH environment variables, example (considering
> > > RDMA-Core is installed in /tmp/rdma-core):
> > >
> > > # CLFAGS=-I/tmp/rdma-core/build/include \
> > > LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > meson -Denable_driver_mlx4=true output
> > >
> > > # CLFAGS=-I/tmp/rdma-core/build/include \
> > > LDFLAGS=-L/tmp/rdma-core/build/lib \
> > > LD_LIBRARY_PATH=/tmp/rdma-core/build/lib \
> > > ninja -C output install
> >
> > Once the CFLAGS/LDFLAGS are passed to meson, they should not be needed for
> > ninja. The LD_LIBRARY_PATH might be - I'm not sure about that one! :-)
>
> CFLAGS/LDFLAGS are correctly evaluated and inserted in the build.ninja
> file, for the LD_LIBRARY_PATH, it is necessary for the run_command stuff
> generating the mlx*_autoconf.h
>
Just realised there is another issue which you should address. The
mlx*_autoconf.h files are being written into a source folder rather than
into the destination folder. This could cause problems if we are enabling
mlx for cross-compile builds. Perhaps inside the auto-config-h.sh script
you can check for $MESON_BUILD_ROOT value, and use that (and possibly
$MESON_SUBDIR) to put the header file in the build directory.
> >[...]
> > Rather than having your own separate debug option flag, why not set these
> > based on the "buildtype" option e.g. if buildtype is set to "debug".
> >
> > > + # To maintain the compatibility with the make build system
> > > + # mlx4_autoconf.h file is still generated.
> > > + r = run_command('sh', '../../../buildtools/auto-config-h.sh',
> > > + 'mlx4_autoconf.h',
> > > + 'HAVE_IBV_MLX4_WQE_LSO_SEG',
> > > + 'infiniband/mlx4dv.h',
> > > + 'type', 'struct mlx4_wqe_lso_seg')
> > > + if r.returncode() != 0
> > > + error('autoconfiguration fail')
> > > + endif
> >
> > Just to check that you are ok with this only being run at configure time?
> > If any changes are made to the inputs, ninja won't pick them up. To have it
> > tracked for input changes, "custom_target" should be used instead of
> > run_command.
>
> It seems to not be possible to have several custom_target on the same
> output file has this last is used as the target identifier in ninja.
>
> This limitation is acceptable for now, when meson will be the default
> build system, then such autoconf can be removed to use meson built-in
> functions.
>
> > > +endif
> > > +# Build Glue Library
> > > +if pmd_dlopen
> > > + dlopen_name = 'mlx4_glue'
> > > + dlopen_lib_name = driver_name_fmt.format(dlopen_name)
> > > + dlopen_so_version = LIB_GLUE_VERSION
> > > + dlopen_sources = files('mlx4_glue.c')
> > > + dlopen_install_dir = [ eal_pmd_path + '-glue' ]
> > > + shared_lib = shared_library(
> > > + dlopen_lib_name,
> > > + dlopen_sources,
> > > + include_directories: global_inc,
> > > + c_args: cflags,
> > > + link_args: [
> > > + '-Wl,-export-dynamic',
> > > + '-Wl,-h,@0@'.format(LIB_GLUE),
> > > + '-lmlx4',
> > > + '-libverbs',
> >
> > While this works, the recommended approach is to save the return value from
> > cc.find_library() above, and pass that as a dependency directly, rather
> > than as a linker flag.
>
> I tried it, but:
>
> drivers/net/mlx5/meson.build:216:8: ERROR: Link_args arguments must be
> strings.
>
It needs to be passed using "dependencies" rather than as a link_arg. [See
list of possible arguments to library and executable objects here:
http://mesonbuild.com/Reference-manual.html#executable]
/Bruce
next prev parent reply other threads:[~2018-08-29 10:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Message-Id: <7812af2267017898332783e934bef9478814ae96.1535361299.git.nelio.laranjeiro@6wind.com>
2018-08-27 12:42 ` Nelio Laranjeiro
2018-08-28 15:45 ` Bruce Richardson
2018-08-29 9:34 ` Nélio Laranjeiro
2018-08-29 10:01 ` Bruce Richardson [this message]
2018-08-29 12:44 ` Nélio Laranjeiro
2018-08-29 10:00 ` Luca Boccassi
2018-08-29 11:59 ` Nélio Laranjeiro
2018-08-29 12:28 ` Luca Boccassi
2018-08-31 16:24 ` Luca Boccassi
2018-08-29 13:48 ` [dpdk-dev] [PATCH v3] " Nelio Laranjeiro
2018-08-30 14:46 ` Bruce Richardson
2018-08-31 7:05 ` Nélio Laranjeiro
2018-08-31 7:16 ` [dpdk-dev] [PATCH v4] " Nelio Laranjeiro
2018-09-05 11:47 ` [dpdk-dev] [PATCH v5] " Shahaf Shuler
2018-09-07 10:34 ` Bruce Richardson
2018-09-13 9:22 ` Bruce Richardson
2018-09-13 10:12 ` Shahaf Shuler
2018-09-13 10:51 ` Bruce Richardson
2018-09-13 12:11 ` [dpdk-dev] [PATCH v6 1/2] net/mlx5: support meson build Shahaf Shuler
2018-09-13 12:41 ` Bruce Richardson
2018-09-16 9:01 ` Shahaf Shuler
2018-09-13 12:11 ` [dpdk-dev] [PATCH v6 2/2] net/mlx4: " Shahaf Shuler
2018-08-27 11:10 [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Nelio Laranjeiro
2018-08-27 11:10 ` [dpdk-dev] [PATCH 2/2] net/mlx: add meson build support Nelio Laranjeiro
2018-08-27 11:24 ` [dpdk-dev] [PATCH 1/2] build: add extra cflags ldflags to meson option Bruce Richardson
2018-08-27 12:20 ` Nélio Laranjeiro
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=20180829100115.GA27208@bricha3-MOBL.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=matan@mellanox.com \
--cc=nelio.laranjeiro@6wind.com \
--cc=shahafs@mellanox.com \
--cc=yskoh@mellanox.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).