Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#62848 closed defect (fixed)

redis @6.2.3: Undefined symbols ___atomic_compare_exchange_8 ___atomic_fetch_add_8 ___atomic_load_8

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: dgilman (David Gilman)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: snowleopard i386 Cc:
Port: redis

Description

redis 6.2.3 fails to build on 10.6 i386:

https://build.macports.org/builders/ports-10.6_i386-builder/builds/30848/steps/install-port/logs/stdio

Undefined symbols for architecture i386:
  "___atomic_compare_exchange_8", referenced from:
      _hdr_record_values_atomic in hdr_histogram.o
  "___atomic_fetch_add_8", referenced from:
      _hdr_record_values_atomic in hdr_histogram.o
  "___atomic_load_8", referenced from:
      _hdr_record_values_atomic in hdr_histogram.o
ld: symbol(s) not found for architecture i386

This is a new problem... 6.0.10 built fine on that system.

Change History (5)

comment:1 Changed 3 years ago by barracuda156

Is there a solution? libfilezilla @0.36.0 fails with the same error.

comment:2 Changed 3 years ago by kencu (Ken)

clang-9, and some other clangs, need to have this tweak added:

https://github.com/macports/macports-ports/blob/02f44724971afa0a2359438a02032bb795582df9/lang/llvm-13/Portfile#L308

for a build using some newer gcc, you will have to add in a link to libatomic:

configure.ldflags-append -latomic

comment:3 in reply to:  2 Changed 3 years ago by barracuda156

Replying to kencu:

clang-9, and some other clangs, need to have this tweak added:

https://github.com/macports/macports-ports/blob/02f44724971afa0a2359438a02032bb795582df9/lang/llvm-13/Portfile#L308

for a build using some newer gcc, you will have to add in a link to libatomic:

configure.ldflags-append -latomic

Thank you! It worked.

comment:4 Changed 2 years ago by dgilman (David Gilman)

Resolution: fixed
Status: assignedclosed

In 79d9b4273a4001a8e3cc10d6da12ee058a52927d/macports-ports (master):

redis: update to 7.0.1

Closes: #62848

comment:5 Changed 2 years ago by kencu (Ken)

So the way to fix this libatomic thing is:

use a clang that has i386 atomics enabled (see above. clang used to default to having atomics enabled in compiler_rt, then the default changed we had to specifically enable it again .. I think I fixed all or nearly all of them).

or, only when building with gcc (or more specifically, when building against libgcc, which contains libatomic), add -latomic to the linker flags.

It is indeed some spaghetti to cover off all these permutations. Quite a few configure scripts will test to see if adding libatomic is required to support atomics.

For those that don't, in practical terms, what we usually do is something like this pseudo-code:

if {test for compiler being gcc} {
  configure.ldflags-append -latomic
}
Last edited 2 years ago by kencu (Ken) (previous) (diff)
Note: See TracTickets for help on using tickets.