From 5b9dc18218e959e027cead8183bc7fbdc1fb9d81 Mon Sep 17 00:00:00 2001 From: Ake Sandgren Date: Mon, 2 Sep 2024 19:22:09 +0200 Subject: [PATCH] update dorado to properly use openssl from EB and not install external EB libraries into its own lib directory. --- .../dorado-0.7.3-foss-2023a-CUDA-12.1.1.eb | 25 ++++++--- ....7.3_dont_install_external_libraries.patch | 54 +++++++++++++++++++ 2 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 easybuild/easyconfigs/d/dorado/dorado-0.7.3_dont_install_external_libraries.patch diff --git a/easybuild/easyconfigs/d/dorado/dorado-0.7.3-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/d/dorado/dorado-0.7.3-foss-2023a-CUDA-12.1.1.eb index 7aa8f29b002..0e32e9616ca 100644 --- a/easybuild/easyconfigs/d/dorado/dorado-0.7.3-foss-2023a-CUDA-12.1.1.eb +++ b/easybuild/easyconfigs/d/dorado/dorado-0.7.3-foss-2023a-CUDA-12.1.1.eb @@ -20,10 +20,15 @@ sources = [{ }, 'filename': SOURCE_TAR_GZ, }] -patches = ['dorado-0.7.3_include-fstream.patch'] +patches = [ + '%(name)s-%(version)s_include-fstream.patch', + '%(name)s-%(version)s_dont_install_external_libraries.patch', +] + checksums = [ None, 'a32cbd34185bcc5ae3d552a072e396825aa7184187cd11c70a4380618387a530', + '2a250d606c0ae17f47d99981309fa204a1394ddd81851a1d530dcd0aea2306ac', ] builddependencies = [ @@ -45,7 +50,6 @@ dependencies = [ # don't link to OpenSSL static libraries # fix for CMake Error "missing: OPENSSL_CRYPTO_LIBRARY" (if only shared OpenSSL libraries are available) preconfigopts = "sed -i '/OPENSSL_USE_STATIC_LIBS TRUE/d' ../dorado/cmake/OpenSSL.cmake && " -preconfigopts += "export OPENSSL_ROOT_DIR=$EBROOTOPENSSL && " # link in the ssl and crypto libs, to fix: # undefined reference to symbol 'SSL_get_peer_certificate@@OPENSSL_1_1_0' preconfigopts += "sed -i 's/OpenSSL::SSL/ssl\\n crypto/g' ../dorado/dorado/utils/CMakeLists.txt && " @@ -63,12 +67,17 @@ preconfigopts += "sed -i 's/htslib/hts/g' ../dorado/dorado/utils/CMakeLists.txt # cfr. https://github.com/nanoporetech/dorado/issues/779 preconfigopts += "sed -i 's/-Werror//g' ../dorado/cmake/Warnings.cmake && " -configopts = "-DDORADO_INSTALL_PATH=%(installdir)s " -configopts += "-DCUDA_TOOLKIT_ROOT_DIR=$EBROOTCUDA -DCMAKE_CUDA_COMPILER=$EBROOTCUDA/bin/nvcc " -configopts += "-DDORADO_LIBTORCH_DIR=$EBROOTPYTORCH/lib " -# add -pthread flag (in addition to -lpthread) to avoid linking error: -# in function `_GLOBAL__sub_I_mutex.cc': mutex.cc:(.text.startup+0x17): undefined reference to `pthread_atfork' -configopts += '-DCMAKE_C_FLAGS="$CFLAGS -pthread" ' +_copts = [ + "-DCUDA_TOOLKIT_ROOT_DIR=$EBROOTCUDA", + "-DCMAKE_CUDA_COMPILER=$EBROOTCUDA/bin/nvcc", + '-DOPENSSL_ROOT_DIR=$EBROOTOPENSSL', + "-DDORADO_LIBTORCH_DIR=$EBROOTPYTORCH/lib", + # add -pthread flag (in addition to -lpthread) to avoid linking error: + # in function `_GLOBAL__sub_I_mutex.cc': mutex.cc:(.text.startup+0x17): undefined reference to `pthread_atfork' + '-DCMAKE_C_FLAGS="$CFLAGS -pthread"', +] + +configopts = ' '.join(_copts) sanity_check_paths = { 'files': ['bin/dorado'], diff --git a/easybuild/easyconfigs/d/dorado/dorado-0.7.3_dont_install_external_libraries.patch b/easybuild/easyconfigs/d/dorado/dorado-0.7.3_dont_install_external_libraries.patch new file mode 100644 index 00000000000..67bd9efee78 --- /dev/null +++ b/easybuild/easyconfigs/d/dorado/dorado-0.7.3_dont_install_external_libraries.patch @@ -0,0 +1,54 @@ +Don't install external libraries in Dorado's lib directory. + +Åke Sandgren, 2024-09-02 +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a84c7524..0791dda8 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -431,7 +431,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + else() + # bundle the libraries from the cuda toolkit + file(GLOB NATIVE_CUDA_LIBS "${CUDAToolkit_TARGET_DIR}/targets/${CMAKE_SYSTEM_PROCESSOR}-linux/lib/${LIB}") +- install(FILES ${NATIVE_CUDA_LIBS} DESTINATION lib COMPONENT redist_libs) ++ #install(FILES ${NATIVE_CUDA_LIBS} DESTINATION lib COMPONENT redist_libs) + endif() + endforeach() + +@@ -444,14 +444,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + RESOLVE_SYMLINKS("${DEBUG_LIBRARIES}" NEW_HDF_DEBUG_LIBRARIES) + foreach(HDF_LIB IN LISTS NEW_HDF_DEBUG_LIBRARIES) + if(${HDF_LIB} MATCHES "hdf5") +- install(FILES ${HDF_LIB} DESTINATION lib COMPONENT redist_libs CONFIGURATIONS Debug) ++ #install(FILES ${HDF_LIB} DESTINATION lib COMPONENT redist_libs CONFIGURATIONS Debug) + endif() + endforeach() + FILTER_LIST("${HDF5_C_LIBRARIES}" RELEASE_LIBRARIES optimized debug ${SHARED_LIB_EXT}) + RESOLVE_SYMLINKS("${RELEASE_LIBRARIES}" NEW_HDF_RELEASE_LIBRARIES) + foreach(HDF_LIB IN LISTS NEW_HDF_RELEASE_LIBRARIES) + if(${HDF_LIB} MATCHES "hdf5") +- install(FILES ${HDF_LIB} DESTINATION lib COMPONENT redist_libs CONFIGURATIONS Release ReleaseWithDebInfo) ++ #install(FILES ${HDF_LIB} DESTINATION lib COMPONENT redist_libs CONFIGURATIONS Release ReleaseWithDebInfo) + endif() + endforeach() + endif() +@@ -459,17 +459,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_library(SZ_DLL sz REQUIRED) + get_filename_component(SZ_DLL_PATH ${SZ_DLL} DIRECTORY) + file(GLOB SZ_DLLS "${SZ_DLL_PATH}/libsz.so*") +- install(FILES ${SZ_DLLS} DESTINATION lib COMPONENT redist_libs) ++ #install(FILES ${SZ_DLLS} DESTINATION lib COMPONENT redist_libs) + + find_library(AEC_DLL aec REQUIRED) + get_filename_component(AEC_DLL_PATH ${AEC_DLL} DIRECTORY) + file(GLOB AEC_DLLS "${AEC_DLL_PATH}/libaec.so*") +- install(FILES ${AEC_DLLS} DESTINATION lib COMPONENT redist_libs) ++ #install(FILES ${AEC_DLLS} DESTINATION lib COMPONENT redist_libs) + + # If zstd has been dynamically linked, add the .so to the package + get_filename_component(ZSTD_LIBRARY_PATH ${ZSTD_LIBRARY_RELEASE} DIRECTORY) + file(GLOB ZSTD_DLLS "${ZSTD_LIBRARY_PATH}/*zstd.so*") +- install(FILES ${ZSTD_DLLS} DESTINATION lib COMPONENT redist_libs) ++ #install(FILES ${ZSTD_DLLS} DESTINATION lib COMPONENT redist_libs) + + elseif(WIN32) + file(GLOB TORCH_DLLS "${TORCH_LIB}/lib/*.dll")