digitalmars.D - object.d: Error: module object is in file 'object.d' which cannot be read
- Brian Brady <brian.brady1982 gmail.com> Aug 24 2011
- Jonathan M Davis <jmdavisProg gmx.com> Aug 24 2011
- Brian Brady <brian.brady1982 gmail.com> Aug 24 2011
- Don <nospam nospam.com> Dec 31 2011
All
I am having a problem compiling a simple program when working through "The D
Programming Language". The program is like so:
#!/usr/bin/rdmd
import std.stdio, std.string;
void main()
{
//Compute counts
uint[string] freqs;
foreach(line; stdin.byLine())
{
foreach(word; split(strip(line)))
{
++freqs[word.idup];
}
}
//Prints count
foreach(key, value; freqs)
{
writefln("%6u\t%s", value, key);
}
}
but this is the error I get when running it.
brian brians-tower:~/Programming/D$ ./readingHamlet.d
object.d: Error: module object is in file 'object.d' which cannot be read
import path[0] = .
Failed: dmd -v -o- './readingHamlet.d' -I'.' >./readingHamlet.d.deps
I feel its probably something to do with the way I have installed/compiled the
library but I'm at the end of my current knowledge in how to fix this. Any
idea on where I should be looking/what I should be looking for? I have been
following the various advices on how to install the library correctly, but
feel I may have gotten myself into more trouble doing this now.
Regards
Brian
Aug 24 2011
On Wednesday, August 24, 2011 07:57:07 Brian Brady wrote:All I am having a problem compiling a simple program when working through "The D Programming Language". The program is like so: #!/usr/bin/rdmd import std.stdio, std.string; void main() { //Compute counts uint[string] freqs; foreach(line; stdin.byLine()) { foreach(word; split(strip(line))) { ++freqs[word.idup]; } } //Prints count foreach(key, value; freqs) { writefln("%6u\t%s", value, key); } } but this is the error I get when running it. brian brians-tower:~/Programming/D$ ./readingHamlet.d object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = . Failed: dmd -v -o- './readingHamlet.d' -I'.' >./readingHamlet.d.deps I feel its probably something to do with the way I have installed/compiled the library but I'm at the end of my current knowledge in how to fix this. Any idea on where I should be looking/what I should be looking for? I have been following the various advices on how to install the library correctly, but feel I may have gotten myself into more trouble doing this now.
It means that it can't find the source code for druntime. Likely, your dmd.conf is messed up or it's in the wrong place. There should be a dmd.conf file next to the dmd binary. It defaults to something like this [Environment] DFLAGS=-I% P%/../../src/phobos -I% P%/../../src/druntime/import -L- L% P%/../lib64 -L-L% P%/../lib32 -L--no-warn-search-mismatch -L--export- dynamic -L-lrt Assuming that you just unzipped the zip file and used that, then everything should be in the right place. Presumably, the same goes for the deb or rpm packages if you used those. If you moved any of it around yourself, then you're probably going to have to make sure that you have dmd.conf next to the dmd binary and that it actually sets DFLAGS such that it points to where the source for druntime and Phobos is as well as where libphobos.a is. - Jonathan M Davis
Aug 24 2011
== Quote from Jonathan M Davis (jmdavisProg gmx.com)'s articleOn Wednesday, August 24, 2011 07:57:07 Brian Brady wrote:All I am having a problem compiling a simple program when working through "The D Programming Language". The program is like so: #!/usr/bin/rdmd import std.stdio, std.string; void main() { //Compute counts uint[string] freqs; foreach(line; stdin.byLine()) { foreach(word; split(strip(line))) { ++freqs[word.idup]; } } //Prints count foreach(key, value; freqs) { writefln("%6u\t%s", value, key); } } but this is the error I get when running it. brian brians-tower:~/Programming/D$ ./readingHamlet.d object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = . Failed: dmd -v -o- './readingHamlet.d' -I'.' >./readingHamlet.d.deps I feel its probably something to do with the way I have installed/compiled the library but I'm at the end of my current knowledge in how to fix this. Any idea on where I should be looking/what I should be looking for? I have been following the various advices on how to install the library correctly, but feel I may have gotten myself into more trouble doing this now.
is messed up or it's in the wrong place. There should be a dmd.conf file next to the dmd binary. It defaults to something like this [Environment] DFLAGS=-I% P%/../../src/phobos -I% P%/../../src/druntime/import -L- L% P%/../lib64 -L-L% P%/../lib32 -L--no-warn-search-mismatch -L--export- dynamic -L-lrt Assuming that you just unzipped the zip file and used that, then everything should be in the right place. Presumably, the same goes for the deb or rpm packages if you used those. If you moved any of it around yourself, then you're probably going to have to make sure that you have dmd.conf next to the dmd binary and that it actually sets DFLAGS such that it points to where the source for druntime and Phobos is as well as where libphobos.a is. - Jonathan M Davis
Ah yes, that makes sense. I just needed to change the #!/usr/bin/rdmd to where my library was ie. #!/home/brian/dmd2/linux/bin64/dmd which, now that I look at it, makes a lot more sense! Different errors now \o/ Thank you.
Aug 24 2011
On 24.08.2011 10:06, Jonathan M Davis wrote:On Wednesday, August 24, 2011 07:57:07 Brian Brady wrote:All I am having a problem compiling a simple program when working through "The D Programming Language". The program is like so: #!/usr/bin/rdmd import std.stdio, std.string; void main() { //Compute counts uint[string] freqs; foreach(line; stdin.byLine()) { foreach(word; split(strip(line))) { ++freqs[word.idup]; } } //Prints count foreach(key, value; freqs) { writefln("%6u\t%s", value, key); } } but this is the error I get when running it. brian brians-tower:~/Programming/D$ ./readingHamlet.d object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = . Failed: dmd -v -o- './readingHamlet.d' -I'.'>./readingHamlet.d.deps I feel its probably something to do with the way I have installed/compiled the library but I'm at the end of my current knowledge in how to fix this. Any idea on where I should be looking/what I should be looking for? I have been following the various advices on how to install the library correctly, but feel I may have gotten myself into more trouble doing this now.
It means that it can't find the source code for druntime. Likely, your dmd.conf is messed up or it's in the wrong place. There should be a dmd.conf file next to the dmd binary. It defaults to something like this [Environment] DFLAGS=-I% P%/../../src/phobos -I% P%/../../src/druntime/import -L- L% P%/../lib64 -L-L% P%/../lib32 -L--no-warn-search-mismatch -L--export- dynamic -L-lrt Assuming that you just unzipped the zip file and used that, then everything should be in the right place. Presumably, the same goes for the deb or rpm packages if you used those. If you moved any of it around yourself, then you're probably going to have to make sure that you have dmd.conf next to the dmd binary and that it actually sets DFLAGS such that it points to where the source for druntime and Phobos is as well as where libphobos.a is. - Jonathan M Davis
The error message could be a lot better. I've posted a bug report with suggested wording: http://d.puremagic.com/issues/show_bug.cgi?id=7192
Dec 31 2011









Brian Brady <brian.brady1982 gmail.com> 