Inria-Asclepios / medInria-public

Open-source part of the medInria software
https://med.inria.fr/
BSD 4-Clause "Original" or "Old" License
0 stars 9 forks source link

[Tetgen] branch 4.1 does not compile on unix #856

Open mathildemerle opened 3 months ago

mathildemerle commented 3 months ago

On Ubuntu 20, 22 and Fedora we have this compilation error:

/usr/bin/ld: /home/mathildemerle/Dev/MUSICardio4.1/medInria-public_ExtProjs/build/tetgen/lib/libtet.a(tetgen.cxx.o): warning: relocation against `_ZTIi@@CXXABI_1.3' in read-only section `.text.unlikely'
/usr/bin/ld: /home/mathildemerle/Dev/MUSICardio4.1/medInria-public_ExtProjs/build/tetgen/lib/libtet.a(tetgen.cxx.o): relocation R_X86_64_PC32 against symbol `_ZTIi@@CXXABI_1.3' can not be used when making a shared object; recompilé avec -fPIC
/usr/bin/ld : échec de l'édition de liens finale : bad value

Which is due to this synchronisation PR from medInria https://github.com/Inria-Asclepios/medInria-public/pull/845 And specially to:

diff --git a/superbuild/external_projects_tools/EP_Initialisation.cmake b/superbuild/external_projects_tools/EP_Initialisation.cmake
index a454b6f23..61f388cd4 100644
--- a/superbuild/external_projects_tools/EP_Initialisation.cmake
+++ b/superbuild/external_projects_tools/EP_Initialisation.cmake
@@ -14,23 +14,23 @@
 macro(ep_Initialisation ep)

 cmake_parse_arguments(ep_Initialisation
-    "NO_CMAKE_PACKAGE"
+    "NO_CONFIG_FILE"
     "USE_SYSTEM;BUILD_SHARED_LIBS;REQUIRED_FOR_PLUGINS;PACKAGE_NAME"
     ""
     ${ARGN}
     )

-if (NOT ep_Initialisation_USE_SYSTEM)
-    set(ep_Initialisation_USE_SYSTEM OFF)
-endif()
+# if (NOT ep_Initialisation_USE_SYSTEM)
+#     set(ep_Initialisation_USE_SYSTEM OFF)
+# endif()

-if (NOT ep_Initialisation_BUILD_SHARED_LIBS)
-    set(ep_Initialisation_BUILD_SHARED_LIBS ON)
-endif()
+# if (NOT ep_Initialisation_BUILD_SHARED_LIBS)
+#     set(ep_Initialisation_BUILD_SHARED_LIBS ON)
+# endif()

-if (NOT ep_Initialisation_REQUIRED_FOR_PLUGINS)
-    set(ep_Initialisation_REQUIRED_FOR_PLUGINS OFF)
-endif()
+# if (NOT ep_Initialisation_REQUIRED_FOR_PLUGINS)
+#     set(ep_Initialisation_REQUIRED_FOR_PLUGINS OFF)
+# endif()

 if (NOT ep_Initialisation_PACKAGE_NAME)
     set(ep_Initialisation_PACKAGE_NAME ${ep})
@@ -47,8 +47,10 @@ option(USE_SYSTEM_${ep}

 if (USE_SYSTEM_${ep})

-    if(NOT ep_Initialisation_NO_CMAKE_PACKAGE)
-        find_package(${ep_Initialisation_PACKAGE_NAME} REQUIRED)
+  if(NOT ep_Initialisation_NO_CONFIG_FILE)
+  find_package(${ep_Initialisation_PACKAGE_NAME} REQUIRED
+      PATH_SUFFIXES install build
+      )

 ## #############################################################################
 ## Complete superProjectConfig.cmake
@@ -71,30 +73,28 @@ else()
 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-  if(NOT ep_Initialisation_NO_CMAKE_PACKAGE)
-      if (ep_Initialisation_REQUIRED_FOR_PLUGINS)
-          if (DEFINED ${ep}_BINARY_DIR)
-              file(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
-                  "find_package(${ep_Initialisation_PACKAGE_NAME} REQUIRED
-                      PATHS \"${${ep_Initialisation_PACKAGE_NAME}_BINARY_DIR}\"
-                      PATH_SUFFIXES install build
-                      )\n"
-                  )
-          else()
-              if(DEFINED EP_PATH_BUILD)
-                  set(build_dir ${EP_PATH_BUILD})
-              else()
-                  set(build_dir "${EP_PATH_SOURCE}/${ep}-build" )
-              endif()
-
-              file(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
-                  "find_package(${ep} REQUIRED
-                      PATHS \"${build_dir}\"
-                      PATH_SUFFIXES install build
-                      )\n"
-                  )
-          endif()
-      endif()
+  if (ep_Initialisation_REQUIRED_FOR_PLUGINS)
+    if (DEFINED ${ep}_BINARY_DIR)
+      file(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
+      "find_package(${ep_Initialisation_PACKAGE_NAME} REQUIRED
+        PATHS \"${${ep_Initialisation_PACKAGE_NAME}_BINARY_DIR}\"
+        PATH_SUFFIXES install build
+        )\n"
+      )
+    else()
+    if(DEFINED EP_PATH_BUILD)
+        set(build_dir ${EP_PATH_BUILD})
+    else()
+        set(build_dir "${EP_PATH_SOURCE}/${ep}-build" )
+    endif()
+
+      file(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
+        "find_package(${ep} REQUIRED
+          PATHS \"${build_dir}\" 
+          PATH_SUFFIXES install build
+          )\n"
+        )
+    endif()
   endif()

diff --git a/superbuild/projects_modules/qwt.cmake b/superbuild/projects_modules/qwt.cmake
index 8353a2bff..642b8cf97 100644
--- a/superbuild/projects_modules/qwt.cmake
+++ b/superbuild/projects_modules/qwt.cmake
@@ -16,7 +16,7 @@ EP_Initialisation(${ep}
   USE_SYSTEM OFF 
   BUILD_SHARED_LIBS OFF
   REQUIRED_FOR_PLUGINS ON
-  NO_CMAKE_PACKAGE
+  NO_CONFIG_FILE
 )

 if (NOT USE_SYSTEM_${ep})

-> red: does not compile, green: compile

edit: the original diff included https://github.com/medInria/medInria-public/pull/1216 and https://github.com/medInria/medInria-public/pull/1214 but it seems it's the second one that create the compilation error.

mathildemerle commented 3 months ago

I edited the diff part with only the remaining problematic code. The compilation error seems to be due to this PR which has been done on medInria: https://github.com/medInria/medInria-public/pull/1214