wilzbach / tools-test

1 stars 0 forks source link

RDMD - Symbol Undefined #114

Closed wilzbach closed 10 years ago

wilzbach commented 10 years ago

Note: the issue was created automatically migrated from https://issues.dlang.org

Original bug ID: BZ#13366 From: Gary Willoughby <dev@nomad.uk.net> Reported version: D2 CC: dlang-bugzilla@thecybershadow.net, public@dicebot.lv, sigod.mail@gmail.com

wilzbach commented 10 years ago

Comment author: Gary Willoughby <dev@nomad.uk.net>

I have 2 reduced files, wich i can't compile with new (DMD 2.066) rdmd.exe under Windows 7 32-bit. Also confirmed on Linux (Ubuntu) x64

Command: rdmd --force --build-only aaa.d Message "Error 42: Symbol Undefined _D3etc3bbb3fooFZi"

But command: dmd aaa.d etc\bbb.d Compile without errors. And then i replace rdmd.exe by old (from DMD 2.065) compile OK too.

Sample code:

/ begin of file aaa.d / import etc.bbb;

void main() { int i = foo(); } /***/

/ begin of file etc\bbb.d / module etc.bbb;

public int foo() { return 1; } /***/

Compiled: $ rdmd --force --build-only -I../ aaa.d /tmp/.rdmd-1000/rdmd-aaa.d-869564B02B64C83C3AB4137B2C9D7507/objs/aaa.o: In function _Dmain': aaa.d:(.text._Dmain+0x5): undefined reference to_D3etc3bbb3fooFZi' collect2: error: ld returned 1 exit status

If you change the module name everything works. i.e. change etc to something else.

wilzbach commented 10 years ago

Comment author: Vladimir Panteleev <dlang-bugzilla@thecybershadow.net>

As explained on the forum, "etc" is a package reserved for Phobos.

http://forum.dlang.org/post/igpnvhguqqrlwuaemrug@ forum.dlang.org

I suppose we could narrow it down in rdmd to "etc.c" but really people shouldn't be mixing package names used in Phobos and in their code.

wilzbach commented 10 years ago

Comment author: Dicebot <public@dicebot.lv>

Yes, this user code has always been invalid as it is using standard library package name.

wilzbach commented 10 years ago

Comment author: Gary Willoughby <dev@nomad.uk.net>

Maybe a more descriptive error message could be introduced about reserved package names?

wilzbach commented 10 years ago

Comment author: Vladimir Panteleev <dlang-bugzilla@thecybershadow.net>

I don't think that would be possible unless you knew whether a module is actually part of the standard library (phobos.lib) or not. But, if you solve that, you can solve the original problem since now you know whether to compile/link it or not.

wilzbach commented 10 years ago

Comment author: Vladimir Panteleev <dlang-bugzilla@thecybershadow.net>

Closing, as I don't see how we could make things "just work" in all situations without writing a custom linker.