Bug 22573 – DMD compiler errors on Illumos/Solaris
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Solaris
Creation time
2021-12-06T17:12:35Z
Last change time
2021-12-14T10:34:34Z
Keywords
pull
Assigned to
No Owner
Creator
jkruth
Comments
Comment #0 by jkruth — 2021-12-06T17:12:35Z
Hello,
I have been trying to compile DMD on OpenIndiana, an Illumos/Solaris system. My approach was like this:
1. compile GDC
2. use GDC to build DMD
3. use DMD to build druntime
The procedure was repeated with the old and the new (will be available in GCC 12) D implementations of gcc. In both cases the compilation of druntime aborted with the following error message:
---
ERROR: This is a compiler bug.
Please report it via https://issues.dlang.org/enter_bug.cgi
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction.
---
DMD v2.098.0-317-g9d1027cfb-dirty
predefs DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 Solaris CppRuntime_Gcc D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary ../dmd/generated/solaris/release/64/dmd
version v2.098.0-317-g9d1027cfb-dirty
config
DFLAGS (none)
---
core.exception.AssertError@src/dmd/backend/obj.d-mixin-196(203): Assertion failure
----------------
../../../../libphobos/libdruntime/core/exception.d:582 onAssertError [0x7eb6b4]
src/dmd/backend/obj.d-mixin-196:203 _ZN3Obj4initEP9OutBufferPKcS3_ [0x697b5b]
src/dmd/glue.d:341 _Z9obj_startPKc [0x696127]
src/dmd/glue.d:135 void dmd.glue.generateCodeAndWrite(dmd.dmodule.Module[], const(char)*[], const(char)[], const(char)[], bool, bool, bool, bool, bool) [0x43fa8c]
src/dmd/mars.d:597 int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x442055]
src/dmd/mars.d:1020 _Dmain [0x44dc6d]
gmake: *** [posix.mak:377: generated/solaris/release/64/libdruntime.a] Fehler 1
I do not know how to fix this, but maybe someone here could help me out?
Comment #1 by ibuclaw — 2021-12-07T23:43:34Z
The dmd backend has only ever been ported to Solaris i[3456]86, IIRC. So it's likely that config is not being set-up correctly for x86_64.
Comment #2 by ibuclaw — 2021-12-07T23:45:57Z
(In reply to Iain Buclaw from comment #1)
> The dmd backend has only ever been ported to Solaris i[3456]86, IIRC. So
> it's likely that config is not being set-up correctly for x86_64.
Nope, it's a typo.
https://github.com/dlang/dmd/blob/master/src/dmd/backend/backconfig.d#L245
Raisea pull to fix that, my guess is that should be `(EX_SOLARIS | EX_SOLARIS64)`.
Comment #3 by jkruth — 2021-12-08T12:16:32Z
(In reply to Iain Buclaw from comment #2)
> (In reply to Iain Buclaw from comment #1)
> > The dmd backend has only ever been ported to Solaris i[3456]86, IIRC. So
> > it's likely that config is not being set-up correctly for x86_64.
> Nope, it's a typo.
>
> https://github.com/dlang/dmd/blob/master/src/dmd/backend/backconfig.d#L245
>
> Raisea pull to fix that, my guess is that should be `(EX_SOLARIS |
> EX_SOLARIS64)`.
This fixes the above issue.
However another one appears:
---
DMD v2.098.0-317-g9d1027cfb-dirty
predefs DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 Solaris CppRuntime_Gcc D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary ../dmd/generated/solaris/release/64/dmd
version v2.098.0-317-g9d1027cfb-dirty
config
DFLAGS (none)
---
core.exception.AssertError@src/dmd/backend/elfobj.d(1609): Assertion failure
----------------
../../../../libphobos/libdruntime/core/exception.d:582 onAssertError [0x7eb764]
src/dmd/backend/elfobj.d:1609 _Z15ElfObj_ehtablesP6SymboljS0_ [0x7ca2ed]
src/dmd/backend/obj.d-mixin-322:325 _ZN3Obj8ehtablesEP6SymboljS1_ [0x684910]
src/dmd/eh.d:69 _Z16except_gentablesv [0x683a9d]
src/dmd/backend/cgcod.d:658 _Z6codgenP6Symbol [0x710430]
src/dmd/backend/out.d:1478 _Z10writefunc2P6Symbol [0x70e320]
src/dmd/backend/out.d:1137 _Z9writefuncP6Symbol [0x70da98]
src/dmd/glue.d:1154 _Z25FuncDeclaration_toObjFileP15FuncDeclarationb [0x69a8de]
src/dmd/toobj.d:311 _ZN9toObjFile9ToObjFile5visitEP15FuncDeclaration [0x6b0c46]
src/dmd/func.d:2685 _ZN15FuncDeclaration6acceptEP7Visitor [0x417b74]
src/dmd/toobj.d:346 __lambda3 [0x6b1c68]
src/dmd/dsymbol.d:104 void dmd.dsymbol.foreachDsymbol(dmd.root.array.Array!(dmd.dsymbol.Dsymbol).Array*, void delegate(dmd.dsymbol.Dsymbol)) [0x461253]
src/dmd/toobj.d:346 _ZN9toObjFile9ToObjFile5visitEP16ClassDeclaration [0x6b1479]
src/dmd/dclass.d:1000 _ZN16ClassDeclaration6acceptEP7Visitor [0x4178d1]
src/dmd/toobj.d:1003 _Z9toObjFileP7Dsymbolb [0x431391]
src/dmd/glue.d:504 _Z10genObjFileP6Moduleb [0x696801]
src/dmd/glue.d:231 _Z18obj_write_deferredP7Library [0x697309]
src/dmd/glue.d:138 void dmd.glue.generateCodeAndWrite(dmd.dmodule.Module[], const(char)*[], const(char)[], const(char)[], bool, bool, bool, bool, bool) [0x43face]
src/dmd/mars.d:597 int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x442055]
src/dmd/mars.d:1020 _Dmain [0x44dc6d]
gmake: *** [posix.mak:377: generated/solaris/release/64/libdruntime.a] Fehler 1
It calls the ElfObj_ehtables function which just asserts(0) and causes the error, see here:
https://github.com/dlang/dmd/blob/master/src/dmd/backend/elfobj.d#L1607
Comment #4 by dlang-bot — 2021-12-09T02:36:47Z
@ibara created dlang/dmd pull request #13405 "Fix build for Solaris/Illumos" fixing this issue:
- Fix build for Solaris/Illumos
Fix Issue 22573 - DMD compiler errors on Illumos/Solaris
https://github.com/dlang/dmd/pull/13405
Comment #5 by bcallah — 2021-12-09T02:38:42Z
I got an Illumos VM running on my OpenBSD machine.
The PR above lets me successfully build phobos with dmd on Illumos.
No further testing was done.
Comment #6 by dlang-bot — 2021-12-09T07:25:24Z
dlang/dmd pull request #13405 "Fix build for Solaris/Illumos" was merged into stable:
- 30d5c44fca1f46ba6a26087ab7c34ef56b1e4f8f by Brian Callahan:
Fix build for Solaris/Illumos
Fix Issue 22573 - DMD compiler errors on Illumos/Solaris
https://github.com/dlang/dmd/pull/13405
Comment #7 by dlang-bot — 2021-12-10T13:46:03Z
dlang/dmd pull request #13393 "Issue 22574 - Compiler segfaults on `template test(x* x)`" was merged into stable:
- b2fb53857872d3b9ab4dad5de1c30b145f5feb94 by Brian Callahan:
Fix build for Solaris/Illumos
Fix Issue 22573 - DMD compiler errors on Illumos/Solaris
https://github.com/dlang/dmd/pull/13393
Comment #8 by dlang-bot — 2021-12-14T10:34:34Z
dlang/dmd pull request #13421 "merge stable" was merged into master:
- cb4aed0c79ab3b67c384c0b97768aec7846d0be2 by Brian Callahan:
Fix build for Solaris/Illumos
Fix Issue 22573 - DMD compiler errors on Illumos/Solaris
https://github.com/dlang/dmd/pull/13421