-
Notifications
You must be signed in to change notification settings - Fork 372
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
Avoid naming conflicts by installing shared objects to lib/nest instead of lib #1513
Conversation
@clinssen Thanks a lot for your work. Following @jougs's comment in #1222, I have been working on the documentation of I am happy pausing the work in #1515 until a decision is made here. We can then update the documentation accordingly in order to reflect any potential changes to |
No problem! I don't think there is any overlap in content of the PRs. We should indeed first decide whether or not to keep NEST_MODULE_PATH and then go from there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks! I think this looks good in general and I mostly have minor comments.
One slightly bigger thing I noticed is a lot of repetitive changes altering ${CMAKE_INSTALL_LIBDIR}
to ${CMAKE_INSTALL_LIBDIR}/nest
. Would it be possible to re-set the variable to the latter just once somewhere in the central CMakeLists.txt
? I think that would be just as expressive but safer.
Co-Authored-By: Jochen Martin Eppler <[email protected]>
Co-Authored-By: Jochen Martin Eppler <[email protected]>
Co-Authored-By: Jochen Martin Eppler <[email protected]>
Co-Authored-By: Jochen Martin Eppler <[email protected]>
Thanks for the feedback! The reason that the value of
Because This behaviour is consistent with the documentation (https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html — see e.g. https://cmake.org/cmake/help/latest/command/install.html for example usage where they append a subdirectory to the CMake variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick turnover! All questions resolved. Approving!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Approved!
Fixes #1222
Fixes #1195
Currently, shared objects (.so files) generated during the NEST Simulator build process are installed to
${CMAKE_INSTALL_PREFIX}/lib
. This behaviour is dangerous because it can potentially overwrite existing system libraries. For example, in case the prefix is/usr
or~/.local
, any file by the namelibrandom.so
,libprecise.so
,libmodels.so
and so on, that is already present in/usr/lib
or~/.local/lib
, will be overwritten. I heard that a naming conflict did indeed happen in the past with an Infiniband library namedlibtopology.so
, which overlaps with the NEST shared object by the same name.Generally, libraries are expected to use a unique prefix for their files (in our case, this would be "nest", so our files would be
libnesttopology.so
,libnestrandom.so
, etc.) Other libraries (seels /usr/lib
) seem to prefer to create their own subdirectories. This means that we would have one subdirectory callednest
, under which we would place all .so files generated during the build (libtopology.so
,librandom.so
, ...) In fact, this directory already exists, but is currently only used for user modules: the MyModule example, as well as NESTML generated modules are installed there.This PR proposes to install all but one .so file in
lib/nest
to avoid potential naming collisions with existing files in thelib
directory—the PyNEST .so file will be unaffected and stay inlib/python3.x/site-packages/nest
.Thanks to @Silmathoron for initially pointing this out! (See nest/nestml#480).
Notes for reviewers:
${CMAKE_INSTALL_LIBDIR}
equal tolib
rather than set it tolib/nest
, because of the PyNEST library that is installed inlib/python3.x/site-packages/nest
, i.e. not underlib/nest
.NEST_MODULE_PATH
entirely, as it is now equal to the path for all other shared objects, and thus already in the rpath/LD_LIBRARY_PATH?