diff mbox series

[v1,3/4] build: another fix for linking with shared libdpdk

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

Commit Message

Github ODP bot Jan. 18, 2018, 5 a.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: 1bb6291e4e9050d476fefb02f11024898847e2b7
 ** Merge commit sha: ef2af52ea3f3fb674f4f2dcb187eeede6711cb72
 **/
 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 b7a8ff255..b76a15df1 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -305,7 +305,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)