www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem with compiling code with DMD 2.049

reply Andy Elvey <andy.elvey paradise.net.nz> writes:
Hi all -
 I'm a first-timer here and very keen to get into some D coding!
Unfortunately, I have a problem. I've installed the "one-click" .deb package
from Digital Mars, but when I try to compile a very simple D program, I get
this message -
dmd -w -c "hello.d" (in directory: /home/andy/d_stuff)
Compilation failed.
object.d: Error: module object cannot read file 'object.d'

So, does anyone know what is causing this, and how it can be fixed?
It looks like the compiler is unable to find something.

Very many thanks in advance - bye for now -
- Andy
Sep 24 2010
next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Friday 24 September 2010 18:25:47 Andy Elvey wrote:
 Hi all -
  I'm a first-timer here and very keen to get into some D coding!
 Unfortunately, I have a problem. I've installed the "one-click" .deb
 package from Digital Mars, but when I try to compile a very simple D
 program, I get this message -
 dmd -w -c "hello.d" (in directory: /home/andy/d_stuff)
 Compilation failed.
 object.d: Error: module object cannot read file 'object.d'
 
 So, does anyone know what is causing this, and how it can be fixed?
 It looks like the compiler is unable to find something.
 
 Very many thanks in advance - bye for now -
 - Andy

It sounds like your dmd.conf needs adjusting or like maybe you don't have on at all. It sets DFLAGS which tells the compiler where to find the source code for druntime and phobos as well as their libraries. The current default dmd.conf is [Environment] DFLAGS=-I% P%/../../src/phobos -I% P%/../../src/druntime/import -L-L% P%/../lib -L--export-dynamic So, you either need to adjust the one that gets installed with the deb package or use your own in a place higher in the list of places to search for dmd.conf. Look here for the specifics: http://www.digitalmars.com/d/2.0/dmd- linux.html#dmd_conf . - Jonathan M Davis
Sep 24 2010
prev sibling parent reply Russel Winder <russel russel.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, 2010-09-24 at 19:35 -0700, Jonathan M Davis wrote:
 On Friday 24 September 2010 18:25:47 Andy Elvey wrote:
 Hi all -
  I'm a first-timer here and very keen to get into some D coding!
 Unfortunately, I have a problem. I've installed the "one-click" .deb
 package from Digital Mars, but when I try to compile a very simple D
 program, I get this message -
 dmd -w -c "hello.d" (in directory: /home/andy/d_stuff)
 Compilation failed.
 object.d: Error: module object cannot read file 'object.d'
=20
 So, does anyone know what is causing this, and how it can be fixed?
 It looks like the compiler is unable to find something.
=20
 Very many thanks in advance - bye for now -
 - Andy

It sounds like your dmd.conf needs adjusting or like maybe you don't have=

 all. It sets DFLAGS which tells the compiler where to find the source cod=

 druntime and phobos as well as their libraries. The current default dmd.c=

A deb should be self-consistent and ensure that all dependencies are installed. If a deb installs successfully and the compiler fails to work out "of the box" with an error related to a component that was installed by the deb, then the deb is broken. If this is the case in this case then a blocking bug should be reported. The following is therefore -- if it works at all, I haven't tried it :-) -- a hack workaround and not a fix. Anyone following this route to make things work should, quite rightly be expecting a new deb to be released as a matter of urgency so that they do not need to put this workaround in place.
 [Environment]
=20
 DFLAGS=3D-I% P%/../../src/phobos -I% P%/../../src/druntime/import -L-L% P=

 -L--export-dynamic
=20
=20
 So, you either need to adjust the one that gets installed with the deb pa=

 or use your own in a place higher in the list of places to search for dmd=

 Look here for the specifics: http://www.digitalmars.com/d/2.0/dmd-
 linux.html#dmd_conf .

It perhaps should be noted that the deb is a 32-bit Ubuntu deb and so may not work on Debian, or any Ubuntu other than the one compiled on (i.e. Lucid, Karmic, etc.). Rather than fight with installing a 32-bit deb on a 64-bit system, I just install the binary tarball -- but in my personal store not into /usr which should only be installed to by debs. Launchpad has a PPA facility that allows for creation of working debs for all Ubuntu releases simply by uploading a release tarball and pressing a button -- once configuration is complete. Might be worth considering? --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Sep 25 2010
parent Jesse Phillips <jessekphillips+D gmail.com> writes:
Russel Winder Wrote:

 It perhaps should be noted that the deb is a 32-bit Ubuntu deb and so
 may not work on Debian, or any Ubuntu other than the one compiled on
 (i.e. Lucid, Karmic, etc.).  Rather than fight with installing a 32-bit
 deb on a 64-bit system, I just install the binary tarball -- but in my
 personal store not into /usr which should only be installed to by debs.
 
 Launchpad has a PPA facility that allows for creation of working debs
 for all Ubuntu releases simply by uploading a release tarball and
 pressing a button -- once configuration is complete.  Might be worth
 considering?
 
 -- 
 Russel.

The issue was purely dmd.conf as the error was not with installing the Deb. Andy Elvey, you should be able to fix it with this, but if you continue to have problems you can build your own deb fairly simply with ddebber: http://dsource.org/projects/ddebber/wiki The following programs will be required to run it: $ sudo aptitude install build-essential unzip wget html2text Then run the program like so: $ ./dmddebber -d -v 2.049 I can not distribute build deb packages.
Sep 25 2010