Thread overview
Building libraries on Linux
Mar 04, 2006
Sean Kelly
Mar 04, 2006
Thomas Kuehne
Mar 05, 2006
Frank Benoit
March 04, 2006
This one is a tad weird and I'm hoping someone can explain it to me. When I try to build a library on Linux (Ares) and then link against that library, I get a bunch of link errors saying "undefined reference to '_ModuleInfo_3std1c6string'" and so on.  It appears this problem goes away if empty unittest blocks are added to all modules currently lacking unit tests, but this seems an odd fix.  I've tried building the library with a variety of switches for 'ar' but still see the problem.  Am I doing something wrong, or is this a DMD bug?  I can't find any significant differences in how my library is being built compared to how Phobos is built.  Does it actually matter that libphobos.a is built as a demendency of unittest.d?


Sean
March 04, 2006
Sean Kelly schrieb am 2006-03-04:
> This one is a tad weird and I'm hoping someone can explain it to me. When I try to build a library on Linux (Ares) and then link against that library, I get a bunch of link errors saying "undefined reference to '_ModuleInfo_3std1c6string'" and so on.  It appears this problem goes away if empty unittest blocks are added to all modules currently lacking unit tests, but this seems an odd fix.  I've tried building the library with a variety of switches for 'ar' but still see the problem.  Am I doing something wrong, or is this a DMD bug?  I can't find any significant differences in how my library is being built compared to how Phobos is built.  Does it actually matter that libphobos.a is built as a demendency of unittest.d?

unittest.d isn't the cause.

http://dstress.kuehne.cn/dstress.kuehne.cn/complex/typeinfo_init/a.d http://dstress.kuehne.cn/dstress.kuehne.cn/complex/typeinfo_init/b.d

1) FAIL
dmd -c complex/typeinfo_init/a.d
dmd a.o complex/typeinfo_init/b.d

2) FAIL
dmd -c complex/typeinfo_init/b.d
dmd b.o complex/typeinfo_init/a.d

3) PASS
dmd complex/typeinfo_init/a.d complex/typeinfo_init/b.d

Thomas


March 05, 2006
since even "objdump -t file.o" says that the ModuleInfo is not defined, ar cannot fix it.