Hello,
I tried to build a DMD using DMD on OpenIndiana, a descendant of Solaris.
For this I chose the following procedure:
1. Build gdc
2. use gdc to build dmd from the github master branch (necessary because of some recent Solaris specific fixes)
3. use dmd to compile druntime and phobos from master branches
4. try to compile dmd using the just compiled dmd
With this approach I got the following output:
gmake -C src -f posix.mak all
gmake[1]: Verzeichnis „/export/home/User/Documents/dmd_freestanding/dmd/src“ wird betreten
posix.mak:42: ===== DEPRECATION NOTICE =====
posix.mak:43: ===== DEPRECATION: posix.mak is deprecated. Please use src/build.d instead.
posix.mak:44: ==============================
/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd -of../generated/build -g build.d
../generated/build OS="solaris" BUILD="release" MODEL="64" HOST_DMD="/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd" CXX="c++" AUTO_BOOTSTRAP="" DOCDIR="" STDDOC="" DOC_OUTPUT_DIR="" MAKE="gmake" VERBOSE="1" ENABLE_RELEASE="" ENABLE_DEBUG="" ENABLE_ASSERTS="" ENABLE_UNITTEST="" ENABLE_PROFILE="" ENABLE_COVERAGE="" DFLAGS="" dmd
Run: /export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd --version
Run: /export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd -color=on -h
================================================================================
STDDOC=
TOLF=tolf
ENABLE_COVERAGE=
AUTO_BOOTSTRAP=
MODEL=64
ENABLE_UNITTEST=
ROOT=/export/home/User/Documents/dmd_freestanding/dmd/src/dmd/root
DMD_PATH=/export/home/User/Documents/dmd_freestanding/dmd/generated/solaris/release/64/dmd
DETAB=detab
SYSCONFDIR=/etc
GENERATED=/export/home/User/Documents/dmd_freestanding/dmd/generated
VERBOSE=1
EX=/export/home/User/Documents/dmd_freestanding/dmd/src/examples
RES=/export/home/User/Documents/dmd_freestanding/dmd/src/dmd/res
MODEL_FLAG=-m64
CXX=c++
HOST_DMD_KIND=dmd
BUILD=release
MAKE=gmake
GIT_HOME=https://github.com/dlang
OS=solaris
ZIP=zip
HOST_DMD_VERSION=2.098.0
D=/export/home/User/Documents/dmd_freestanding/dmd/src/dmd
PIC_FLAG=-fPIC
COMMON=/export/home/User/Documents/dmd_freestanding/dmd/src/dmd/common
G=/export/home/User/Documents/dmd_freestanding/dmd/generated/solaris/release/64
C=/export/home/User/Documents/dmd_freestanding/dmd/src/dmd/backend
CXX_KIND=g++
DOCDIR=
COVERAGE_FLAG=-cov=ctfe
INSTALL=/export/home/User/Documents/dmd_freestanding/dmd/../install
DOC_OUTPUT_DIR=
ENABLE_ASSERTS=
ENABLE_DEBUG=
HOST_DMD_RUN=/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd
ENABLE_PROFILE=
TOOLS_DIR=/export/home/User/Documents/dmd_freestanding/tools
HOST_DMD_PATH=/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd
ENABLE_RELEASE=
GIT=git
DOCSRC=/export/home/User/Documents/dmd_freestanding/dmd/dlang.org
HOST_DMD=/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd
TMP=/tmp/
DFLAGS=-version=MARS -w -de -fPIC -m64 -J/export/home/User/Documents/dmd_freestanding/dmd/generated/solaris/release/64 -I/export/home/User/Documents/dmd_freestanding/dmd/src -dip25 -g -color=on
CXXFLAGS=-Wall -Werror -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -g -fno-exceptions -fno-rtti -fno-common -fasynchronous-unwind-tables -DMARS=1 -m64 -fPIC
================================================================================
src/rt/dwarfeh.d:330: uncaught exception reached top of stack
This might happen if you're missing a top level catch in your fiber or signal handler
std.file.FileException@/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/../../../../../phobos/std/file.d(1681): /export/home/User/Documents/dmd_freestanding/dmd/generated/solaris/release/64/VERSION: No such file or directory
src/rt/dwarfeh.d:330: uncaught exception reached top of stack
This might happen if you're missing a top level catch in your fiber or signal handler
/bin/sh: 3579: Abort(coredump)
gmake[1]: *** [posix.mak:107: dmd] Abort
gmake[1]: Verzeichnis „/export/home/User/Documents/dmd_freestanding/dmd/src“ wird verlassen
gmake: *** [posix.mak:8: all] Fehler 2
Comment #1 by jkruth — 2021-12-09T17:40:49Z
Sorry for double posting, but I have a small but important update:
1. I found that I had previously made some changes in druntime which might be the cause for the initial failure.
2. I pulled in the latest updates to gdc, and repeated the procedure.
One of these two things fixed the initial issue.
This patch was also applied to the dmd.conf: https://github.com/dlang/dmd/pull/13409
Now the following error occurs:
gmake -C src -f posix.mak all
gmake[1]: Verzeichnis „/export/home/User/dlang/dmd/src“ wird betreten
posix.mak:42: ===== DEPRECATION NOTICE =====
posix.mak:43: ===== DEPRECATION: posix.mak is deprecated. Please use src/build.d instead.
posix.mak:44: ==============================
/export/home/User/Documents/Gits/dmd/generated/solaris/release/64/dmd -of../generated/build -g build.d
/usr/bin/ld: /export/home/User/Documents/Gits/dmd/generated/solaris/release/64/../../../../../phobos/generated/solaris/release/64/libphobos2.a(socket_6a6_2c33.o): undefined reference to symbol 'gethostbyaddr@@SUNW_0.7'
/usr/bin/ld: /lib/amd64/libnsl.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
gmake[1]: *** [posix.mak:111: ../generated/build] Fehler 1
gmake[1]: Verzeichnis „/export/home/User/dlang/dmd/src“ wird verlassen
Comment #2 by bcallah — 2021-12-09T21:39:39Z
If -lsocket and -lnsl are unconditionally required to link programs on Solaris, it might be better to place them in the DMD source code here where there are similar tweaks for both Linux and OpenBSD:
https://github.com/dlang/dmd/blob/master/src/dmd/link.d#L750
Your PR at https://github.com/dlang/dmd/pull/13409 makes it too easy for users to accidentally destroy these needed changes.
There seems to be more work needed to fix the Solaris runtime; I'll work on it shortly.
Comment #3 by robert.schadek — 2024-12-13T19:19:44Z