FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

object.d file not found

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
TPJ



Joined: 29 Oct 2007
Posts: 3

PostPosted: Mon Oct 29, 2007 7:17 am    Post subject: object.d file not found Reply with quote

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
View user's profile Send private message
okibi



Joined: 04 Jan 2007
Posts: 170

PostPosted: Mon Oct 29, 2007 8:00 am    Post subject: Reply with quote

Take a look at dmd.conf
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Mon Oct 29, 2007 9:13 am    Post subject: Re: object.d file not found Reply with quote

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
View user's profile Send private message AIM Address
okibi



Joined: 04 Jan 2007
Posts: 170

PostPosted: Tue Oct 30, 2007 5:43 am    Post subject: Reply with quote

Have you looked at your DFLAGS?
Back to top
View user's profile Send private message
TPJ



Joined: 29 Oct 2007
Posts: 3

PostPosted: Wed Oct 31, 2007 3:59 am    Post subject: Reply with quote

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
View user's profile Send private message
okibi



Joined: 04 Jan 2007
Posts: 170

PostPosted: Wed Oct 31, 2007 8:52 am    Post subject: Reply with quote

No thanks to me for telling you you had an issue with your dmd.conf file?

I see how it is... Very Happy
Back to top
View user's profile Send private message
TPJ



Joined: 29 Oct 2007
Posts: 3

PostPosted: Thu Nov 08, 2007 2:51 am    Post subject: Reply with quote

And also big thanks for okibi for pointing out the dmd.conf file! Smile


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 Wink
Back to top
View user's profile Send private message
Destructionator



Joined: 17 Sep 2007
Posts: 9
Location: New York State

PostPosted: Sun Nov 18, 2007 9:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group