Skip to content

libatomic linking needed for some archs (arm, ppc) #3546

@barracuda156

Description

@barracuda156

Describe the bug

Some archs require linking to libatomic, otherwise build fails to link with undefined ___atomic_fetch_add_8 etc.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

On platforms without hardware support for 8-byte atomics, libatomic should be used.

Current Behavior

[  7%] Linking CXX shared library libaws-cpp-sdk-core.dylib
cd /opt/local/var/macports/build/aws-sdk-cpp-14f15bf3/work/build/src/aws-cpp-sdk-core && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/aws-cpp-sdk-core.dir/link.txt --verbose=ON
Undefined symbols for architecture ppc:
  "___atomic_fetch_add_8", referenced from:
      Aws::Utils::Threading::ReaderWriterLock::UnlockWriter() in ub_core.cpp.o
      Aws::Utils::Threading::ReaderWriterLock::LockReader() in ub_core.cpp.o
      Aws::Utils::Threading::ReaderWriterLock::LockWriter() in ub_core.cpp.o
  "___atomic_fetch_sub_8", referenced from:
      Aws::Utils::Threading::ReaderWriterLock::UnlockReader() in ub_core.cpp.o
      Aws::Utils::Threading::ReaderWriterLock::LockWriter() in ub_core.cpp.o
  "___atomic_load_8", referenced from:
      Aws::Client::AWSAuthSigner::GetClockSkewOffset() const in ub_core.cpp.o
  "___atomic_store_8", referenced from:
      Aws::Client::AWSAuthSigner::SetClockSkew(std::chrono::duration<long long, std::ratio<1ll, 1000ll> > const&) in ub_core.cpp.o
      __ZN3Aws6Client13AWSAuthSignerC4Ev in ub_core.cpp.o
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status

Reproduction Steps

Run the build on an affected platform.

Possible Solution

Add a configure test to CMakeLists for support of 8-byte atomics.

Additional Information/Context

Relevant for some 32-bit archs: arm, ppc, possibly mips.

AWS CPP SDK version used

1.11.649

Compiler and Version used

gcc 14.3.0

Operating System and version

macOS 10.6.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions