Thread overview
cannot find source code for runtime library file 'object.d'
Nov 19
denis
Nov 20
thinkunix
Nov 21
denis
Nov 23
thinkunix
November 19
$ zypper install dmd
$ dmd main.d
Error: cannot find source code for runtime library file 'object.d'
       dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
       config file: /etc/dmd.conf

$ cat /etc/dmd.conf
;
; dmd.conf file for dmd
;
; dmd will look for dmd.conf in the following sequence of directories:
;   - current working directory
;   - directory specified by the HOME environment variable
;   - directory dmd resides in
;   - /etc directory
;
; Names enclosed by %% are searched for in the existing environment and inserted
;
; The special name %@P% is replaced with the path to this file
;

[Environment32]
DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib -L--export-dynamic -fPIC

[Environment64]
DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib64 -L--export-dynamic -fPIC

$ ls /usr/include/dlang/dmd
<empty>

$ cat /etc/os-release
NAME="openSUSE Tumbleweed"
VERSION="20231006"

$ dmd --version
DMD64 D Compiler v2.105.3

Help?

November 20
denis via Digitalmars-d-learn wrote:
> ```
> $ zypper install dmd
> $ dmd main.d
> Error: cannot find source code for runtime library file 'object.d'
>         dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
>         config file: /etc/dmd.conf

I would say the package has files in the wrong locations.
Try the binary from dlang.org:

https://downloads.dlang.org/releases/2.x/2.105.3/dmd-2.105.3-0.openSUSE.x86_64.rpm

I'm not familiar with zypper but I'll bet you can install it by:
# zypper install ./dmd-2.105.3-0.openSUSE.x86_64.rpm

On a RHEL-like distro, this works:
# yum install ./pkgname.rpm

Just be sure to use your package manager tool (yum, zypper, whatever)
to install the binary so it can later be removed or updated.


More details:

I ran into something similar,'object.d' not found, when trying to
build dmd from source.  In the end I grabbed the prebuilt dmd binary
RPM from dlang.org and followed the locations where it placed files,
then everything "just works".

If you have the rpm command, you can run the following to get the file
list without installing it:

$ rpm -qlp pkgname.rpm

If you do not have the rpm command, you can use rpm2cpio to convert the
rpm into a cpio archive, then read it:

$ rpm2cpio pkgname.rpm > pkgname.cpio
$ cpio -itv < pkgname.cpio | more


> $ cat /etc/dmd.conf
> [Environment32]
> DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib -L--export-dynamic -fPIC
> 
> [Environment64]
> DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib64 -L--export-dynamic -fPIC


Here's what's in my /etc/dmd.conf;
Note there is no 'dlang' subdir in /usr/include, just 'dmd'.

....................cut here....................
[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib -L--export-dynamic -fPIC

[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib64 -L--export-dynamic -fPIC
....................cut here....................


> $ ls /usr/include/dlang/dmd
> <empty>

/usr/include/dmd should have two directories:  druntime and phobos,
nothing else.

object.d lives here:
/usr/include/dmd/druntime/import/object.d

> 
> $ cat /etc/os-release
> NAME="openSUSE Tumbleweed"
> VERSION="20231006"
> 
> $ dmd --version
> DMD64 D Compiler v2.105.3
> ```
> 
> Help?

If you decide to build from source, keep in mind you need a D
compiler to build dmd.  Either use a binary tarball from dlang.org,
or you have to bootstrap dmd 2.067.1 with a C++ compiler, then
keep upgrading dmd until you get to the version you want.  It can be
done and does work, but takes time.  Instructions are here:

https://wiki.dlang.org/Building_under_Posix

I'm guessing the person who build the package was thinking they
wanted to allow allow installing mulitple D compilers, all under
/usr/include/dlang, like so:

/usr/include/dlang/{dmd,gdc,ldc2}

and libraries would go under /usr/lib64/dlang/{dmd,gdc,ldc2}.
I made several attempts at this and they failed.  Like I said,
follow the locations of the dlang.org prebuilt rpm and it all
just works, or use a binary from dlang.org.

scot
November 21
On Monday, 20 November 2023 at 07:50:22 UTC, thinkunix wrote:
> denis via Digitalmars-d-learn wrote:
>> ```
>> $ zypper install dmd
>> $ dmd main.d
>> Error: cannot find source code for runtime library file 'object.d'
>>         dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
>>         config file: /etc/dmd.conf
>
> I would say the package has files in the wrong locations.
> Try the binary from dlang.org:
>
> https://downloads.dlang.org/releases/2.x/2.105.3/dmd-2.105.3-0.openSUSE.x86_64.rpm
>
> I'm not familiar with zypper but I'll bet you can install it by:
> # zypper install ./dmd-2.105.3-0.openSUSE.x86_64.rpm
>
> On a RHEL-like distro, this works:
> # yum install ./pkgname.rpm
> ...
>
> scot

Thank you Scot, I confirm that installing manually does the trick

Regards
Denis
November 23
denis via Digitalmars-d-learn wrote:
> On Monday, 20 November 2023 at 07:50:22 UTC, thinkunix wrote:
>> denis via Digitalmars-d-learn wrote:
>>> ```
>>> $ zypper install dmd
>>> $ dmd main.d
>>> Error: cannot find source code for runtime library file 'object.d'
>>>         dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
>>>         config file: /etc/dmd.conf
>>
>> I would say the package has files in the wrong locations.
>> Try the binary from dlang.org:
>> https://downloads.dlang.org/releases/2.x/2.105.3/dmd-2.105.3-0.openSUSE.x86_64.rpm 
>>
> Thank you Scot, I confirm that installing manually does the trick

You should open a bug report with OpenSUSE to let them know their
official package does not work.  Point them to the dlang.org
openSUSE package which does work for how to "do it right".

scot