From: Fabrice Fontaine Date: Thu, 13 Sep 2018 18:24:19 +0000 (+0200) Subject: zeromq: fix static build with libatomic X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=14f5cb7daa54644da981cae0e1dbbfc6d4c18993;p=buildroot.git zeromq: fix static build with libatomic Second patch added support to link with -latomic if needed however using LDFLAGS doesn't work when statically linking because LDFLAGS is added before LIBS Detection of atomic fails with: configure:23230: /accts/mlweber1/instance-2/output/host/bin/sparc-linux-g++ -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -static -static -pedantic -Werror -Wall -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -Wno-long-long -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -static -latomic conftest.cpp -lrt -lpthread -lstdc++ >&5 /tmp/ccgrvVTg.o: In function `main': conftest.cpp:(.text.startup+0x10): undefined reference to `__atomic_fetch_add_4' collect2: error: ld returned 1 exit status So use LIBS instead of LDFLAGS As second patch was already merged upstream, a new PR was sent: https://github.com/zeromq/libzmq/pull/3250 Fixes: - http://autobuild.buildroot.net/results/c471d6b1061a8516f7772735e471db68a32965aa Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- diff --git a/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch b/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch index a0c188a5c3..233b364662 100644 --- a/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch +++ b/package/zeromq/0002-acinclude.m4-check-if-latomic-is-needed.patch @@ -11,9 +11,11 @@ try fails, we try to link again with -latomic and add LIBS="-latomic" in case we succeeded. Signed-off-by: Asaf Kahlon +Signed-off-by: Fabrice Fontaine +[Update to use LIBS: https://github.com/zeromq/libzmq/pull/3250] --- - acinclude.m4 | 32 ++++++++++++++++++++++++++++---- - 1 file changed, 28 insertions(+), 4 deletions(-) + acinclude.m4 | 31 +++++++++++++++++++++++++++---- + 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index f648ed0f..aa35195f 100644 @@ -28,7 +30,7 @@ index f648ed0f..aa35195f 100644 /* atomic intrinsics test */ int v = 0; int main (int, char **) -@@ -677,9 +677,33 @@ int main (int, char **) +@@ -677,9 +677,32 @@ int main (int, char **) return t; } ])], @@ -39,8 +41,8 @@ index f648ed0f..aa35195f 100644 + [libzmq_cv_has_atomic_instrisics="no"]) + + if test "x$libzmq_cv_has_atomic_instrisics" = "xno"; then -+ save_LDFLAGS=$LDFLAGS -+ LDFLAGS="$LDFLAGS -latomic" ++ save_LIBS=$LIBS ++ LIBS="$LIBS -latomic" + AC_LINK_IFELSE([AC_LANG_SOURCE([ + /* atomic intrinsics test */ + int v = 0; @@ -50,9 +52,8 @@ index f648ed0f..aa35195f 100644 + return t; + } + ])], -+ [libzmq_cv_has_atomic_instrisics="yes" LIBS="-latomic"], -+ [libzmq_cv_has_atomic_instrisics="no"]) -+ LDFLAGS=$save_LDFLAGS ++ [libzmq_cv_has_atomic_instrisics="yes"], ++ [libzmq_cv_has_atomic_instrisics="no" LIBS=$save_LIBS]) + fi + + if test "x$libzmq_cv_has_atomic_instrisics" = "xyes"; then