I have got the same error when using dmd to compile the program
"msmc" https://github.com/lepisorus/msmc.

Error:
Error: cannot find source code for runtime library file 'object.d'
  dmd might not be correctly installed. Run 'dmd -man' for
installation instructions
Specify path to file 'object.d' with -I switch

I also installed the dmd through bash script.
http://www.prowiki.org/wiki4d/wiki.cgi?action=browse&id=D__Tutorial/StartingWithD/Compiler/DMD&oldid=D__Tutorial/InstallingDCompiler

./install-d.sh -d -v 2.065.0

I did the following modification according to the suggestion here:
adding -I/home/lwang/usr/druntime/import in the dmd.conf file.
Now the .conf file looks like:
DFLAGS=-I/home/lwang/usr/include/d/phobos2
-I/home/lwang/usr/druntime/import -L-L/home/lwang/usr/lib

You can see that everything is in my home directory. while the
"druntime" directory is copied there.

After doing the above, I did not get over the error.

I do hope someone can help here, because it has become a pain in
the butt now.



On Saturday, 2 March 2013 at 10:54:48 UTC, Vectrum wrote:
On Friday, 1 March 2013 at 19:12:16 UTC, Jonathan M Davis wrote:
On Friday, March 01, 2013 18:29:53 Vectrum wrote:
I've just started using D but, unfortunately I
got an error while compiling the following
D code;

import std.stdio;
main()
{
writefln("%sHello, World!");
}

It gives me the following error;

$ dmd hello.d
Error: cannot find source code for runtime library file 'object.d'
dmd might not be correctly installed. Run 'dmd -man' for
installation instructions.
import path[0] = /usr/local/src/phobos

I installed D twice, used a shell-script second time when
got the error but so phobos copied to two locations and
dmd.conf has been changed accordingly.

[Environment]
DFLAGS=-I/usr/local/include/d/phobos2 -L-L/usr/local/lib
DFLAGS=-I/usr/local/src/phobos -L-L/usr/local/lib

Plase tell me what is the correct location for the lib and
standard .d files.
I'm getting very frustrated and none bothers to address
the issue. I hope I haven't made a silly mistake.

The correct one is pretty much wherever you want to put them. It's just that you have to put it in dmd.conf. As to your problem, I see three issues right
off the bat:

1. You're resetting DFLAGS, not appending to it. Notice that the only import path listed in your error is the second one. The first one got overwritten. I'd
suggest just putting it all on one line.

2. I don't know why you're listing two locations for Phobos anyway. You need a -I to point to where the Phobos src is located, and there's only one set. -I needs to point to whatever directory std and etc are in order for the compiler
to find Phobos.

3. You're missing druntime's import files (hence the error, since that's where object.di is). So, you need a -I flag pointing to druntime's import directory.

However, if you're not going to use your package manager to install dmd, I'd suggest that you just download the zip file, unzip it somewhere on your box, and add its linux/bin directory to your PATH. If you do that, it should all
just work.

- Jonathan M Davis

Thank you. I have solved it. I have put
dmd2/src/druntime and dmd2/src/phobos
to /usr/local/share and changed dmd.conf
accordingly.

[Environment]

  DFLAGS=-I/usr/local/share/dmd2/src/druntime/import
-I/usr/local/share/dmd
2/src/phobos -L-L%@P%/../lib32 -L-L%@P%/../lib64
-L--no-warn-search-mismatch -L--
export-dynamic

I installed two times and used shell-script for the
second time so dmd.conf entries came in two lines
and I dared not changed it. That's why (at least I assume)
DFLAG value came in two lines. Now I've done it manually
as I got the point.

Unfortunately there is no clear indication that the
two dirs must be on path. We are told to put only
libphobos.a and dmd on path.

Thanks again.

Reply via email to