From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5AD2EA0548 for ; Tue, 20 Apr 2021 18:45:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DF8E41735; Tue, 20 Apr 2021 18:45:45 +0200 (CEST) Received: from clt-mbsout-02.mbs.boeing.net (clt-mbsout-02.mbs.boeing.net [130.76.144.163]) by mails.dpdk.org (Postfix) with ESMTP id E2EC141439 for ; Tue, 20 Apr 2021 18:45:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by clt-mbsout-02.mbs.boeing.net (8.15.2/8.15.2/DOWNSTREAM_MBSOUT) with SMTP id 13KGjbVZ030105; Tue, 20 Apr 2021 12:45:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boeing.com; s=boeing-s1912; t=1618937139; bh=kvkweUy/jDdlkHn1+WnsDvDPkRZibjNxcqkZ2c0i6aA=; h=From:To:Subject:Date:References:In-Reply-To:From; b=FgUKKMM8nFxFkAUs5o+aRgWjlWP58bIrFAsQ22RpnuVZsA/Zy1suNhvBezt6KodAZ uOO+pArX+BjMzQ5UqYyx+Ymj4cjgflEM/GdiY91mf9xJFfBcr2Ro9VcmWv5aAeWdG1 dWzX+lXhzeUhS/+at5zNnlYzG7EHJGOMnjDhf8JF9bZVQ3FQBWQ3HOVtKLEEzKfVzm pWE4So8O+Cc3xEq77eKagreZw3x8gNfvAjllUYJtUsfvoDmasFKb5qntr0ssAEscH7 Y+PMTFIU1vn7JQEei1K25A+0y1kV2lGLIweHZKi2/fuwjZd/oveyUS5aBTtX6iOKAa Ov84e+LlgemVg== Received: from XCH16-07-07.nos.boeing.com (xch16-07-07.nos.boeing.com [144.115.66.109]) by clt-mbsout-02.mbs.boeing.net (8.15.2/8.15.2/8.15.2/UPSTREAM_MBSOUT) with ESMTPS id 13KGjWhK030043 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=OK); Tue, 20 Apr 2021 12:45:32 -0400 Received: from XCH16-07-10.nos.boeing.com (144.115.66.112) by XCH16-07-07.nos.boeing.com (144.115.66.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2242.4; Tue, 20 Apr 2021 09:45:31 -0700 Received: from XCH16-07-10.nos.boeing.com ([fe80::1522:f068:5766:53b5]) by XCH16-07-10.nos.boeing.com ([fe80::1522:f068:5766:53b5%2]) with mapi id 15.01.2176.009; Tue, 20 Apr 2021 09:45:31 -0700 From: "Templin (US), Fred L" To: "users@dpdk.org" , Stephen Hemminger Thread-Topic: dpdk-20.11 and shared libraries Thread-Index: Adc1/fli+4+6Q8dTRM29ym5j+b52JwABR5YA Date: Tue, 20 Apr 2021 16:45:30 +0000 Message-ID: <859a3a807b2b4ebb9984b261374b9d46@boeing.com> References: <3e2a222c70864e73965adbe64b5c72a2@boeing.com> In-Reply-To: <3e2a222c70864e73965adbe64b5c72a2@boeing.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [137.137.12.6] x-tm-snts-smtp: FD6246EEA8D54BEF725F1E15F8B89F3771CC876009D209510F8FF73F46D9F33C2000:8 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-TM-AS-GCONF: 00 Subject: Re: [dpdk-users] dpdk-20.11 and shared libraries X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" Hi, as an example of where I am having trouble with shared libraries, I am trying to modify the "helloworld" example program so that I can invoke it as: "helloworld --vdev net_null0". Working by looking at the low-level dpdk-20.11 driver code, I tried adding a call to "rte_vdev_init()" to the helloworld main.c as shown in the code diffs below. When I tried to build (as shared), I got an error from the loader saying the reference to 'rte_vdev_init' is undefined. Am I even barking up the right tree? Fred --- main.c 2021-04-20 08:17:37.895698070 -0700 +++ main.c.net_null 2021-04-20 08:24:51.958198682 -0700 @@ -14,6 +14,9 @@ #include #include #include +#if 1 +#include +#endif =20 static int lcore_hello(__rte_unused void *arg) @@ -30,6 +33,12 @@ int ret; unsigned lcore_id; =20 +#if 1 + ret =3D rte_vdev_init("net_null", NULL); + if (ret < 0) + rte_panic("Cannot init net_null\n"); +#endif + ret =3D rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); cc -O3 -include rte_config.h -march=3Dnative -I/usr/local/include -DALLOW_E= XPERIMENTAL_API main.c -o build/helloworld-shared -L/usr/local/lib/x86_64-= linux-gnu -Wl,--as-needed -lrte_node -lrte_graph -lrte_bpf -lrte_flow_class= ify -lrte_pipeline -lrte_table -lrte_port -lrte_fib -lrte_ipsec -lrte_vhost= -lrte_stack -lrte_security -lrte_sched -lrte_reorder -lrte_rib -lrte_regex= dev -lrte_rawdev -lrte_pdump -lrte_power -lrte_member -lrte_lpm -lrte_laten= cystats -lrte_kni -lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro -lrte_ev= entdev -lrte_efd -lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_= cfgfile -lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lr= te_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter -lrte_net -lrte= _mbuf -lrte_mempool -lrte_rcu -lrte_ring -lrte_eal -lrte_telemetry -lrte_kv= args /tmp/ccgU3Rpi.o: In function `main': main.c:(.text.startup+0x15): undefined reference to `rte_vdev_init' collect2: error: ld returned 1 exit status Makefile:32: recipe for target 'build/helloworld-shared' failed make: *** [build/helloworld-shared] Error 1 > -----Original Message----- > From: users [mailto:users-bounces@dpdk.org] On Behalf Of Templin (US), Fr= ed L > Sent: Tuesday, April 20, 2021 9:25 AM > To: users@dpdk.org; Stephen Hemminger > Subject: [dpdk-users] dpdk-20.11 and shared libraries >=20 > Hi, I have put a lot of time into learning about dpdk-20.11 but I have no= t yet found > documentation on how to use it with shared libraries. In dpdk-20.11, the= examples > are all built as "static" by default meaning that the entire kitchen sink= of all DPDK > libraries are linked in during the "ld" phase and the resulting binary is= huge. When > built as "static", the examples all appear to work fine as everything is = loaded by > default at runtime. >=20 > When I build the examples as "shared", however, the story is completely d= ifferent. > Examples that run fine as "static" do not work at all when built as "shar= ed". It is > clear that somehow the build procedure is not giving adequate instruction= s to the > loader so that all necessary libraries will be ready to go at runtime. >=20 > I believe what needs to happen is that initialization code needs to be ad= ded to the > example "main.c" modules to initialize functions that will be needed by l= ower levels > but that are not being picked up on by the loader. But, I can find no doc= umentation > for how to do this. In my next message, I will send a code example of wha= t I have > tried so far. >=20 > Stephen, can you provide guidance on how to work with dpdk-20.11 in share= d > library environments? I would be happy to be pointed to any documentation > I may be missing. >=20 > Thanks - Fred >=20