View mode: basic / threaded / horizontal-split · Log in · Help
March 27, 2011
object.d: Error: module object is in file 'object.d' which cannot be read
When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get
the following error.

"
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] = /etc/../../src/phobos
import path[1] = /etc/../../src/druntime/import
"

I tried all morning to solve this problem, tried every google result I could
find. Checked the mail archive to solve this problem. But I still couldn't get
rid of that error.I anybody can help me, it would be a great help.

I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I
first used the command "cp dmd2/linux/bin/dmd.conf /etc
" . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386
libc6-dev-i386" command.

Thank you :)
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
> object.d: Error: module object is in file 'object.d' which cannot be read
> import path[0] = /etc/../../src/phobos
> import path[1] = /etc/../../src/druntime/import

As you can see dmd.conf uses relative paths.
That guide needs an overhaul.

The easiest way is to copy the contents of the zip archive into some local  
dmd directory and add dmd/linux/bin to your PATH.
(i.e. remove your etc/dmd.conf for now)
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
On 03/27/2011 12:28 PM, Ishan Thilina wrote:
> When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get
> the following error.
>
> "
> object.d: Error: module object is in file 'object.d' which cannot be read
> import path[0] = /etc/../../src/phobos
> import path[1] = /etc/../../src/druntime/import
> "
>
> I tried all morning to solve this problem, tried every google result I could
> find. Checked the mail archive to solve this problem. But I still couldn't get
> rid of that error.I anybody can help me, it would be a great help.
>
> I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I
> first used the command "cp dmd2/linux/bin/dmd.conf /etc
> " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386
> libc6-dev-i386" command.
>
> Thank you :)

First, please always post the piece of code that provokes an error. If it's a 
big or complicated thing, then try to reduce it to the smallest and simplest 
bit possible. Usually, doing this will let you find the source of the problem ;-)

Second, this kind of error is caused by wrong import path (yes, the error 
message could mention "import"). Typically, when one writes eg:
	import range;
instead of
	import std.range;
But your case is strange. Do you know object.d is the core of D's std lib, 
which defines about all what you absolutely need to use when programming in D? 
One does not need to import it, this is automatical. Also, the message says the 
error happens in object.d itself, which is very un-probable.
I thus suspect you named one of your own modules "object.d", which breaks the 
import mechanics (for D's standard object.d and possibly for other 
stdlib/phobos modules). This may be considered as a bug.

denis
-- 
_________________
vita es estrany
spir.wikidot.com
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
On 03/27/2011 12:28 PM, Ishan Thilina wrote:
> When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get
> the following error.
>
> "
> object.d: Error: module object is in file 'object.d' which cannot be read
> import path[0] = /etc/../../src/phobos
> import path[1] = /etc/../../src/druntime/import
> "
>
> I tried all morning to solve this problem, tried every google result I could
> find. Checked the mail archive to solve this problem. But I still couldn't get
> rid of that error.I anybody can help me, it would be a great help.
>
> I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I
> first used the command "cp dmd2/linux/bin/dmd.conf /etc
> " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386
> libc6-dev-i386" command.
>
> Thank you :)

PS: I tried to compile an empty module called "object.d". This gives me pages & 
pages & pages of "undefined x" errors ;-)

denis
-- 
_________________
vita es estrany
spir.wikidot.com
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
Trass3r wrote:

>As you can see dmd.conf uses relative paths.
>That guide needs an overhaul.
>
>The easiest way is to copy the contents of the zip archive into some local
>dmd directory and add dmd/linux/bin to your PATH.
>(i.e. remove your etc/dmd.conf for now)

I did as you have said. Now a new error comes :-/.

"object.d: Error: module object is in file 'object.d' which cannot be read
Specify path to file 'object.d' with -I switch
"

@Spir:

