diff mbox series

[1/1] tor: link with libatomic when needed

Message ID 20180614182319.19543-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [1/1] tor: link with libatomic when needed | expand

Commit Message

Fabrice Fontaine June 14, 2018, 6:23 p.m. UTC
Following errors might occur on architectures required to use gcc
libatomics:
sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding
symbols: DSO missing from command line

This is often the case for sparcv8 32 bit toolchains.

See d28591a2ee39704f6795c8aa1d0a3db7e909facc,
55a9d6d55888b04ec6c476399e5b98a2412995f5 and
03f6e005e6a9617767b24a9026da9477848020cc.

Fixes:
 - http://autobuild.buildroot.net/results/0f7107d0b703223f567c6749722bc82c81a04d54

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/tor/tor.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni June 17, 2018, 9:01 p.m. UTC | #1
Hello,

On Thu, 14 Jun 2018 20:23:19 +0200, Fabrice Fontaine wrote:
> Following errors might occur on architectures required to use gcc
> libatomics:

"Might occur" is a bit imprecise. Some architectures have atomic
builtins implemented in libatomic, on such architectures, linking with
libatomic is mandatory.

> diff --git a/package/tor/tor.mk b/package/tor/tor.mk
> index f7af718b9b..fb02741d3a 100644
> --- a/package/tor/tor.mk
> +++ b/package/tor/tor.mk
> @@ -47,6 +47,10 @@ endif
>  # uses gnu extensions
>  TOR_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
>  
> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
> +TOR_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -latomic"

  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>

So, using LIBS is more correct than LDFLAGS.

I've adjusted the commit log, and changed LDFLAGS to LIBS, and applied.
Thanks!

However, it would be nicer to have a solution in the upstream configure
script for this.

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/tor/tor.mk b/package/tor/tor.mk
index f7af718b9b..fb02741d3a 100644
--- a/package/tor/tor.mk
+++ b/package/tor/tor.mk
@@ -47,6 +47,10 @@  endif
 # uses gnu extensions
 TOR_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+TOR_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -latomic"
+endif
+
 define TOR_INSTALL_CONF
 	$(INSTALL) -D -m 644 $(@D)/src/config/torrc.minimal \
 		$(TARGET_DIR)/etc/tor/torrc