www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Installation on (64 bit) Linux

I managed to get a working system-wide dmd installation.

It would have been easier if the Ubuntu packages or linux installation
instructions actually set things up so the compiler could find the
interface definitions, and if the required dependencies on a 64-bit
(Ubuntu) system were documented outside the forums (maybe even
automatically in the debs).

It would also help if installation instructions were linked more 
prominently, like from the download page, and high on the side-bar.
In firefox, at 1280x1024, on a fresh Ubuntu 9.04 installation
the Tools:DMD D Compiler link that ultimately leads to installation
instructions is off the bottom of the screen on.
I'd suggest a nice "Getting D" link up in the first panel with Overview 
and the rest.

Brief details:

dmd.conf, in all distributions, has include paths like
-I% P%/../../src/phobos
This will not work if dmd.conf is under $(prefix)/bin and
the interfaces under $(prefix)/src.

The 2.028 deb omits druntime entirely!

The linux install instructions do not mention that you should be
able to just run the binaries out of an unpacked zip.
(presumably the ../../src that causes so much pain everywhere else
is meant to get from dmd/linux/bin to dmd/src).

On the other hand, the linux install instructions don't mention that
you should also copy /dmd/src into system directories as well if you
are going for a system-wide install, and that dmd.conf needs editing
if you copy it to /etc (stating "/etc/../../src/phobos/object.d" is fun).

The gcc-multilibs stuff you need to compile on a 64 bit system
is not documented anywhere (in particular, not included as a dependency
of 64-bit debs).

In full detail:

The ubuntu packages are both broken. The 1.048 package has a bogus 
dmd.conf that sends the compiler looking for object.d at /usr/src/phobos/
object.d when it was installed to /usr/local/src/phobos/phobos/object.d. 
Fixing dmd.conf seems to be enough to get it working, after fixing the 64-
bit stuff described later.

The 2.028 package is completely broken, completely omitting the druntime 
directory and consequently object.d, as well as having a similarly bogus

The online linux installation instructions at
neglect to mention the compiler will work if run in-place from
an unpacked zip. The closest they come is if you happen to extend your
path to run them out of the unpacked zip, in which case all the cruft
the other steps direct you to copy into your system directories will
be ignored.

Assuming you want a system-wide installation, the instructions
say nothing about copying the interfaces from dmd/src (and the
readmes (as well as the directory name) suggest it just contains
source, not critically important interface files the compiler
needs to be able to find at runtime), or the need to edit

Once the above is sorted out those of us on 64-bit platforms still
need to get the right 32 bit libraries. A fairly mysterious linker
error about libpthread eventually suggests a 32-bit glibc is required,
which I had. A bit of searching turned up Walter's instructions:


To compile 32 bit programs under ub64:
  sudo apt-get install gcc-multilib libc6-i386 lib6-dev-i386

To run 32 bit programs:
  sudo apt-get install gcc-multilib
  sudo apt-get install g++-multilib
Apr 28 2009