SlicerExecutionModel icon indicating copy to clipboard operation
SlicerExecutionModel copied to clipboard

ENH: Include system runtime libraries

Open jamesobutler opened this issue 1 year ago • 2 comments

This is part of addressing https://github.com/Slicer/Slicer/issues/7847.

This avoids a termination fault when running the CLI executable when it was built with a newer MSVC relative to another computer with an older runtime. Including the runtime libraries will make sure compatibility is correct instead of falling back to the system version.

jamesobutler avatar Jul 10 '24 14:07 jamesobutler

Slicer is already expected to package the needed runtime along the application.

I will look at the referenced issue to better understand and see how to fix the root cause.

jcfr avatar Jul 10 '24 16:07 jcfr

It seems that the Slicer.exe launcher itself needs MSVC runtime DLLs, which is an issue, because it will not find them if they are in the bin subfolder. The best would be to link Slicer.exe statically so that it does not need any DLLs to run.

(ignore what I wrote before - since this only comes up when launching a CLI and not when launching Slicer itself, the launcher itself should be fine)

lassoan avatar Jul 10 '24 16:07 lassoan

I am testing this now.

Since the variable CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set, I anticipate the libraries will also be installed in the lib/Slicer-X.Y/cli-modules directory.

Top-level install directory lib/Slicer-X.Y/cli-modules install directory
image image

jcfr avatar Jan 20 '25 21:01 jcfr

I am also implementing the following:

  • moving the call to InstallRequiredSystemLibraries into the if(NOT LOCAL_SEM_NO_INSTALL) block
  • saving & restoring the values of CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION and CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT variables if these were already set

jcfr avatar Jan 20 '25 22:01 jcfr

Locally testing the changes, we can observe that the system libraries are now installed along side the CLIs (in addition of being installed in the top-level bin directory):

Top-level install directory lib/Slicer-X.Y/cli-modules install directory
image !image

jcfr avatar Jan 20 '25 22:01 jcfr