From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A82ED4C90 for ; Tue, 11 Sep 2018 16:07:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 07:07:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,360,1531810800"; d="scan'208";a="256265749" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 11 Sep 2018 07:07:32 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Sep 2018 07:07:32 -0700 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.210]) by FMSMSX151.amr.corp.intel.com ([169.254.7.228]) with mapi id 14.03.0319.002; Tue, 11 Sep 2018 07:07:32 -0700 From: "Wiles, Keith" To: Amedeo Sapio CC: "users@dpdk.org" Thread-Topic: [dpdk-users] DPDK application as a library Thread-Index: AQHUSb1FJTldtEElDkelEteYE9yReqTrk22A Date: Tue, 11 Sep 2018 14:07:31 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.188.247] Content-Type: text/plain; charset="us-ascii" Content-ID: <5B98AF81F744C847A817747E6A138C56@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-users] DPDK application as a library X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2018 14:07:35 -0000 > On Sep 11, 2018, at 5:49 AM, Amedeo Sapio wro= te: >=20 > Dear all, > I am writing a program that uses dpdk. I wrote the program based on the > dpdk examples, in particular using the Makefile provided in the examples. > If i compile the program as an APP (as describe here > ), all goes > well. Sounds like you and this person need to get together here :-) https://mails.dpdk.org/archives/users/2018-September/003439.html > However, my code is part of a larger project, for which the use of a > separate makefile causes a lot of troubles. > So I compiled my code as a library, as described in the same page. > Now, the program that calls the functions in the library (to initialize t= he > EAL) is getting this error: >=20 Did you call rte_eal_init() first as most of the routines depend on calling= this function before you call the other one. As I explained the other thread, is that DPDK is not libc and you can not j= ust pick the functions you want to use for the most part. Some functions ar= e fairly independent, but not really as work is needed to make sure it has = all of the other inits called. If you want to use DPDK today, the best method is to make sure you initiali= ze DPDK correctly and then you can use parts of it for your needs. As for the code that interacts with your application it is best to have a d= irectory with just the functions you need to build with DPDK and use these = functions as a bridge to/from your code. Using your header files and DPDK h= eader files in the same directory or file can cause a number of build probl= ems, which is why I use this type of method. Some routines in DPDK you can = call without any real problems, but sometimes it makes it easier to write i= nline functions or functions that build most independent of DPDK and your r= outines. Not sure explained it clearly, but I hope it helps. BTW, please remove any disclaimers in your email as they do not apply to a = public email list. > MBUF: error setting mempool handler > Cannot init mbuf pool >=20 > I also made an experiment with the l2fwd example. The example compiled as > an app works correctly. But if I compile it as a library and then I call > the functions in this library from another program, I get: >=20 > EAL: Error - exiting with code: 1 > Cause: No Ethernet ports - bye >=20 > I have one ethernet port using the igb_uio driver (seen from > dpdk-devbind.py). When I compile my program, I link the following > libraries: dpdk, pthread, dl, numa. DPDK is compiled from source as > described here . >=20 > Thanks for your help, >=20 > --- > Amedeo >=20 > --=20 >=20 > This message and its contents, including attachments are intended solely= =20 > for the original recipient. If you are not the intended recipient or have= =20 > received this message in error, please notify me immediately and delete=20 > this message from your computer system. Any unauthorized use or=20 > distribution is prohibited. Please consider the environment before printi= ng=20 > this email. Regards, Keith