Skip to content

Arm and libatomic #3092

Closed
Closed
@Grimler91

Description

@Grimler91

Consider this code:

#include <atomic>
std::atomic<float> x(0.0f);
int main() { return (float)x; }

Which is taken from cmake's $PREFIX/lib/cmake/llvm/CheckCompilerVersion.cmake and used for checking for libstdc++4.8 or newer. When compiling this on arm with clang++ tmp.cpp I get

/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/tmp/tmp-77121f.o: in function `main':
tmp.cpp:(.text+0x40): undefined reference to `__atomic_load_4'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)

We get the same error for some i686 (and arm?) packages when cross-compiling, but there it can be solved with -latomic. Compiling on device with clang++ -latomic tmp.cpp has no effect though, it gives the same error message.

I suppose this is due to the difference between android's linker and the standard gnu/Linux linker, and we can solve this by linking one of llvm/clang's libraries against libatomic.a. But which one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug reportSomething is not working properly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions