Fedora 22 - 编译 - __atomic_is_lock_free

Fedora 22 - compile - __atomic_is_lock_free

我正在尝试在 Fedora 22 上编译一个软件 (SuperCollider) 但我 运行 遇到了问题:

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

在我看来,这是 libatomic 的问题。 gcc 有没有可能 link 到 libatomic?

有人知道如何解决这个问题吗?

另一个想法是尝试安装-latomic,但我找不到相关信息。 相反,我已经安装了 libatomic。不知道是不是一样

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

如果您告诉它,它只会 links 到 libatomic。

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

Link 到 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.

你不能 "install -latomic" 因为 -latomic 是 compiler/linker 选项说 link 到 libatomic,你不能 "install a linker option" 因为它是程序的一个选项,而不是程序包。

你安装 libatomic,然后你 link 使用 -latomic

(另外:我希望修复 GCC,这样您就不需要明确地使用 -latomic 来处理简单的情况,只需要更复杂的情况,请参阅 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65913

i 运行 进入同样的问题,是的,你确实需要 link libatomic。这样做的方法是添加到行: set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") 到顶级 CMakeLists.txt 文件之前 运行ning cmake.

完整流程可能如下所示:

  • git clone https://github.com/supercollider/supercollider.git
  • cd supercollider
  • set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") 添加到顶级 CMakeLists.txt
  • 运行 ccmake . 配置安装
  • mkdir _build ; cd _build
  • cmake ..
  • make && <sudo> make install

您可能需要也可能不需要 sudo,具体取决于您决定安装 supercollider 的位置。