0027152: Undefined symbols in library TKernel.so using clang compiler
authorapn <apn@opencascade.com>
Wed, 17 Feb 2016 12:59:12 +0000 (15:59 +0300)
committerabv <abv@opencascade.com>
Sat, 20 Feb 2016 15:43:49 +0000 (18:43 +0300)
Added ldl dependency for TKernel only (other toolkits were checked, no undefined symbols)
Added  option "-z defs" for linking on Linux
Added lm dependency for all toolkits

adm/cmake/occt_csf.cmake
adm/cmake/occt_defs_flags.cmake
src/TKernel/EXTERNLIB

index 2a83eac..6a6d263 100644 (file)
@@ -77,6 +77,7 @@ else()
     set (CSF_ThreadLibs  "pthread rt stdc++")
     set (CSF_OpenGlLibs  "GLU GL")
     set (CSF_XwLibs      "X11 Xext Xmu Xi")
+    set (CSF_dl          "dl")
 
     if (USE_TCL)
       set (CSF_TclLibs     "tcl${3RDPARTY_TCL_LIBRARY_VERSION}")
index aeda51c..fb70c15 100644 (file)
@@ -92,6 +92,17 @@ if (MSVC)
   endif()
 elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
+  if (BUILD_SHARED_LIBS)
+    if (APPLE)
+      set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
+    else()
+      set (CMAKE_SHARED_LINKER_FLAGS "-lm -z defs ${CMAKE_SHARED_LINKER_FLAGS}")
+    endif()
+  else()
+    if (NOT ANDROID)
+      set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
+    endif()
+  endif()
 endif()
 
 if (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
index 53e3355..c2a9cf8 100755 (executable)
@@ -3,3 +3,4 @@ CSF_advapi32
 CSF_gdi32
 CSF_user32
 CSF_TBB
+CSF_dl
\ No newline at end of file