-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Executable fails to link when using Regex with --static-swift-stdlib (Linux)
#62034
Comments
|
FWIW I just found this issue after posting a longer breakdown on the forums here. In short, I can confirm this is breaking Android builds as well currently. |
|
Sorry. Haven't had a chance to look yet. It's definitely good that the error is catching though. It's UB otherwise. |
|
FWIW @etcwilde I noticed the Android build (which links via ldd in my setup) mentions the symbol is originating from I imagine this will be the same for other linux builds. |
|
So, this is way worse than I thought, and is definitely UB So the one from the stdlib is defined in Meanwhile, we also have: So, yeah, there are two, different, implementations of these functions. One uses C calling conventions, the other Swift. If you did manage to get a binary out of this, I would tell you not to touch it because it's going to be buggy in hard-to-debug ways. Thanks for bringing this up. |
Yeah, this is UB everywhere. Fixing it should work, yes. |
|
@etcwilde good to know! I did get a binary out of this by using the dodgy hack described in my link above to the Swift Forums. I then ran into another issue, which may or may not be related, namely that the static Android build (which should be similar to the linux build in most ways) fails when looking for symbols from the objc runtime, which shouldn't be linked at all on Linux. Again, not sure if that's related to the issue here – it seems unlikely, but maybe? |
|
Wait, no, those are different. I'll have to take a closer look later. |
|
I wouldn't trust anything that you get out though. If you have two of the same symbol, it's UB and can do anything it likes. |
|
Thanks a lot for the advice! That's good to know. I didn't plan to trust it, but even if I wanted to, the resulting binary fails to link at runtime due to the unsatisfied link error looking for the objc runtime ( |
|
This should have made it into the 5.7 branch: swiftlang/swift-experimental-string-processing#544 |
|
@etcwilde that's interesting. I don't really understand how certain commits are chosen for a particular release. I am using By the way, the objc runtime issue was unrelated. For that I also needed to link |
Before the release branch is cut, everything going onto |
|
I have been using the Update: I do not get the multiple symbol, but I do get lots of undefined reference, eg: |
|
I'm going to close this as the duplicate symbol was resolved in 5.7.2. @koliyo if you are still seeing this, please file a new issue, thanks! It could be completely unrelated 🤔 |
Describe the bug
The new
Regextype cannot be used together with--static-swift-stdlib. I've confirmed this on Swift 5.7.1 and on the latest main snapshot (2022-11-03). Sometimes clean builds work, but subsequent incremental builds fail with a linker error. Similar behavior is observed when using just-Xswiftc -static-executable.Steps To Reproduce
Steps to reproduce the behavior:
Regextype in some way (e.g.try Regex("abc"))swift build --static-swift-stdlibExpected behavior
Building and linking should succeed.
Screenshots
Here's some example output:
Environment (please fill out the following information)
The text was updated successfully, but these errors were encountered: