Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 24, 2011 object.d: Error: module object is in file 'object.d' which cannot be read | ||||
---|---|---|---|---|
| ||||
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 |
August 24, 2011 Re: object.d: Error: module object is in file 'object.d' which cannot be read | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Brady | 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 |
August 24, 2011 Re: object.d: Error: module object is in file 'object.d' which cannot be read | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | == Quote from Jonathan M Davis (jmdavisProg@gmx.com)'s article > 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 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. |
January 01, 2012 Re: object.d: Error: module object is in file 'object.d' which cannot be read | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | 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 |
Copyright © 1999-2021 by the D Language Foundation