On 19.06.2011 23:52, Peter Alexander wrote:
I've been having strange linker errors recently and I have no ideas
why they've started happening.
When compiling/linking:
import std.stdio;
void main() { writeln("Hello"); }
with DMD 2.053 I get linker error:
Undefined symbols:
"_D3std9exception7bailOutFAyaixAaZv", referenced from:
_D3std9exception148__T7enforceTbVAyaa60_2f4c6962726172792f436f6d70696c6572732f646d64322f6f73782f62696e2f2e2e2f2e2e2f7372632f70686f626f732f7374642f737464696f2e64Vi1481Z7enforceFbLAxaZb
in test.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
My first thought was that it isn't linking with phobos, but compiling
with -v confirms that it is:
gcc test.o -o test -m32 -Xlinker
-L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm
My GCC version is 4.2.1
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
I've tried re-downloading DMD again, but this didn't work.
It appeared to start happening after running an update of all my
outdated packages in MacPorts, but I can't be sure that that's the issue.
Any help tracking down the problem would be much appreciated. Thanks.
I had a lot of undefined linker symbols on linux recently, in the end I
had to rebuild dmd, druntime & phobos from the latest git master.
--
Dmitry Olshansky