Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fedora 22 - compile - __atomic_is_lock_free

I am try to compile a software (SuperCollider) on Fedora 22 but I run into a problem:

libsupernova.a(server.cpp.o): In function `std::atomic<boost::lockfree::detail::tagged_index>::is_lock_free() const':
/usr/include/c++/5.1.1/atomic:212: undefined reference to `__atomic_is_lock_free'
collect2: error: ld returned 1 exit status
server/supernova/CMakeFiles/supernova.dir/build.make:96: recipe for target 'server/supernova/supernova' failed
make[2]: *** [server/supernova/supernova] Error 1
CMakeFiles/Makefile2:3383: recipe for target 'server/supernova/CMakeFiles/supernova.dir/all' failed
make[1]: *** [server/supernova/CMakeFiles/supernova.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2

It seems to me that this is a problem with libatomic. Is it possible that gcc does not link to libatomic?

Does someone have any idea on how to solve this problem?

Another idea would be to try to install -latomic, but I cannot find information about. Instead I already installed libatomic. I don't know if they are the same.

like image 761
TakeMeToTheMoon Avatar asked Jul 13 '15 11:07

TakeMeToTheMoon


2 Answers

i ran into the same issue, and yes you do need to link libatomic. the way to do this is to add to the line: set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to the top level CMakeLists.txt file before running cmake.

the full flow might look like this:

  • git clone https://github.com/supercollider/supercollider.git
  • cd supercollider
  • add set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to top level CMakeLists.txt
  • run ccmake . to configure the install
  • mkdir _build ; cd _build
  • cmake ..
  • make && <sudo> make install

you may or may not need sudo depending on where you have decided to install supercollider.

like image 139
Andrew Young Avatar answered Sep 21 '22 22:09

Andrew Young


It seems to me that this is a problem with libatomic. Is it possible that gcc does not link to libatomic?

It only links to libatomic if you tell it to.

Does someone have any idea on how to solve this problem?

Link to libatomic.

Another idea would be to try to install -latomic, but I cannot find information about. Instead I already installed libatomic. I don't know if they are the same.

You can't "install -latomic" because -latomic is the compiler/linker option that says to link to libatomic, and you can't "install a linker option" because it's an option to a program, not a package.

You install libatomic, then you link to it with -latomic

(Aside: I hope to fix GCC so that you won't need to use -latomic explicitly for simple cases, only more complex ones, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65913)

like image 21
Jonathan Wakely Avatar answered Sep 21 '22 22:09

Jonathan Wakely