-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[cmake] [c++] use .dylib extension unconditionally on macOS #6418
Conversation
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.
Seems reasonable 😄 👍
Thanks very much! @guolinke could you also comment when you have time? As you might remember more context for why this was first added back in #6418 (review). |
I don't remember, but this change looks reasonable to me |
Alright thanks for checking, and for the review @borchero ! Let's proceed with this then. |
Short Description
Proposes the following changes to CMake-based builds of LightGBM:
APPLE_OUTPUT_DYLIB
CMake optionlib_lightgbm.dylib
on macOSBenefits of these changes
lib_lightgbm
working correctly with tools that use string matching on file extensions to guess file format (instead of examining the magic bytes)find_library()
calls or customfind_*()
CMake scripts in other projects would be able to findlib_lightgbm
on macOSNotes for Reviewers
This is just changing the file name, not the actual format
The shared library LightGBM currently produces on macOS is actually in mach-o format, not ELF. The CMake customization removed in this PR literally just changes the file name.
I couldn't find a strong reason that LightGBM needs to produce a lib_lightgbm.so on macOS
Looks like that was first added in 70c31c0 back in December 2016. @guolinke do you remember why?
The
APPLE_OUTPUT_DYLIB
option was then added in #204.Why call this "breaking"?
Changing this filename could cause the following types of problems for applications depending on LightGBM on macOS:
lib_lightgbm.so
will no longer find itlib_lightgbm.so
in environment variableLD_PRELOAD
will no longer workIn my opinion, these are worthwhile costs in exchange for the benefits.
How were these particular changes identified?
I searched like this:
I believe I've caught all the places that need to be changed. Thankfully this project has pretty good CI coverage on macOS (including Python, R, and SWIG), so I think we can be confident that this is working whenever CI for all macOS jobs passes.