Bug 17796 – ldc's -oq (write full module path for objects) breaks linking
Status
RESOLVED
Resolution
WONTFIX
Severity
blocker
Priority
P1
Component
visuald
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2017-08-31T06:10:09Z
Last change time
2017-10-22T17:37:45Z
Assigned to
No Owner
Creator
Nicholas Wilson
Comments
Comment #0 by iamthewilsonator — 2017-08-31T06:10:09Z
ldc's `-oq` flag to enable writing the fully qualified module name as the name for the .obj confuses visuald.
It tells the linker to look for
`\build\path\mod.obj` instead of
`\build\path\fully.qualified.name.mod.obj`.
for a module with declaration `module fully.qualified.name.mod;`.
This prevents any projects that require `-oq` (due to their module layout) from linking with visual studio / visuald. One can still use dub (which just calls the compiler directly, it knows what its doing) manually on the command line to successfully build and link.
Comment #1 by r.sagitario — 2017-09-16T15:22:20Z
I guess you specify -oq as an additional command line option? Visual D doesn't interpret that. Instead it uses -op if you enable "keep path from source file" on the Compiler->Output page.
-oq is rather intractable for a build tool because it uses the module name, not the file name to generate the object file name path. It needs quite a bit of extra machinery to determine the actual module name.
If you use "combined compile and link" LDC takes care of calling the linker immediately after compiling, so shouldn't have a problem, too.
BTW: -op and -oq don't work well together: you usually get the package both as a sub directory and as part of the object file name.
Comment #2 by r.sagitario — 2017-10-22T17:37:45Z
-oq doesn't seem to have a sensible use case with separate compilation and linking, use -op instead.