diff mbox series

[v2,5/6] build: another fix for linking with shared libdpdk

Message ID 1516316420-16628-6-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v2,1/6] travis: stop early when installation of cross-packages has failed | expand

Commit Message

Github ODP bot Jan. 18, 2018, 11 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 402 (lumag:travis-upd)
 ** https://github.com/Linaro/odp/pull/402
 ** Patch: https://github.com/Linaro/odp/pull/402.patch
 ** Base sha: 5a4502fc6bc53e6503169da3028f456b64811a0b
 ** Merge commit sha: 3d02540f1ad3c03edc8b784bf0f92b86d9b756a1
 **/
 m4/odp_dpdk.m4                     | 20 ++++++++++++++------
 platform/linux-generic/Makefile.am |  2 +-
 2 files changed, 15 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/m4/odp_dpdk.m4 b/m4/odp_dpdk.m4
index 1887b0431..315a2fc4d 100644
--- a/m4/odp_dpdk.m4
+++ b/m4/odp_dpdk.m4
@@ -17,18 +17,28 @@  AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive])
 
 # _ODP_DPDK_SET_LIBS
 # --------------------
-# Set DPDK_LIBS/DPDK_LIBS_LT depending on DPDK setup
+# Set DPDK_LIBS/DPDK_LIBS_LT/DPDK_LIBS_LIBODP depending on DPDK setup
 AC_DEFUN([_ODP_DPDK_SET_LIBS], [dnl
 AS_IF([test "x$DPDK_SHARED" = "xyes"], [dnl
-    DPDK_LIBS_LT=""
+    # applications don't need to be linked to anything, just rpath
+    DPDK_LIBS_LT="$DPDK_RPATH_LT"
+    # static linking flags will need -ldpdk
     DPDK_LIBS="$DPDK_LDFLAGS $DPDK_RPATH $DPDK_LIBS"
+    # link libodp-linux with -ldpdk
+    DPDK_LIBS_LIBODP="$DPDK_LDFLAGS $DPDK_LIBS"
 ], [dnl
     ODP_DPDK_PMDS([$DPDK_PMD_PATH])
+    # build long list of libraries for applications, which should not be
+    # rearranged by libtool
     DPDK_LIBS_LT="`echo $DPDK_LIBS | sed -e 's/^/-Wc,/' -e 's/ /,/g'`"
     DPDK_LIBS_LT="$DPDK_LDFLAGS $DPDK_PMDS $DPDK_LIBS_LT $DPDK_LIBS"
+    # static linking flags follow the suite
     DPDK_LIBS="$DPDK_LDFLAGS $DPDK_PMDS $DPDK_LIBS"
+    # link libodp-linux with libtool linking flags
+    DPDK_LIBS_LIBODP="$DPDK_LIBS_LT"
 ])
 AC_SUBST([DPDK_LIBS])
+AC_SUBST([DPDK_LIBS_LIBODP])
 AC_SUBST([DPDK_LIBS_LT])
 ])
 
@@ -99,7 +109,6 @@  AC_DEFUN([ODP_DPDK], [dnl
 AS_IF([test "x$1" = "xsystem"], [dnl
     DPDK_CPPFLAGS="-isystem/usr/include/dpdk"
     DPDK_LDFLAGS=""
-    DPDK_RPATH=""
     DPDK_LIB_PATH="`$CC --print-file-name=libdpdk.so`"
     if test "x$DPDK_LIB_PATH" = "x" ; then
 	DPDK_LIB_PATH="`$CC --print-file-name=libdpdk.a`"
@@ -115,10 +124,9 @@  AS_IF([test "x$1" = "xsystem"], [dnl
     DPDK_LDFLAGS="-L$DPDK_LIB_PATH"
     DPDK_PMD_PATH="$DPDK_LIB_PATH"
     if test -r "$DPDK_LIB_PATH"/libdpdk.so ; then
-	DPDK_RPATH="-R$DPDK_LIB_PATH"
+	DPDK_RPATH="-Wl,-rpath,$DPDK_LIB_PATH"
+	DPDK_RPATH_LT="-R$DPDK_LIB_PATH"
 	DPDK_SHARED=yes
-    else
-	DPDK_RPATH=
     fi
 ])
 _ODP_DPDK_CHECK([$DPDK_CPPFLAGS], [$DPDK_LDFLAGS], [$2], [$3])
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 9b7ee37e5..3abf765b5 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -271,7 +271,7 @@  endif
 
 __LIB__libodp_linux_la_LIBADD = $(ATOMIC_LIBS)
 __LIB__libodp_linux_la_LIBADD += $(OPENSSL_LIBS)
-__LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS_LT)
+__LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS_LIBODP)
 __LIB__libodp_linux_la_LIBADD += $(PTHREAD_LIBS)
 __LIB__libodp_linux_la_LIBADD += $(TIMER_LIBS)