Project

General

Profile

Actions

tickets #127301

open

ldc 1.32.0 build with LLVM15 fails with "Platform not supported" for the druntime (Phobos) library

Added by hrauch over 1 year ago. Updated over 1 year ago.

Status:
Blocked
Priority:
Normal
Assignee:
Category:
Improvement
Target version:
-
Start date:
2023-04-06
Due date:
% Done:

0%

Estimated time:

Description

NOTE: This error occurs both with the master sources AND the 1.32 (stable) sources.
The host compiler used to build ldc was gdmd along with an installed LLVM16 (its llvm-config cmd)

TODOs:

  • add precise cmake cmd used to build ldc
  • add precise error msg

Related issues 1 (1 open0 closed)

Related to ZSystems - tickets #127292: dub (pkg mgr as part of the D programming language ecosystem): currently does not buid on s390xBlockedhrauch2023-04-06

Actions
Actions #1

Updated by hrauch over 1 year ago

  • Status changed from New to Blocked
Actions #2

Updated by hrauch over 1 year ago

  • Status changed from Blocked to In Progress
Actions #3

Updated by hrauch over 1 year ago

Using LLVM15, I get a bit further - meaning that I get a running ldc2/ldmd2 compiler, BUT no runtime library (phobos). (One can't just (re)use the Phobos lib that's already available for gdc/gdmd - at least not to my knowledge - as it is highly compiler-specific.

Steps were:

  • Unpack 1.32.0 tarball
  • create dedicated build dir and cd into it
  • Run the following command in order to create Ninja build files from CMake: cmake -G Ninja .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$PWD/../install-ldc \ -DLLVM_CONFIG=/bin/llvm-config \ -DD_COMPILER=gdmd
  • Run ninja in order to start the build

This way, one gets a bin subdir containing the compiler binaries and the corresponding config file (the paths therein are relative; specific to the build. Thus, the config is
not generally usable outside of the build environment). These binaries are usable. Proof:

~/src/ldc-1.32.0-src/build-ldc/bin$ ./ldc2 --version                                                                                         0:47:37
LDC - the LLVM D compiler (1.32.0):
  based on DMD v2.102.2 and LLVM 15.0.7
  built with gdc (SUSE Linux) 13.0.1 20230314 (experimental) [revision 42630fadbe248717859d61c0244c821c32b4e52c]
  Default target: s390x-suse-linux
  Host CPU: z15
  http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    bpf     - BPF (host endian)
    bpfeb   - BPF (big endian)
    bpfel   - BPF (little endian)
    systemz - SystemZ
    wasm32  - WebAssembly 32-bit
    wasm64  - WebAssembly 64-bit

~/src/ldc-1.32.0-src/build-ldc/bin$ ldd ldc2                                                                                                 0:48:13
    linux-vdso64.so.1 (0x000003ffd1f89000)
    libLLVM.so.15 => /lib64/libLLVM.so.15 (0x000003ffb5700000)
    libgphobos.so.4 => /lib64/libgphobos.so.4 (0x000003ffb4c00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000003ffbb500000)
    libm.so.6 => /lib64/libm.so.6 (0x000003ffbac00000)
    libc.so.6 => /lib64/libc.so.6 (0x000003ffb4900000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x000003ffb4500000)
    libedit.so.0 => /lib64/libedit.so.0 (0x000003ffb5680000)
    libz.so.1 => /lib64/libz.so.1 (0x000003ffb5600000)
    /lib/ld64.so.1 (0x000003ffbb600000)
    libtinfo.so.6 => /lib64/libtinfo.so.6 (0x000003ffb4b80000)

~/src/ldc-1.32.0-src/build-ldc/bin$ ./ldmd2 --version                                                                                        0:49:02
LDC - the LLVM D compiler (1.32.0):
  based on DMD v2.102.2 and LLVM 15.0.7
  built with gdc (SUSE Linux) 13.0.1 20230314 (experimental) [revision 42630fadbe248717859d61c0244c821c32b4e52c]
  Default target: s390x-suse-linux
  Host CPU: z15
  http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    bpf     - BPF (host endian)
    bpfeb   - BPF (big endian)
    bpfel   - BPF (little endian)
    systemz - SystemZ
    wasm32  - WebAssembly 32-bit
    wasm64  - WebAssembly 64-bit

:~/src/ldc-1.32.0-src/build-ldc/bin$ ldd ldmd2                                                                                                0:49:41
    linux-vdso64.so.1 (0x000003ffc7ea4000)
    libLLVM.so.15 => /lib64/libLLVM.so.15 (0x000003ff9a400000)
    libgphobos.so.4 => /lib64/libgphobos.so.4 (0x000003ff99900000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000003ff9f900000)
    libm.so.6 => /lib64/libm.so.6 (0x000003ff9a300000)
    libc.so.6 => /lib64/libc.so.6 (0x000003ff99600000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x000003ff99200000)
    libedit.so.0 => /lib64/libedit.so.0 (0x000003ff99880000)
    libz.so.1 => /lib64/libz.so.1 (0x000003ff99580000)
    /lib/ld64.so.1 (0x000003ff9fa80000)
    libtinfo.so.6 => /lib64/libtinfo.so.6 (0x000003ff99500000)

The error msg dor the ninja build refers to a failing assertion - the last build cmd executed was:

cd /home/linux1/src/ldc-1.32.0-src/runtime/druntime/src && /home/linux1/src/ldc-1.32.0-src/build-ldc/bin/ldc2 -c --output-o -conf= -w -de -preview=dip1000 -preview=dtorfields -preview=fieldwise -g -link-defaultlib-debug -d-debug -I/home/linux1/src/ldc-1.32.0-src/runtime/druntime/src -od=/home/linux1/src/ldc-1.32.0-src/build-ldc/runtime/objects-debug -op <lots_of_d_src_files>

The error msg is:

rt/sections_elf_shared.d(1198): Error: static assert:  "Platform not supported."
ninja: build stopped: subcommand failed.

The path to the file in question is:

~/src/ldc-1.32.0-src$ find . -type f -name sections_elf_shared.d                                                                             0:53:03
./runtime/druntime/src/rt/sections_elf_shared.d

(I ain't got the platform-specific (z15 in specific / s390x in general) architectural knowledge to make the necessary contributions).

Actions #4

Updated by hrauch over 1 year ago

What's also worth mentioning is that there indeed is an ldc package in the devel:lanaguages:D project.
BUT: After having branched (and trying to build) that, I get:

[    8s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --undefine _enable_debug_packages /home/abuild/rpmbuild/SOURCES/ldc.spec
[    9s] error: Architecture is not included: s390x

(At that point, I'm not sure whether it's better to continue working from/with the "plain" tarball (unpacked, of course ;-) ) or try to get the official package
build - at least - to the point where I get working ldc2/ldmd2 executables for s390x/z15.)

Actions #5

Updated by hrauch over 1 year ago

  • Subject changed from ldc build fails with LLVM internal error ("None is not a member of llvm") to ldc build with LLVM15 fails with "Platform not supported" for the druntime (Phobos) library
Actions #6

Updated by hrauch over 1 year ago

  • Status changed from In Progress to Blocked
Actions #7

Updated by hrauch over 1 year ago

  • Subject changed from ldc build with LLVM15 fails with "Platform not supported" for the druntime (Phobos) library to ldc 1.32.0 build with LLVM15 fails with "Platform not supported" for the druntime (Phobos) library
Actions #8

Updated by hrauch over 1 year ago

  • Related to tickets #127292: dub (pkg mgr as part of the D programming language ecosystem): currently does not buid on s390x added
Actions #9

Updated by hrauch over 1 year ago

  • Category set to Improvement

Note to myself (so that I don't forget about it):

=> Maybe I can find some portability hints that can be used similarly for LDC's libphobos...

Actions

Also available in: Atom PDF