Rawtherapee: Fix Clang 6 OMP build

Created on 22 Aug 2018  路  5Comments  路  Source: Beep6581/RawTherapee

Hi,

I'm currently building the latest dev on Debian 10 i386. While building with GCC 8.2 is just fine, Clang 6.0 fails to link with some undefined reference to __atomic_load errors. This is a known problem.

Here's a patch that fixes it for me:

diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt
index b1c05d3b5..74a6db9ae 100644
--- a/rtgui/CMakeLists.txt
+++ b/rtgui/CMakeLists.txt
@@ -225,6 +225,10 @@ else()
         )
 endif()

+if(OPENMP_FOUND)
+    set(EXTRA_LIB_RTGUI ${EXTRA_LIB_RTGUI} "atomic")
+endif()
+
 # Create config.h which defines where data are stored
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h")

Best,
Fl枚ssie

patch provided bug

Most helpful comment

@Beep6581 @heckflosse @gaaned92 Thanks for testing!

@Benitoite Also, thanks for testing. As long as I've no info about the exact Clang version that needs libatomic, I'll disable its addition for APPLE. So, here's an update:

diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt
index b1c05d3b5..8150fbce3 100644
--- a/rtgui/CMakeLists.txt
+++ b/rtgui/CMakeLists.txt
@@ -225,6 +225,10 @@ else()
         )
 endif()

+if(OPENMP_FOUND AND NOT APPLE)
+    set(EXTRA_LIB_RTGUI ${EXTRA_LIB_RTGUI} "atomic")
+endif()
+
 # Create config.h which defines where data are stored
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h")

All 5 comments

6d60d109 + patch compiled and ran fine in Sabayon, GCC Gentoo Hardened 6.4.0-r1 p1.3

Compiled and ran fine on Win7/64 gcc.exe (Rev2, Built by MSYS2 project) 7.3.0

Patch gives this error on MacOS 10.12 with clang++-mp-3.9

[100%] Linking CXX executable rawtherapee
ld: library not found for -latomic
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Compilation and installation is ok without patch.

OK also with patch on W10 with GCC 8.2.0

@Beep6581 @heckflosse @gaaned92 Thanks for testing!

@Benitoite Also, thanks for testing. As long as I've no info about the exact Clang version that needs libatomic, I'll disable its addition for APPLE. So, here's an update:

diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt
index b1c05d3b5..8150fbce3 100644
--- a/rtgui/CMakeLists.txt
+++ b/rtgui/CMakeLists.txt
@@ -225,6 +225,10 @@ else()
         )
 endif()

+if(OPENMP_FOUND AND NOT APPLE)
+    set(EXTRA_LIB_RTGUI ${EXTRA_LIB_RTGUI} "atomic")
+endif()
+
 # Create config.h which defines where data are stored
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h")

Was this page helpful?
0 / 5 - 0 ratings