digitalmars.D.learn - linkererrors when reducion phobos with dustmite
- berni44 (17/17) Jan 06 2020 As mentioned on the dustmite website [1] I copied the folder std
- H. S. Teoh (13/31) Jan 08 2020 Use dmd -i should solve the problem.
- berni44 (3/4) Jan 09 2020 Oh, thanks, now it works... (Have been using rdmd too long, so I
As mentioned on the dustmite website [1] I copied the folder std from Phobos in a separate folder and renamed it to mystd. The I changed all occurences of std by mystd in all files. That works most of the time, but sometimes I get hundreds of linker errors I do not understand: $> dmd -main -unittest -g -run mystd/variant.d /usr/bin/ld: variant.o:(.data.rel.ro+0x68): undefined reference to `_D5mystd4meta12__ModuleInfoZ' /usr/bin/ld: variant.o:(.data.rel.ro+0x70): undefined reference to `_D5mystd6traits12__ModuleInfoZ' /usr/bin/ld: variant.o:(.data.rel.ro+0x78): undefined reference to `_D5mystd8typecons12__ModuleInfoZ' ... Does anyone know, what's the problem here and how to get arround this? [1] https://github.com/CyberShadow/DustMite/wiki#minimizing-the-standard-library
Jan 06 2020
On Mon, Jan 06, 2020 at 10:27:09AM +0000, berni44 via Digitalmars-d-learn wrote:As mentioned on the dustmite website [1] I copied the folder std from Phobos in a separate folder and renamed it to mystd. The I changed all occurences of std by mystd in all files. That works most of the time, but sometimes I get hundreds of linker errors I do not understand: $> dmd -main -unittest -g -run mystd/variant.d /usr/bin/ld: variant.o:(.data.rel.ro+0x68): undefined reference to `_D5mystd4meta12__ModuleInfoZ' /usr/bin/ld: variant.o:(.data.rel.ro+0x70): undefined reference to `_D5mystd6traits12__ModuleInfoZ' /usr/bin/ld: variant.o:(.data.rel.ro+0x78): undefined reference to `_D5mystd8typecons12__ModuleInfoZ' ... Does anyone know, what's the problem here and how to get arround this?Use dmd -i should solve the problem. The problem is that you didn't specify some of the imported modules on the command-line, and there was a reference to something in that module other than a template (templates are instantiated in the importing module, so they tend to work in spite of this omission). When you don't specify -i, dmd does not pull in imported files because it doesn't know whether you're using separate compilation, in which case the missing symbols would be resolved at link time and emitting them again would cause a linker duplicate symbol error. T -- People tell me that I'm skeptical, but I don't believe them.
Jan 08 2020
On Wednesday, 8 January 2020 at 19:55:57 UTC, H. S. Teoh wrote:Use dmd -i should solve the problem.Oh, thanks, now it works... (Have been using rdmd too long, so I always forget about other modules to be included.)
Jan 09 2020