aws / aws/aws-sdk-cpp

`libatomic` linking needed for some archs (arm, ppc)

Open
#3,546 2 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
C++
Stars
2.2k
Forks
1.2k
Avg merge
3d 14h
Merged PRs (30d)
12

Description

### 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 > 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.