www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D ubuntu 7.10

reply Eliot E. <eliot.darkwolf gmail.com> writes:
Friend and I have had our interest peaked by the language and are both trying
to run on linux, windows and mac (less concerned with mac though).  But, I have
run into a problem with getting dmd to work on my build.  I'm using the latest
release of KUbuntu (7.10).

I've run through the tutorial on this site down to the last T:
http://www.prowiki.org/wiki4d/wiki.cgi?HowToUbuntu

I can only run dmd as root, or i get the error:
main.d: module main cannot read file 'main.d'

And when I run dmd as root on main.d I get a compile complete:
gcc main.o -o main -m32 -lphobos -lpthread -lm

and it makes a .o file and binary, but when i type: main to run the binary I
doesn't recognize the command as a program...

Any help would be useful,
~E
Feb 06 2008
parent reply "Neil Vice" <sardonicpresence gmail.com> writes:
 I can only run dmd as root, or i get the error:
 main.d: module main cannot read file 'main.d'

This is also the error you get when you run the compiler from a directory that is not the root of the source tree without the -I flag. Given that you only get it as root I would assume that it relates to the file permissions of your source file(s) and or the directories containing them.
 And when I run dmd as root on main.d I get a compile complete:
 gcc main.o -o main -m32 -lphobos -lpthread -lm

 and it makes a .o file and binary, but when i type: main to run the binary 
 I doesn't recognize the command as a program...

This may or may not seem obvious but unless you have . in your PATH you may have to use ./main to execute your program. If this isn't your problem more information as to the error messages your are encountering might be useful. Neil
Feb 06 2008
parent Denton Cockburn <diboss hotmail.com> writes:
On Thu, 07 Feb 2008 16:24:22 +0900, Neil Vice wrote:

 [quoted text muted]

This is also the error you get when you run the compiler from a directory that is not the root of the source tree without the -I flag. Given that you only get it as root I would assume that it relates to the file permissions of your source file(s) and or the directories containing them.
 [quoted text muted]

This may or may not seem obvious but unless you have . in your PATH you may have to use ./main to execute your program. If this isn't your problem more information as to the error messages your are encountering might be useful. Neil

To fix the 'root' problem, do: sudo chmod +x dmd (in the dmd bin directory of course) It is a permissions problem, and that'll fix it. the ./main thing is right on target. '.' (current directory) is not in the path by default in (K)ubuntu. So he either has to add it to the path (editing ~/.bashrc would work) or just do './main' (or whatever the binary name instead of main).
Feb 08 2008