Fedora 22 - compile - __atomic_is_lock_free

一曲冷凌霜 提交于 2019-12-31 01:08:27

问题


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.


回答1:


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.




回答2:


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)



来源:https://stackoverflow.com/questions/31381892/fedora-22-compile-atomic-is-lock-free

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!