From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f196.google.com (mail-qk0-f196.google.com [209.85.220.196]) by dpdk.org (Postfix) with ESMTP id B98C91B1B6 for ; Fri, 16 Feb 2018 00:45:00 +0100 (CET) Received: by mail-qk0-f196.google.com with SMTP id i184so1807976qkf.10 for ; Thu, 15 Feb 2018 15:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TvXNNzmxs8OCRlFLmQcxyAwboeqpLp87lURD/I8onMU=; b=xzbjS5WfugHUzvAiu5DQzKRSJX0A3FO1+gSO1gi/D7gyRXFGdPmgXlAWNM8NDDBKC1 csCeNKfiNzV2r5xuDHzOHX1EDp0IalT9q+6vgrBu7uEUkuIqjzT0+hdkXYtg7FkazQvl asyJyhiDIn/7Z87/yiZXgxRuxWMYeG6Vv85ooqRyzELyAaZ379FUPQQMCxvcNNbA1Bf4 EGiQ/YjgqXoOMw1TAaEf+pHBv2Vr99oMPAlKsyPNFM4DinjVEfO+Xzg80rhWlIocifpk OUangb3OBfrTsdyIN1YVqMcJi4YErxEFagHk87JV6wkeDY+zL6F+7NU6M+6nwSF9l46m Wm0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TvXNNzmxs8OCRlFLmQcxyAwboeqpLp87lURD/I8onMU=; b=kU3VaGv5WMlSsDHyFVe6Tz0hvv78HDUasRExpiI+yPj+wMUyV6NrXIO6oznl00zVko 6Al4jzmiVNxFciy8lrFsk8xAa7pTUFfq3qwdfKIUl9y0C/5juhzjdHvY/U9q01OJgfFm RqdO9SpKyWUg4riPkUIsk9DCzgSAlhzMbcMAS6rH7+87SfBqLVZjr5v8VENZvXCi6ss8 19gvP2ucoE7veqm4pB7LCUZ2XlADHnFN/ISZ+QWcbkN/Zry3irwS9ojA0yGnjU8Kg3hb IF3Z9F0rVkk8JgBtAEAtd2juSDvRkGsDANh86ioheBLGyHVScK1K41IshCHiJsduy0Pt 7Dtg== X-Gm-Message-State: APf1xPDiMWi0Fz7dcMIs69Ksi+wgoj8cx6TzN4KQlsSG3M2exiJnabN+ DSX1C2LxY63CZed0SxAAPinmLw60oIA= X-Google-Smtp-Source: AH8x225SkUSGRr4PbEDNRdVMGz34dgDTMTmNABxiBfIMTGWODFj4cP+B4MoLgcFaBzulSdb1xT9xDw== X-Received: by 10.55.39.208 with SMTP id n199mr4773324qkn.138.1518738299881; Thu, 15 Feb 2018 15:44:59 -0800 (PST) Received: from jeffreys-mbp.wv.cc.cmu.edu (Jeffreys-MBP.wv.cc.cmu.edu. [128.237.189.130]) by smtp.gmail.com with ESMTPSA id n58sm5845584qta.79.2018.02.15.15.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 15:44:59 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) From: Jeffrey Helt In-Reply-To: <12034594-50E0-44EC-A8FD-A9EDA9F18CF9@andrew.cmu.edu> Date: Thu, 15 Feb 2018 18:44:57 -0500 Cc: users@dpdk.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180214170806.3e670b57@xeon-e3> <12034594-50E0-44EC-A8FD-A9EDA9F18CF9@andrew.cmu.edu> To: Stephen Hemminger X-Mailer: Apple Mail (2.3445.5.20) Subject: Re: [dpdk-users] Building a shared library that uses DPDK 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: Thu, 15 Feb 2018 23:45:00 -0000 > On Feb 14, 2018, at 9:34 PM, Jeffrey Helt = wrote: >=20 >=20 >> On Feb 14, 2018, at 8:08 PM, Stephen Hemminger = wrote: >>=20 >> On Wed, 14 Feb 2018 19:06:03 -0500 >> Jeffrey Helt wrote: >>=20 >>> Hi, >>>=20 >>> I am attempting to build a shared library that uses DPDK, = specifically that wraps the Linux socket API and backs it by shared = memory DPDK shared memory regions. I built DPDK 17.11 with = =E2=80=9CCONFIG_RTE_BUILD_SHARED_LIB=3Dy=E2=80=9D. In my shared library = directory, I am using the following Makefile: >>>=20 >>> ifeq ($(RTE_SDK),) >>> $(error "Please define RTE_SDK environment variable") >>> endif >>>=20 >>> # Default target, can be overridden by command line or environment >>> RTE_TARGET ?=3D x86_64-native-linuxapp-gcc >>>=20 >>> include $(RTE_SDK)/mk/rte.vars.mk >>>=20 >>> # binary name >>> SHARED =3D libshim.so >>>=20 >>> # all source are stored in SRCS-y >>> SRCS-y :=3D wrap_socket.c >>>=20 >>> CFLAGS +=3D -O3 >>>=20 >>> include $(RTE_SDK)/mk/rte.extshared.mk >>>=20 >>> However, whenever I try to use my library, such as with = "LD_PRELOAD=3D./build/lib/libshim.so ./test=E2=80=9D, I receive "symbol = lookup error: ./build/lib/libshim.so: undefined symbol: rte_eal_init=E2=80= =9D. What am I missing? >>>=20 >>> Thank you in advance for help! >>>=20 >>> Jeff >> The DPDK builds lots of little shared libraries. >> You need to have all of them in your LD_LIBRARY_PATH and then add = your socket wrapper. >=20 > Using `export = LD_LIBRARY_PATH=3D"/users/jhelt/dpdk/x86_64-native-linuxapp-gcc/lib/librte= _eal.so=E2=80=9D` before building and/or running doesn=E2=80=99t seem to = change anything. Using ldd, I noticed that no dpdk shared objects are = required by my library (see below), which seems like a more fundamental = issue to me, although admittedly I am not that experienced in debugging = linking issues. >=20 > $ ldd ./build/lib/libshim.so=20 > linux-vdso.so.1 =3D> (0x00007fff907e2000) > libc.so.6 =3D> /lib/x86_64-linux-gnu/libc.so.6 = (0x00007fe76b06a000) > /lib64/ld-linux-x86-64.so.2 (0x00007fe76b636000)=20 >=20 > Jeff I managed to solve this issue. For future reference for anyone facing a = similar issue, I needed to update the Makefile to the following. Note = the LDLIBS. The "LDFLAGS +=3D --no-undefined=E2=80=9D was helpful in = debugging missing symbols but is not required. After this change, I = still needed to add the DPDK lib directory to my LD_LIBRARY_PATH as = Stephen suggested. Jeff include $(RTE_SDK)/mk/rte.vars.mk # binary name SHARED =3D libshim.so # all source are stored in SRCS-y SRCS-y :=3D wrap_socket.c CFLAGS +=3D -O3 LDFLAGS +=3D --no-undefined LDLIBS +=3D -ldl -l:librte_eal.so include $(RTE_SDK)/mk/rte.extshared.mk