-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
boost: Link Python when boost_python is fetched #6447
Conversation
packages/b/boost/fetch.lua
Outdated
_add_info(linkinfo, result) | ||
found = true | ||
end) | ||
if found or package:config("shared") then |
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.
when package:config("shared") == false
, use static libs, but shared libs are found. result will be shared libs.
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.
Thank you for your feedback. In #6399 , I encountered an issue where boost_test_exec_monitor
and boost_exception
were only available as static libraries, and were inadvertently mixed with shared libraries, causing a double free at runtime.
Typically, only shared libraries are installed, with static libraries sometimes included as well. Given that shared libraries take priority during linking, there's a risk of mistakenly linking shared libraries when the fetch result includes static ones.
Therefore, I guess preferring shared libraries might help avoid this issue.
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.
I know, but if package:config("shared") == false
, we should only fetch static libraries.
if you want to use shared libraries, you should use add_requires("boost", {configs = {shared = true}})
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.
Sorry for the confusion, here’s my thought:
Currently, when static libraries are fetched, shared libraries are actually used due to their presence.
To clarify this situation and avoid mixing shared libraries (which are available both as shared and static) with pure static libraries (only available as static), it might make sense to always prefer shared libraries when possible, considering that add_requires("openssl")
or add_deps("python")
are common ways to fetch system-installed libraries, where package:config("shared")
is false, yet shared libraries are still being fetched.
Alternatively, perhaps we could use add_linkgroups("a", "b", {static = true})
to ensure that static libraries are exactly used when fetched?
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.
If you want to ensure compatibility and stability, you should disable system libraries. add_requires("boost", {system = false})
Now many packages' system libraries cannot control whether to choose static libraries or dynamic libraries, and there are many uncertainties.
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.
OK, I'll explore other approaches to address my issue
This PR attempts to address issues #6398
and #6399by:1. Preferring shared libraries for Boost when they are available on the system2. linking Python when
boost_python
is present