zeromq: add libatomic linkage when available
PATCH 1/1 zeromq: add libatomic linkage when available
Fixes:
http://autobuild.buildroot.net/results/ff5f7d3bcd713db9c9d92a746d6ad7134748fe16
http://autobuild.buildroot.net/results/9a743da1c3be673288c3482a9e7ddea12750206f
http://autobuild.buildroot.net/results/818b12387e6117569c4fab310b98c11fac80c047
If libatomic is available, it should be added to LIBS in CONF_ENV, since without it we can get into a state in which symbols like __atomic_fetch_sub_4, __atomic_compare_exchange_4 and __atomic_fetch_add_4 can't be found.
--- package/zeromq/zeromq.mk | 4 ++++ 1 file changed, 4 insertions(+)
package/zeromq/zeromq.mk +4 -0
@@ -58,4 +58,8 @@ else ZEROMQ_CONF_OPTS += --disable-libunwind endif +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) +ZEROMQ_CONF_OPTS += LIBS=-latomic +endif + $(eval $(autotools-package))
Signature · 1 line
2.17.0
PATCH 1/1 zeromq: add libatomic linkage when available
Hello Asaf,
Quoted 19 lines · Asaf Kahlon
Fixes:
http://autobuild.buildroot.net/results/ff5f7d3bcd713db9c9d92a746d6ad7134748fe16
http://autobuild.buildroot.net/results/9a743da1c3be673288c3482a9e7ddea12750206f
http://autobuild.buildroot.net/results/818b12387e6117569c4fab310b98c11fac80c047If libatomic is available, it should be added to LIBS in
CONF_ENV, since without it we can get into a state in which symbols like__atomic_fetch_sub_4,__atomic_compare_exchange_4and__atomic_fetch_add_4can't be found.Signed-off-by Asaf Kahlon <[email protected]>--- package/zeromq/zeromq.mk | 4 ++++ 1 file changed, 4 insertions(+)package/zeromq/zeromq.mk +0
-0
package/zeromq/zeromq.mk else · line 63
Quoted 6 lines
package/zeromq/zeromq.mk +3
-0@@ -58,4 +58,8 @@ else ZEROMQ_CONF_OPTS += --disable-libunwind endif +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) +ZEROMQ_CONF_OPTS += LIBS=-latomic +endif
While this does fix the problem, I don't think it's the most ideal fix. Indeed, the solution should be upstreamed. Currently, zeromq configure.ac uses LIBZMQ_CHECK_ATOMIC_INTRINSICS, which is implemented in acinclude.m4, to detect the availability of atomic intrinsics.
It goes like this:
AC_DEFUN([LIBZMQ_CHECK_ATOMIC_INTRINSICS], [{
AC_MSG_CHECKING(whether compiler supports __atomic_Xxx intrinsics) AC_COMPILE_IFELSE([AC_LANG_SOURCE([
/* atomic intrinsics test */
int v = 0;
int main (int, char **)
{
int t = __atomic_add_fetch (&v, 1, __ATOMIC_ACQ_REL);
return t;
}
])],
[AC_MSG_RESULT(yes) ; libzmq_cv_has_atomic_instrisics="yes" ; $1],
[AC_MSG_RESULT(no) ; libzmq_cv_has_atomic_instrisics="no" ; $2]
)
}])It does only an AC_COMPILE_IFELSE(), so it succeeds on Sparc, as the need for -latomic only appears at link time.
So I believe it should be changed to test with AC_LINK_IFELSE, and if it fails, test with AC_LINK_IFELSE with -latomic, to determine
(1) If atomic intrinsics are available
(2) If -latomic is needed to use atomic intrinsics
Do you think you could have a look at implementing something like this ?
That being said, I agree that a number of other packages in Buildroot are fixed by just passing LIBS=-latomic.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 zeromq: add libatomic linkage when available
Thomas, All,
I completely agree that the solution should be on upstream, and the current solution is easiest one but not the best one. I'll try to build a patch on the upstream and send it here.
Asaf.
Quoted 71 lines · On Sat, Apr 28, 2018, 09:39 Thomas Petazzoni <[email protected]>…
Hello Asaf,
Quoted 2 lines · Asaf Kahlon
Fixes:
http://autobuild.buildroot.net/results/ff5f7d3bcd713db9c9d92a746d6ad7134748fe16
Quoted 1 line
http://autobuild.buildroot.net/results/9a743da1c3be673288c3482a9e7ddea12750206f
Quoted 1 line
http://autobuild.buildroot.net/results/818b12387e6117569c4fab310b98c11fac80c047
Quoted 2 lines
If libatomic is available, it should be added to LIBS in
CONF_ENV, sincewithout
Quoted 13 lines
it we can get into a state in which symbols like
__atomic_fetch_sub_4,__atomic_compare_exchange_4and__atomic_fetch_add_4can't be found.Signed-off-by Asaf Kahlon <[email protected]>--- package/zeromq/zeromq.mk | 4 ++++ 1 file changed, 4 insertions(+)package/zeromq/zeromq.mk +0
-0package/zeromq/zeromq.mk else · line 63
Quoted 6 lines
package/zeromq/zeromq.mk +3
-0@@ -58,4 +58,8 @@ else ZEROMQ_CONF_OPTS += --disable-libunwind endif +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) +ZEROMQ_CONF_OPTS += LIBS=-latomic +endifWhile this does fix the problem, I don't think it's the most ideal fix. Indeed, the solution should be upstreamed. Currently, zeromq configure.ac uses
LIBZMQ_CHECK_ATOMIC_INTRINSICS, which is implemented in acinclude.m4, to detect the availability of atomic intrinsics.It goes like this:
AC_DEFUN([LIBZMQ_CHECK_ATOMIC_INTRINSICS], [{
AC_MSG_CHECKING(whether compiler supports __atomic_Xxx intrinsics)AC_COMPILE_IFELSE([AC_LANG_SOURCE([
/* atomic intrinsics test */
int v = 0;
int main (int, char **){ int t = __atomic_add_fetch (&v, 1, __ATOMIC_ACQ_REL); return t; } ])], [AC_MSG_RESULT(yes) ; libzmq_cv_has_atomic_instrisics="yes" ; $1], [AC_MSG_RESULT(no) ; libzmq_cv_has_atomic_instrisics="no" ; $2] ) }])It does only an
AC_COMPILE_IFELSE(), so it succeeds on Sparc, as the need for -latomic only appears at link time.So I believe it should be changed to test with
AC_LINK_IFELSE, and if it fails, test withAC_LINK_IFELSEwith -latomic, to determine(1) If atomic intrinsics are available
(2) If -latomic is needed to use atomic intrinsics
Do you think you could have a look at implementing something like this ?
That being said, I agree that a number of other packages in Buildroot are fixed by just passing LIBS=-latomic.
Quoted 8 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180429/a2dce3f6/attachment.html>
PATCH 1/1 zeromq: add libatomic linkage when available
Hello Asaf,
Quoted 3 lines · Asaf Kahlon
I completely agree that the solution should be on upstream, and the current solution is easiest one but not the best one. I'll try to build a patch on the upstream and send it here.
Do you have any news about this ? If needed, you can leverage some code from Mesa3D, which I've just patched earlier today:
https://lists.freedesktop.org/archives/mesa-dev/2018-May/194214.html
It would be nice to have a patch in the near future, to fix this build issue. Let me know if you need help for this.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com