I think you have not understood what my problem is. I'm not trying to solve a
problem with my source code. I'm having an issue in which I can'ct compile code( I
have compiled them using dmd in windows and they can be compiled in linux using GCD)
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
On 2011-03-27 14:55, spir wrote:
> On 03/27/2011 12:28 PM, Ishan Thilina wrote:
>> When I give "dmd untitled.d" command in my ubuntu maverick 64 bit
>> laptop I get
>> the following error.
>>
>> "
>> object.d: Error: module object is in file 'object.d' which cannot be read
>> import path[0] = /etc/../../src/phobos
>> import path[1] = /etc/../../src/druntime/import
>> "
>>
>> I tried all morning to solve this problem, tried every google result I
>> could
>> find. Checked the mail archive to solve this problem. But I still
>> couldn't get
>> rid of that error.I anybody can help me, it would be a great help.
>>
>> I followed the steps in
>> http://www.digitalmars.com/d/2.0/dmd-linux.html .I
>> first used the command "cp dmd2/linux/bin/dmd.conf /etc
>> " . Then I gave "sudo apt-get install gcc-multilib g++-multilib
>> libc6-i386
>> libc6-dev-i386" command.
>>
>> Thank you :)
>
> First, please always post the piece of code that provokes an error. If
> it's a big or complicated thing, then try to reduce it to the smallest
> and simplest bit possible. Usually, doing this will let you find the
> source of the problem ;-)
>
> Second, this kind of error is caused by wrong import path (yes, the
> error message could mention "import"). Typically, when one writes eg:
> import range;
> instead of
> import std.range;
> But your case is strange. Do you know object.d is the core of D's std
> lib, which defines about all what you absolutely need to use when
> programming in D? One does not need to import it, this is automatical.
> Also, the message says the error happens in object.d itself, which is
> very un-probable.
> I thus suspect you named one of your own modules "object.d", which
> breaks the import mechanics (for D's standard object.d and possibly for
> other stdlib/phobos modules). This may be considered as a bug.
>
> denis

The error

"object.d: Error: module object is in file 'object.d' which cannot be read"

usually happens when DMD can't find the sources or phobos.

-- 
/Jacob Carlborg
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
> "object.d: Error: module object is in file 'object.d' which cannot be  
> read
> Specify path to file 'object.d' with -I switch
> "

Could it be you also deleted the dmd.conf in the local dmd/linux/bin?
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
On 2011-03-27 12:28, Ishan Thilina wrote:
> When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get
> the following error.
>
> "
> object.d: Error: module object is in file 'object.d' which cannot be read
> import path[0] = /etc/../../src/phobos
> import path[1] = /etc/../../src/druntime/import
> "
>
> I tried all morning to solve this problem, tried every google result I could
> find. Checked the mail archive to solve this problem. But I still couldn't get
> rid of that error.I anybody can help me, it would be a great help.
>
> I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I
> first used the command "cp dmd2/linux/bin/dmd.conf /etc
> " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386
> libc6-dev-i386" command.
>
> Thank you :)

You can try and installing DMD with my tool, DVM: 
https://bitbucket.org/doob/dvm . It makes it easy to install and switch 
between different versions of DMD. Just run:

wget -O dvm https://bitbucket.org/doob/dvm/downloads/dvm-0.1.1-linux && 
chmod +x dvm && ./dvm install dvm

dvm install 2.052
dvm use 2.052

-- 
/Jacob Carlborg
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
@Jacob:

An error comes when the " ./dvm install dvm" command is given.

"
./dvm: error while loading shared libraries: libz.so.1: cannot open shared object
file: No such file or directory
"

@Trass3r:

No, dmd.conf in the dmd2/linux/bin is there safely
March 27, 2011
Re: object.d: Error: module object is in file 'object.d' which cannot be read
On 2011-03-27 12:24, Ishan Thilina wrote:
> No, dmd.conf in the dmd2/linux/bin is there safely

Perhaps druntime got messed up then. Is

dmd2/src/druntime/import/object.di

there? Or did you ever mess with your dmd.conf? If you're using the default 
and you've left files in place without trying to do stuff like move libraries 
to /usr/lib, then it should work just fine. If you messed with dmd.conf or you 
moved the standard libraries or source around without changing your dmd.conf, 
then it's not going to be able to find the source or libraries.

- Jonathan M Davis
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home