-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Regression: Cannot create DLL with static runtime on Windows anymore #2568
Comments
Compile + link commands:
|
The commands look ok. I think dub is doing the right thing. The problem appears at least initially to be on ldc's end. Specifically: @kinke thoughts? |
See #2396 (comment) - in your case, you'd need to set This was changed in #2412. I know it's annoying for DLLs linking druntime+Phobos statically, but it made regular DLLs linking against druntime+Phobos DLLs (the default behavior) work out of the box, just like for Posix platforms. |
Thanks. But honestly it is very curious to me why one would want to generate any software with such drastic runtime dependencies. Go binaries are famously self-contained. It is the third time this is changed in D without too much warnings. Arguably the experience of using D for any kind of plugins is worse now. |
FYI: this is not the first time DUB emits non-sensical flags, see for example #647 then patched with 6447a6c See also: #166 where DUB considered only one use case. I think in that case it's the default in LDC which should be changed, not the flags emitted by DUB. It is the same that those above issues in my opinion. Wouldn't it would be completely normal to have |
That is the case. But dub separates compiling and linking (generally a good thing), so this default LDC behavior is mimicked for compilation in #2412.
The deps are there anyway, it's just a question of linking statically or dynamically. Dynamically is the newish default behavior with LDC on Windows - because it's a general requirement when using a process with multiple D binaries (same story on Posix, where |
Related to my issue #2560 |
@MrcSnm mmm that doesn't sound related, "dependencies-xxxx" was maybe recently supported, but historically that didn't work previously. Not sure what are the DUB capabilities there. |
We are able to workaround with DFLAGS, I just wanted to note that lot of people (probably north of hundreds of thousands!) use such static D DLLs with no runtime dependencies in the wild, this is not a use case that has no interest even if it "shouldn't work", or so I hear since 7 years. It works perfectly if you don't use the runtime facilities. Even though it's nice to finally be able to host D dll in D host with runtime enabled on Windows! |
System information
Bug Description
Previously with DUB 1.29.0, the way to create DLL that statically link to msvc was to add the following flags:
Now "-link-defaultlib-shared=false" create untractable errors, and we cannot statically link the MSVC runtime anymore.
This is massively disrupting, as statically linking the C and D runtime is necessary for portability, this is a lesson we learned over and over. So we really do not want a shared runtime, either C or D runtime, this is a nightmare come true for us.
How to reproduce?
dub.json
arpejoe.d
Type:
$ dub
on Windows and see:reprodll.obj : error LNK2019: symbole externe non résolu __imp__D4core3sys7windows3dll12__ModuleInfoZ référencé dans la fonction ldc.dllimport_relocation
Expected Behavior
No problem in DUB 1.29.0, this is a regression.
It should be possible, and even easier, to create a static library without a harmful dependency on
druntime-ldc-shared.dll
Logs
Using DUMPBIN.exe, the faulty DLL has the following import section:
The text was updated successfully, but these errors were encountered: