-
Notifications
You must be signed in to change notification settings - Fork 10.5k
fix SR-3819: add -ldl to static executables (almost certainly needed … #7188
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
fix SR-3819: add -ldl to static executables (almost certainly needed … #7188
Conversation
CC: @jrose-apple This definitely doesn't feel like the right place for this. We need to sink this knowledge into the driver. |
I don't have a better idea that doesn't involve the driver calling out to icuconfig with every static link. cc @dabrahams, the owner of Swift's interface with ICU. |
@jrose-apple not sure how I can help, here. |
I agree with @jrose-apple , the correct thing to do would be to call out to |
@swift-ci please smoke test |
@jrose-apple / @dabrahams any ideas on how we can move this one forward? |
I think we're waiting for someone to look at ICU and decide what the right behavior is. I'm not opposed to this patch as long as it doesn't break any configurations. |
@jrose-apple correct me if I'm wrong but additionally linking |
@jrose-apple Waiting for someone, like who? I don't really understand what this problem is about, so I've not been weighing in here even though @weissi has @-invoked me. But it does seem like it's not clear what the next steps are. Could you try to clarify that? Thanx |
Someone needs to
It's possible that's what @weissi already has, but I'm not quite convinced yet. :-) I was hoping your familiarity with ICU would help with this, but I guess that's more at the API level, not the project integration parts. @weissi: No libdl.a in the search paths is actually a possibility, right? It's easier to add extra arguments than to remove them. |
@jrose-apple writ large:
Yeah, I haven't really had to think through any linking issues in years, so maybe that should be someone else. You know who the ICU and linking experts are, right? |
The underlying issue is the In fact the
So I think the correct fix is to see if the upstream package can be built with different options so that the static libraries dont use the |
This is reassuring in both directions: first, that there might be a better solution; and second, that even if we do have to link libdl it won't be an undue burden on the built executable. |
@spevans / @jrose-apple what are we doing with this PR then? |
@weissi I dont think this solution is correct. Static executables shouldnt be calling any dl functions. Even glibc doesnt like being statically linked with
Although it works its not really correct. The correct solution is to use a Even when building with a static Foundation and static |
@spevans whilst on a theoretical level I agree with you that static executables shouldn't really call out do Let's go through why
The points you make don't show that what I'm doing in this PR isn't correct, they show that libicu and glibc despite having Does that make sense? Here more background info for Ubuntu 16.04:
|
@weissi Yes from a technically correct POV this fix is wrong however in reality the following are true so I dont have any strong objections:
I wonder what would happen if a static executable using However just bear in mind that if using Foundation there will be more issues than this since there arent even Also see #9958 which make |
Note that we're already passing in So all we're doing is harmonising what we're building the statically linked library with the executables that result from using that library. |
Okay, this latest discussion makes me feel better too. Let's re-run the tests just to be sure (it's been months), but then we can take this. @swift-ci Please test Linux |
…by ICU)
Resolves SR-3819. ICU compiled in default mode (without
--disable-dyload
) needs to be linked with-ldl
as it needsdl{open,close,sym}
(even in its static versionlibdl.a
). This adds-ldl
to the linker flags for static executables.