Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlicerRT deployment fails on Linux #262

Open
cpinter opened this issue Dec 16, 2024 · 5 comments
Open

SlicerRT deployment fails on Linux #262

cpinter opened this issue Dec 16, 2024 · 5 comments

Comments

@cpinter
Copy link
Member

cpinter commented Dec 16, 2024

See this forum comment: https://discourse.slicer.org/t/segment-statistics-module-on-3d-slicer-5-6-2/40714/8?u=cpinter

Basically the vtkIECTransformLogic binary is deployed to its own directory instead of Slicer-5.7/qt-loadable-modules.

@ferdymercury Since you worked on this on Linux, can you please take a look at this problem? Please let me know if you cannot for some reason. Thank you!

@ferdymercury
Copy link
Contributor

ferdymercury commented Dec 17, 2024

Hi Csaba, sure, I can take a look at this.

If I understand correctly, this issue must be similar to this comment by @lassoan: https://discourse.slicer.org/t/loadable-module-with-external-binary-dependencies/40667/2

But in this case, I am not sure we should add a build step that copies the .so into the qt-loadable-module folder, or whether we should instead try to set the RPATH variable and leave the .so file where it is.

Or maybe we need sth along: https://github.com/Slicer/Slicer/blob/f711b40bb6c530f1c99937536d139fee6650dace/SuperBuild/External_VTK.cmake#L223 ?

@cpinter
Copy link
Member Author

cpinter commented Dec 17, 2024

Yes it is similar but the problem here is that it is deployed but not quite in the right location. I'd try to find what determines the folder where it is copied at packaging. On windows it works well I think (wouldn't swear on my life, I'll check) so there may be an #if (WIN32) somewhere with an install command. I will take a look too if you cannot find it easily. Thanks a lot!

@ferdymercury
Copy link
Contributor

ferdymercury commented Dec 17, 2024

If I modify by hand the ExternalProjectAdd command
from: -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_THIRDPARTY_LIB_DIR}
to: -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/inner-build/lib/Slicer-5.7/qt-loadable-modules

then the .so file is output where it's indicated, but linking later on fails:

Linking CXX shared library ../../lib/Slicer-5.7/qt-loadable-modules/libvtkSlicerBeamsModuleLogic.so
/usr/bin/ld: cannot find /opt/SlicerRT_bld/lib/Slicer-5.7/libvtkIECTransformLogic.so: No such file or directory

Wouldn't it make more sense that Slicer includes by default Slicer_THIRDPARTY_LIB_DIR also to the search path of .so ? Why should everything go into qt-loadable-modules?

The way you solved this for Windows was to add this to SlicerRt main CMakeLists:

set(EXTENSION_CPACK_INSTALL_CMAKE_PROJECTS)
list(APPEND EXTENSION_CPACK_INSTALL_CMAKE_PROJECTS "${vtkIECTransformLogic_DIR};vtkIECTransformLogic;RuntimeLibraries;/")
set(${EXTENSION_NAME}_CPACK_INSTALL_CMAKE_PROJECTS "${EXTENSION_CPACK_INSTALL_CMAKE_PROJECTS}" CACHE STRING "List of external projects to install" FORCE)
list(APPEND CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${EXTENSION_NAME};ALL;/")
list(APPEND CPACK_INSTALL_CMAKE_PROJECTS "${${EXTENSION_NAME}_CPACK_INSTALL_CMAKE_PROJECTS}")

@ferdymercury
Copy link
Contributor

ferdymercury commented Dec 17, 2024

Maybe setting this variable would help? https://github.com/Slicer/Slicer/blob/f711b40bb6c530f1c99937536d139fee6650dace/CMake/SlicerCPack.cmake#L187C20-L187C53

For some reason I cannot test this, since "make package" generates a corrupt 29-bytes tgz file for me.

Run CPack packaging tool...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: SlicerRT
CPack: - Install project: SlicerRT []
CPack: Create package
CPack: - package: /opt/SlicerRT_bld/33025-linux-amd64-SlicerRT-gitc30dfc4-2024-11-22.tar.gz generated.

@lassoan
Copy link
Member

lassoan commented Dec 17, 2024

If the CMakeLists.txt files of the external library are properly written then linking and installation of the libraries woek well on all platforms without any extra build or installation steps. See for example how IGSIO or OpenIGTLink libraries are built and packaged with Slicer modules (SlicerIGSIO and SlicerOpenIGTLink extensions). You probably also want to make your library pip-installable outside of Slicer - in this case you can use vtkAddon library as an example. If @jcfr attends the project week in person then it would be a good opportunity to ask help from him.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants