Bug 15904 – Undefined reference to ModuleInfo

Status
REOPENED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-04-09T21:10:53Z
Last change time
2024-12-13T18:47:24Z
Assigned to
No Owner
Creator
andy-hanson
Moved to GitHub: dmd#19114 →

Comments

Comment #0 by andy-hanson — 2016-04-09T21:10:53Z
This error requires multiple modules to reproduce. Recursive imports, `static this`, and `package.d`-style imports are all apparently required to cause the error. app.d: import foo; void main() {} static this() {} foo/package.d: import app; The output of `dmd app.d` is: app.o:(.rodata+0x18): undefined reference to `_D3foo12__ModuleInfoZ' collect2: error: ld returned 1 exit status --- errorlevel 1
Comment #1 by alphaglosined — 2022-11-16T04:18:09Z
The other modules must be compiled into your binary. You can use -i to do this automatically for small build-manager-less software.
Comment #2 by andy-hanson — 2022-11-16T05:09:49Z
`dmd app.d -i` works, but why does `dmd app.d foo/package.d` not work?
Comment #3 by alphaglosined — 2022-11-16T05:26:57Z
It may be because of no module declaration. If it works with the module declaration, it's still a bug, but with a different cause I think (so reopen).
Comment #4 by andy-hanson — 2022-11-16T05:48:06Z
OK, It does work if I add `module foo;` at the beginning of `foo/package.d`.
Comment #5 by robert.schadek — 2024-12-13T18:47:24Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19114 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB