From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id BD8E25A for ; Wed, 29 Aug 2018 14:44:25 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id m27-v6so4706576wrf.3 for ; Wed, 29 Aug 2018 05:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to:openpgp :user-agent; bh=p0yUXA4xUoSPWnpwq1LgImawcNxUmIEEP7YLocukt7o=; b=xakD3KpemhEaCpS8DEDBwewYB3qM9q/69FRwxPO+N0S2bateZC+K2uhwOuZ7nIIc/6 VqZAliF4LqFDgh74DHvcds3ZOC1Oe2Tzgk5ewXYDc8ebfJ7G0/7WvOF1w1cJFNkvSO8e 4mPj+fs5o8JScDhaZmjKgUcz8pgQeU66fk5HCAr9YXEFVwf2ppEFw5x9QKLy8FqCX7ah BMti2Ic5jGjMCzS3BN46Yb9HrERR3VtNB5NSA/Om5V02wX6f0yA+vcE4QqOH6lMdrZfI yLKLO1TY1l/klTjA5bev5Ze/bNOnIyCkcp6vBPah0x2ii9v0gTjQBJ4rH4boBkmBF7WM 9RpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:openpgp:user-agent; bh=p0yUXA4xUoSPWnpwq1LgImawcNxUmIEEP7YLocukt7o=; b=bQCg0keldZGw7gSUAO6DU8xOfEa6X4AL2pyGTIM6KNAsJcUIupESp2wdE0+sXiYJvU YBwk6h5VlDPYI2pTAlKoJ/oismUATYC7F98yOy2GJcpkAVNErYXvhKHYpw5L84EwVL2x jJLW0WYKE2owsIKYt+DZHhvQAi0Jxp724uMx1KWPOu5RvIaBvwFjFw8KrFxOOgaGhkBO An6WJTOdAOcc1mx7kCZKZuH7IPZu463gWOoSExVPz3vmjK9+gQhr8T/8/4vxtvF5Y+4H 98dcDNJgLIKErxOXKjHW8fGix0m9l+9W73h9YJgc3qxC6CsqMnpUQvYZ73bDgdhR5uBD FxmQ== X-Gm-Message-State: APzg51BdPLmlwiySZXk4dvREpHIWEhXRwUw5kRMGxS0OINRHTvuoDNX9 mJoWpXJq04lB40layEAE8a/8vVTTrqBU X-Google-Smtp-Source: ANB0VdbD50LuLd8lGMPi03vsUy07TaBUKsQdsdDlGdeoYRGTuun7TZPkXrHWCBfNGs2BmFoNdsNnMA== X-Received: by 2002:a5d:4e8b:: with SMTP id e11-v6mr4485945wru.32.1535546665508; Wed, 29 Aug 2018 05:44:25 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id w4-v6sm3827868wro.24.2018.08.29.05.44.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Aug 2018 05:44:24 -0700 (PDT) Date: Wed, 29 Aug 2018 14:44:14 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Bruce Richardson Cc: dev@dpdk.org, Yongseok Koh , Shahaf Shuler , Matan Azrad Message-ID: <20180829124414.4mvmor3k2awwflvs@laranjeiro-vm.dev.6wind.com> References: <7812af2267017898332783e934bef9478814ae96.1535361299.git.nelio.laranjeiro@6wind.com> <85a2b398fecdf917dc22810ea0974a91ccca1d13.1535373640.git.nelio.laranjeiro@6wind.com> <20180828154500.GA4208@bricha3-MOBL.ger.corp.intel.com> <20180829093410.3epizbi3pmx5ses2@laranjeiro-vm.dev.6wind.com> <20180829100115.GA27208@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180829100115.GA27208@bricha3-MOBL.ger.corp.intel.com> OpenPGP: id=A0075DA8F66A5949 preference=signencrypt User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v2] net/mlx: add meson build support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2018 12:44:25 -0000 On Wed, Aug 29, 2018 at 11:01:15AM +0100, Bruce Richardson wrote: > 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. Indeed, I was searching also for a solution, I finally found it without modifying the shell script by using meson.current_build_dir() which contains the same path has $MESON_BUILD_ROOT/$MESON_SUBDIR. > > >[...] > > > 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] Thanks this works with the dependencies. -- Nélio Laranjeiro 6WIND