Ableton / link

Ableton Link
Other
1.06k stars 145 forks source link

Linking Link fails with clang/clazzy due to undefined reference to `__atomic_is_lock_free' #120

Closed JoergAtGithub closed 1 year ago

JoergAtGithub commented 2 years ago

I got the following linker error, when I compile with clang or clazy:

[100%] Linking CXX executable mixxx-test
/usr/bin/ld: libmixxx-lib.a(abletonlink.cpp.o): in function `std::__atomic_base<unsigned int>::is_lock_free() const':
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/atomic_base.h:384: undefined reference to `__atomic_is_lock_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I could fix this, by including the following CMake module from KDE to my project: https://invent.kde.org/graphics/krita/-/commit/c2ea92c55535f00cf72661680e1ee8fb10116d74

cdi-ableton commented 2 years ago

Hello. You probably need -latomic. Can you check if that works?

JoergAtGithub commented 2 years ago

Yes -latomic works of cause, but adding a general dependency, which is only needed by one of the major compilers, is not how CMake is supposed to be used. CMake should test during configuration phase, which dependencies are needed on the particular platform, and than link only these.

cdi-ableton commented 1 year ago

Absolutely! I just wanted to verify that there are no other issues here. We'll look into making CMake conditionally add this dependency.

cdi-ableton commented 1 year ago

I'm closing this issue since it should be resolved with 1f12bcb81119919bb5b004d8771929cd6b3ac912.