View previous topic :: View next topic |
Author |
Message |
TPJ
Joined: 29 Oct 2007 Posts: 3
|
Posted: Mon Oct 29, 2007 7:17 am Post subject: object.d file not found |
|
|
Hello!
I've just installed (well... I suppose!) DMD on my Linux box in the following way:
1) I downloaded the dmd.zip file.
2) The file was extracted to my ~/opt directory.
3) I made the binary files in ~/opt/dmd/bin executable.
4) I copied these files to my ~/bin directory. The directory is on my path.
5) I copied the ~/opt/dmd/lib/libphobos.a file to ~/lib directory. This directory is in my LD_LIBRARY_PATH.
I have also put the dmd.conf file in the samples direcory.
Now, when I do "dmd hello.d" all I get is "object.d: module object cannot read file 'object.d'". I haven't found any solution to this problem yet. Could anyone tell me what's wrong? |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Mon Oct 29, 2007 8:00 am Post subject: |
|
|
Take a look at dmd.conf |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Oct 29, 2007 9:13 am Post subject: Re: object.d file not found |
|
|
TPJ wrote: | Now, when I do "dmd hello.d" all I get is "object.d: module object cannot read file 'object.d'". I haven't found any solution to this problem yet. Could anyone tell me what's wrong? | I don't use Linux, so I don't have any specific tips, but I know that the error message you described is a common problem (e.g., 1, 2, 3, 4, 5). IIRC various problems can cause it to appear, but I think that it generally means that the compiler can't find the runtime library (typically it's part of the standard library, Phobos, but some people use Tango).
Also, some users have contributed some tips for installing the compiler: Installing D Compiler |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Tue Oct 30, 2007 5:43 am Post subject: |
|
|
Have you looked at your DFLAGS? |
|
Back to top |
|
|
TPJ
Joined: 29 Oct 2007 Posts: 3
|
Posted: Wed Oct 31, 2007 3:59 am Post subject: |
|
|
All right, I have finally found some time to play with D. I have solved the problem.
The (default) dmd.conf was incorrect. I have set the DFLAGS to "-I/path/to/my/src/phobos -L-L/path/to/my/dmd/lib", and compilation started to work. But there was still some linking problem, ld wasn't able to find libphobos.a. I did linking manually by "gcc <all the dmd stuff here> -L/path/to/my/dmd/lib".
(The big thanks to jcc7 for the link to wiki. It's much better than the official installation instructions!)
Now the only problem is that the simple "hello" program is 186372 bytes big. I find the fact very disappointing, but it's another story. |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Wed Oct 31, 2007 8:52 am Post subject: |
|
|
No thanks to me for telling you you had an issue with your dmd.conf file?
I see how it is... |
|
Back to top |
|
|
TPJ
Joined: 29 Oct 2007 Posts: 3
|
Posted: Thu Nov 08, 2007 2:51 am Post subject: |
|
|
And also big thanks for okibi for pointing out the dmd.conf file!
BTW, the problem is that I thought my dmd.conf file was OK because I had read that it should be OK out of the box. It wasn't.
It looks that Java made me a lazy man who thinks everything can work just out of the box |
|
Back to top |
|
|
Destructionator
Joined: 17 Sep 2007 Posts: 9 Location: New York State
|
Posted: Sun Nov 18, 2007 9:32 pm Post subject: |
|
|
dmd does work out of the box... if you leave it in the box; you actually took too many steps there. Unzip the zip file, do the chmod +x, but then call dmd from the dmd/bin/dmd location; don't copy it out to bin, don't copy phobos to lib.
What I did on my system was added a tiny script to my /usr/bin called dmd:
[code]
#!/bin/bash
/home/me/d/dmd/bin/dmd $*
[/quote]
I probably could have used a symlink too, but this worked.
Alternatively, you could add the bin folder from the zip to your path. But just leaving it in place when unzipping makes it much easier to work with.
As to why the exe is so big when you compile it, there are two reasons: 1) the standard library is statically linked into every executable. This is the big one, and will be fixed in later versions. The upside of this is you can distribute your binary files without requiring the users download an additional shared library to use them.
Reason 2 is the default compile doesn't optimize nor strip; running strip on your binary might shave off a few kilobytes. |
|
Back to top |
|
|
|