From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6A145A49F for ; Mon, 19 Feb 2018 11:14:47 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2018 02:14:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,534,1511856000"; d="scan'208";a="176411336" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.77]) by orsmga004.jf.intel.com with SMTP; 19 Feb 2018 02:14:42 -0800 Received: by (sSMTP sendmail emulation); Mon, 19 Feb 2018 10:14:41 +0000 Date: Mon, 19 Feb 2018 10:14:40 +0000 From: Bruce Richardson To: tom.barbette@uliege.be Cc: dev@dpdk.org Message-ID: <20180219101440.GA9676@bricha3-MOBL3.ger.corp.intel.com> References: <328301853.77122566.1519033179263.JavaMail.zimbra@uliege.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <328301853.77122566.1519033179263.JavaMail.zimbra@uliege.be> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.1 (2017-09-22) Subject: Re: [dpdk-dev] Linking with -ldpdk 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: Mon, 19 Feb 2018 10:14:47 -0000 On Mon, Feb 19, 2018 at 10:39:39AM +0100, tom.barbette@uliege.be wrote: > Hi list, > > I found out that to staticly compile against DPDK using the combined lib, I needed all these options : > > -I${RTE_SDK}/${RTE_TARGET}/include -L${RTE_SDK}/${RTE_TARGET}/lib -Wl,--whole-archive -ldpdk -Wl,--no-whole-archive -lnuma -ldl -lpthread -lm -lmlx4 -lmlx5 -libverbs > > The whole-archive makes sense, as we need to embed drivers that wouldn't be found at linking time (failing to include it prevents port discovery). > However it leads to missing inclusion. That's why I added all the libs at the end of the line. The mlx4 libs particularly leads me to think that there must be a more programmatic way, portable accross versions of DPDK to find out which libraries referenced in DPDK I should include, right? Morveover if the DPDK user didn't include mlx4, it will fail to compile... > > What should I use? (the whole rte.extapp.mk DPDK build process is not an option as the build system is rather complex in this project) > > Or maybe some of these libraries should be included in the dpdk static lib? > > I use the last git version (but it's the same problem with previous ones). > > Thanks, > > Tom Hi Tom, this is something that I was hoping to achieve using pkg-config files generated by the meson build system. This is still a work in progress, but you can use "ninja install" to install a pkg-config file for DPDK at the end of the build process, and the Makefiles for the DPDK examples show how to build a static binary using that information. Now the limitations: there is no support for building all of DPDK as a single static library, but pkg-config does provide the list of all DPDK libs and drivers individually, as well as a list of the extra lib names that have to be added to the end. [Given what pkg-config provides, I fail to see the need to produce the single .a file any more too] Sadly for the use case you mention above, the mlx* drivers aren't available as part of the build yet either. In the meantime, while the gaps are being filled out, any feedback on building using pkg-config output would be appreciated. I admit it is a bit more geared towards shared library building, but static should work also. Regards, /Bruce