-
Notifications
You must be signed in to change notification settings - Fork 79
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
Prevent silently falling back to dynamic linking when static linking is explicitly requested #37
base: master
Are you sure you want to change the base?
Conversation
Hm is this really the behavior we want? This means that if you set I could imagine though that if you say |
Hm, I thought that that flag is precisely for signalling that you want to have everything linked statically? I couldn't imagine setting that flag unless I'm deliberately trying to link everything statically. But that might very well be because of my lack of imagination :D |
Is it possible to check whether the static library exists in the filesystem? On macOS some critical libraries are dynamic only, e.g. OTOH I need everything else to be really static (this might require cooperation from the gcc crate too). For example, on macOS Similarly |
@golddranks my intention with this was to just pass @pornel yeah makes sense to me that we'd use the filesystem to drive decisions about linkage |
Ah, I see. In that case, (a part of) the current behaviour makes totally sense. I still think that resolving whether a lib is a system lib or not before knowing all the search paths may be a bug; what do you think? For example: |
I mean in general linkage is just impossible to get right. Everyone wants something different so no matter what heuristic you have someone will complain that it's not correct for them. If you have all the heuristics then others will complain that it's too complicated and they can't just do what they know is right. I don't mind bug fixes of course, but there's got to be a line somewhere at some point... Where do lookup paths come into play here? I don't think this crate currently probes the filesystem yet? |
The lookup paths come into play because the
|
This check was introduced in this commit, if it helps to refresh your memory of its purpose: 9a57960 |
Could this change to just check |
There were two problems with the current code:
if lib flags are parsed before directory flags, the full search paths are not available yet, and a library may be mistakenly deemed as a system library. Resolution: process the lib flags only after the loop, when search paths are fully known.
The variable
statik
istrue
when static linking has been explicitly requested. However, theis_system
check can prevent the static branch from being selected, and dynamic link flags are passed. Because static build has been explicitly requested, it would be better just to panic with an error message instead of doing unexpected behaviour.