Running the latest 2.061 compiler on my Mac, I have a simple program that imports std.stdio, does a bit of math and then writeln's a result. It compiles and runs fine on my Linux box. On the Mac, I'm getting:
dmd -w -O -inline -noboundscheck p001.d
Undefined symbols for architecture x86_64:
"_D4core5bitop3bsrFNaNbmZi", referenced from:
_D3std5array17__T8popFrontTAyaZ8popFrontFNaNbNeKAyaZv in p001.o
_D3std5array16__T8popFrontTAaZ8popFrontFNaNbNeKAaZv in p001.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Demangling these:
_D4core5bitop3bsrFNaNbmZi
pure nothrow int core.bitop.bsr(ulong)
_D3std5array17__T8popFrontTAyaZ8popFrontFNaNbNeKAyaZv
pure nothrow @trusted void std.array.popFront!(immutable(char)[]).popFront(ref immutable(char)[])
_D3std5array16__T8popFrontTAaZ8popFrontFNaNbNeKAaZv
pure nothrow @trusted void std.array.popFront!(char[]).popFront(ref char[])
Interestingly, I'm not even calling using popFront directly in the program.
It was working with a previous version of the compiler (2.060). I'd installed the latest since I was getting issues with a program that actually uses popFront and thought perhaps the newer version would address this issue. It appears there be dragons in this area.
Yell if there's additional information you require. A skeleton of the program I have is:
import std.stdio;
immutable auto N = 10;
auto func(int n) {
auto d = N / n;
return n * d * (d + 1)/2;
}
void main() {
writeln(func(2)+func(7)-func(14));
}
Comment #1 by code — 2013-02-14T07:24:00Z
This looks like an issue caused by stale files.
Please make sure that you don't have any old druntime module/library files lying around in your search path. If you just copied the 2.061 files over the 2.060 ones, try a completely pristine install to make sure.
Comment #2 by arthur — 2013-02-14T12:47:42Z
(In reply to comment #1)
> This looks like an issue caused by stale files.
>
> Please make sure that you don't have any old druntime module/library files
> lying around in your search path. If you just copied the 2.061 files over the
> 2.060 ones, try a completely pristine install to make sure.
Will check. However, if this does fix the problem, I'd argue there is a bug in the installer script since I used the DMD installer on the Mac to install this... not from a tarball. It should be ensuring the old stuff is nixed.
Comment #3 by arthur — 2013-02-15T03:12:22Z
Confirmed that completely removing D and reinstalling addressed the issue. Apparently the installer doesn't tidy up first.
Comment #4 by arthur — 2013-02-15T03:13:41Z
*** Issue 9509 has been marked as a duplicate of this issue. ***
Comment #5 by smjg — 2013-07-14T06:29:19Z
Was happening under Windows as well, and when just unzipping the files and not using an installer. But I remain confused - even if there were obsolete files in the DMD directory, I would think it wouldn't be a problem as there would be no references to these files in the files that actually are being used.