Error on Linux: "cannot find source code for runtime library file 'object.d' "

Vectrum vectrum at rediffmail.com
Sat Mar 2 02:54:47 PST 2013


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.





More information about the Digitalmars-d mailing list