cannot find source code for runtime library file 'object.d'
thinkunix
thinkunix at zoho.com
Mon Nov 20 07:50:22 UTC 2023
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
More information about the Digitalmars-d-learn
mailing list