www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Building DMD from git

reply "Nick Sabalausky" <a a.a> writes:
Ok, this is probably some stupid little issue, but I'm getting "object.d: 
Error: module object is in file 'object.d' which cannot be read" when I try 
to use a DMD I build from git. Here's how I'm building it all:

-----------------------------------------

[DMC is already installed and on the PATH]

git clone https://github.com/D-Programming-Language/dmd.git
git clone https://github.com/D-Programming-Language/druntime.git
git clone https://github.com/D-Programming-Language/phobos.git
mkdir dmd\bin
mkdir dmd\lib
SET PATH={current_dir}\dmd\bin;%PATH%
[edit dmd\src\win32.mak and change the stupid "CC=\dm\bin\dmc" to "CC=dmc"] [create a specially-adjusted dmd\bin\sc.ini]
type dmd\bin\sc.ini
[Version] version=7.51 Build 020 [Environment] LIB="% P%\..\lib";\dm\lib DFLAGS="-I% P%\..\..\phobos" "-I% P%\..\..\druntime\import" LINKCMD=% P%\link.exe
cd dmd\src
make -fwin32.mak
cd ..\..
copy dmd\src\dmd.exe dmd\bin
cd druntime
make -fwin32.mak
cd ..
copy druntime\lib\druntime.lib dmd\lib
cd phobos
make -fwin32.mak
cd ..
copy phobos\phobos.lib dmd\lib
type test.d
import std.stdio; void main() { writeln("Hello"); }
dmd test.d
DMD v2.055 DEBUG object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = .\..\..\phobos import path[1] = .\..\..\druntime\import
Jul 23 2011
parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday 23 July 2011 20:23:16 Nick Sabalausky wrote:
 Ok, this is probably some stupid little issue, but I'm getting "object.d:
 Error: module object is in file 'object.d' which cannot be read" when I try
 to use a DMD I build from git. Here's how I'm building it all:
 
 -----------------------------------------
 
 [DMC is already installed and on the PATH]
 
git clone https://github.com/D-Programming-Language/dmd.git
git clone https://github.com/D-Programming-Language/druntime.git
git clone https://github.com/D-Programming-Language/phobos.git
mkdir dmd\bin
mkdir dmd\lib
SET PATH={current_dir}\dmd\bin;%PATH%
[edit dmd\src\win32.mak and change the stupid "CC=\dm\bin\dmc" to "CC=dmc"] [create a specially-adjusted dmd\bin\sc.ini]
type dmd\bin\sc.ini
[Version] version=7.51 Build 020 [Environment] LIB="% P%\..\lib";\dm\lib DFLAGS="-I% P%\..\..\phobos" "-I% P%\..\..\druntime\import" LINKCMD=% P%\link.exe
cd dmd\src
make -fwin32.mak
cd ..\..
copy dmd\src\dmd.exe dmd\bin
cd druntime
make -fwin32.mak
cd ..
copy druntime\lib\druntime.lib dmd\lib
cd phobos
make -fwin32.mak
cd ..
copy phobos\phobos.lib dmd\lib
type test.d
import std.stdio; void main() { writeln("Hello"); }
dmd test.d
DMD v2.055 DEBUG object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = .\..\..\phobos import path[1] = .\..\..\druntime\import
It can't find object_.d. It means that the path to druntime (and probably the path to phobos as well) is screwed up. Your dmd.conf (or sc.ini I guess, since you appear to be on Windows) needs to be fixed to have the correct paths. - Jonathan M Davis
Jul 23 2011
parent "Nick Sabalausky" <a a.a> writes:
"Jonathan M Davis" <jmdavisProg gmx.com> wrote in message 
news:mailman.1890.1311472074.14074.digitalmars-d-learn puremagic.com...
 It can't find object_.d. It means that the path to druntime (and probably 
 the
 path to phobos as well) is screwed up. Your dmd.conf (or sc.ini I guess, 
 since
 you appear to be on Windows) needs to be fixed to have the correct paths.
Heh, turns out the problem was something I glossed over in my listing of what I did. When I created sc.ini, I created it in the main current directory (ie, the same directory that contains the "dmd", "druntime" and "phobos" subdirectories). Then I gave sc.ini to DMD with:
 copy sc.ini dmd\bin
And then ran dmd from the current directory. So DMD picked up ./sc.ini instead of ./dmd/bin/sc.ini. And of course, since the paths in sc.ini are given relative to sc.ini itself, that's what screwed it up. Boy, three time-consuming dumbass mistakes in two days. I'm really on a roll here... ;)
Jul 23 2011