From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9120EA0350; Mon, 29 Jun 2020 16:53:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C93601BF80; Mon, 29 Jun 2020 16:53:45 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 913D01BF44 for ; Mon, 29 Jun 2020 16:53:44 +0200 (CEST) IronPort-SDR: qiL3mmnOh31NHmeWUFL7c8jSWyNkUUnpIPC0wKPIsMQty1vAkgDVqtByyAFAHk7ZsaALY49tKm JH6Pbt+oQLzg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="230811548" X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="230811548" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 07:53:43 -0700 IronPort-SDR: B14ytwnH+MBFWbb77D7o1LYJqGF/6zodWI8goRqwyTCp8oe5V6RuzhtCrpw61BK9UEnTGi81Xe O4eLg9t0tkcQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,295,1589266800"; d="scan'208";a="454218509" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.214.152]) ([10.213.214.152]) by orsmga005.jf.intel.com with ESMTP; 29 Jun 2020 07:53:42 -0700 To: Bruce Richardson , dev@dpdk.org References: <20200626145957.722089-1-bruce.richardson@intel.com> From: "Burakov, Anatoly" Message-ID: <0f1ee479-b6be-23d8-15a5-daec8368d627@intel.com> Date: Mon, 29 Jun 2020 15:53:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200626145957.722089-1-bruce.richardson@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] eal: don't use default library path for static binaries 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 26-Jun-20 3:59 PM, Bruce Richardson wrote: > When using statically linked DPDK binaries, the EAL checks the default PMD > path and tries to load any drivers there, despite the fact that all drivers > are normally linked into the binary. This behaviour can cause issues if > the PMD path and lib dir is configured to a non-standard location which is > not in the ld.so.conf paths, e.g. a build with prefix set to a home > directory location. In a case such as this, EAL will try and > (unnecessarily) load the .so driver files but that load will fail as their > dependent libraries, such as ethdev, for example, will not be found. > > Because of this, it is better if statically linked DPDK apps do not load > drivers from the standard paths automatically. The user can always have > this behaviour by explicitly specifying the path using -d flag, if so > desired. > > Not loading the libraries automatically can also prevent potential issues > with a user building and running a statically-linked DPDK binary based off > a private copy of DPDK, while there exists on the same machine a > system-wide installation of DPDK in the default locations. Without this > change, the system-installed drivers will be loaded to the binary alongside > the statically-linked drivers, which is not what the user would have > intended. > > To detect whether we are in a statically or dynamically linked binary, we > can have EAL try to get a dlopen handle to its own shared library, by > calling dlopen with the RTLD_NOLOAD flag. This will return NULL if there is > no such shared lib loaded i.e. the code is executing from a static library, > or a handle to the lib if it is loaded. > > Signed-off-by: Bruce Richardson > --- +1, been bitten by this more than... ummm... well, a lot. Acked-by: Anatoly Burakov -- Thanks, Anatoly