Commit 4662ad6a authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

SuperBuild: patch itk to fix python failing test (issue with dlopen)

parent 31a875eb
......@@ -160,4 +160,12 @@ ExternalProject_Add(ITK
CMAKE_COMMAND ${SB_CMAKE_COMMAND}
)
SUPERBUILD_PATCH_SOURCE(ITK)
set(ITK_DIFF_FILES ${CMAKE_SOURCE_DIR}/patches/ITK/itk-1-fftw-all.diff)
if(UNIX AND NOT APPLE)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
set (ITK_DIFF_FILES "${ITK_DIFF_FILES} ${CMAKE_SOURCE_DIR}/patches/ITK/itk-2-dlopen_gcc41-linux.diff")
endif()
endif()
SUPERBUILD_PATCH_SOURCE(ITK "" ${ITK_DIFF_FILES})
......@@ -94,6 +94,7 @@ macro(SUPERBUILD_PATCH_SOURCE project)
set(${project}_PATCH_DIR ${CMAKE_SOURCE_DIR}/patches/${project})
string(TOLOWER ${project} patch_dir_prefix)
set(PATCH_ARGS "${ARGV1}")
if(WIN32)
set(DIFF_FILE_MATCH_STRING "win")
if(NOT PATCH_ARGS)
......@@ -107,22 +108,29 @@ macro(SUPERBUILD_PATCH_SOURCE project)
endif()
endif() #WIN32
#If files_list is not empty we notify user about it.
#Custom patches requrired for...
#if an optional diff file is mentioned. then only that is applied
set(DOT_DIFF_FILES "${ARGV2}")
if(NOT DOT_DIFF_FILES)
#If DOT_DIFF_FILES is empty,
#we try to list files ending with all.diff of <DIFF_FILE_MATCH_STRING>.diff
#the final list is stored in DOT_DIFF_FILES and applied using patch.cmake
#Custom patches requrired for...
#glob all files ending with DIFF_FILE_MATCH_STRING.diff
file(GLOB files_list "${${project}_PATCH_DIR}/${patch_dir_prefix}*${DIFF_FILE_MATCH_STRING}.diff")
#glob all files ending with DIFF_FILE_MATCH_STRING.diff
file(GLOB files_list "${${project}_PATCH_DIR}/${patch_dir_prefix}*${DIFF_FILE_MATCH_STRING}.diff")
#glob all files ending with all.diff
file(GLOB all_files_list "${${project}_PATCH_DIR}/${patch_dir_prefix}*all.diff")
#glob all files ending with all.diff
file(GLOB all_files_list "${${project}_PATCH_DIR}/${patch_dir_prefix}*all.diff")
#merge two list for the final one
list(APPEND files_list ${all_files_list})
#merge two list for the final one
list(APPEND files_list ${all_files_list})
#because we are passing it cmake_command using -D!!
string(REPLACE ";" " " DOT_DIFF_FILES "${files_list}")
#because we are passing it cmake_command using -D!!
string(REPLACE ";" " " DOT_DIFF_FILES "${files_list}")
endif()
if(files_list)
if(DOT_DIFF_FILES)
message(STATUS " Custom patches required for ${project}")
ExternalProject_Add_Step(${project} ${project}_custom_patch
COMMAND
......
#Purpose: loading application via python fails This was due to exporting symbols from shared library
#GCC FAQ says to add RTLD_GLOBAL flag when using dlopen apart from -Wl,-E linker flags
diff -burN InsightToolkit-4.10.0.orig/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx InsightToolkit-4.10.0/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx
--- InsightToolkit-4.10.0.orig/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx 2016-08-17 11:32:27.000000000 +0200
+++ InsightToolkit-4.10.0/Modules/ThirdParty/KWSys/src/KWSys/DynamicLoader.cxx 2016-08-17 11:33:16.000000000 +0200
@@ -491,7 +491,7 @@
//----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{
- return dlopen(libname.c_str(), RTLD_LAZY);
+ return dlopen(libname.c_str(), RTLD_LAZY | RTLD_GLOBAL );
}
//----------------------------------------------------------------------------
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment