Unable to build LDC 1.41 on Linux/PPC64LE
Hi, I'm trying to build an image with LDC (https://hub.docker.com/r/starxen/ldc) on PPC64LE, but unfortunately I encounter an error during the build. Here is where the error occurs:
[108/268] /usr/bin/c++ -DLDC_DYNAMIC_COMPILE -DLDC_DYNAMIC_COMPILE_API_VERSION=4 -DLDC_ENABLE_PLUGINS -DLDC_LLVM_SUPPORTED_TARGET_AArch64=1 -DLDC_LLVM_SUPPORTED_TARGET_AMDGPU=1 -DLDC_LLVM_SUPPORTED_TARGET_ARM=1 -DLDC_LLVM_SUPPORTED_TARGET_AVR=1 -DLDC_LLVM_SUPPORTED_TARGET_BPF=1 -DLDC_LLVM_SUPPORTED_TARGET_Hexagon=1 -DLDC_LLVM_SUPPORTED_TARGET_Lanai=1 -DLDC_LLVM_SUPPORTED_TARGET_LoongArch=1 -DLDC_LLVM_SUPPORTED_TARGET_M68k=1 -DLDC_LLVM_SUPPORTED_TARGET_MSP430=1 -DLDC_LLVM_SUPPORTED_TARGET_Mips=1 -DLDC_LLVM_SUPPORTED_TARGET_NVPTX=1 -DLDC_LLVM_SUPPORTED_TARGET_PowerPC=1 -DLDC_LLVM_SUPPORTED_TARGET_RISCV=1 -DLDC_LLVM_SUPPORTED_TARGET_Sparc=1 -DLDC_LLVM_SUPPORTED_TARGET_SystemZ=1 -DLDC_LLVM_SUPPORTED_TARGET_VE=1 -DLDC_LLVM_SUPPORTED_TARGET_WebAssembly=1 -DLDC_LLVM_SUPPORTED_TARGET_X86=1 -DLDC_LLVM_SUPPORTED_TARGET_XCore=1 -DLDC_LLVM_SUPPORTED_TARGET_Xtensa=1 -I/build/ldc/. -I/build/ldc/dmd -DDMDV2 -O3 -DNDEBUG -I/usr/lib/llvm-19/include -std=c++17 -fno-exceptions -funwind-tables -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -Wall -Wextra -Wno-unused-parameter -Wno-comment -Wno-missing-field-initializers -Wno-non-virtual-dtor -Wno-pedantic -DLDC_POSIX -DIN_LLVM -DOPAQUE_VTBLS "-DLDC_INSTALL_PREFIX=R"(/install-ldc)"" -DLDC_LLVM_VER=1901 "-DLDC_LIBDIR_SUFFIX=R"()"" -DLDC_HOST_GDMD=1 -DLDC_HOST_FE_VER=2108 "-DLDC_LLVM_LIBDIR=R"(/usr/lib/llvm-19/lib)"" -DNDEBUG -MD -MT CMakeFiles/LDCShared.dir/driver/main.cpp.o -MF CMakeFiles/LDCShared.dir/driver/main.cpp.o.d -o CMakeFiles/LDCShared.dir/driver/main.cpp.o -c /build/ldc/driver/main.cpp ninja: build stopped: subcommand failed. root@c30a233567fe:/build/build-ldc#
Below is a minimal Dockerfile that reproduces this build using Docker with buildx (via QEMU on any host):
FROM debian:13 AS build_ldc
RUN apt-get update && apt-get install -y git-core g++ gdc gdmd cmake ninja-build python3 zlib1g-dev libcurl4t64 gdb unzip zip tzdata llvm-dev libclang-common-19-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /build
RUN git clone https://github.com/ldc-developers/ldc && cd ldc && git checkout tags/v1.41.0 && git submodule update --init --recursive
WORKDIR /build/build-ldc
RUN cmake -G Ninja ../ldc -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/install-ldc
Based on this Dockerfile
You can run it with the following commands:
docker buildx build -t starxen/ldc:trixie_ppc64le --platform linux/ppc64le --load .
docker run --rm -it --platform linux/ppc64le starxen/ldc:trixie_ppc64le bash
ninja -v -j"$(nproc)"
If I can provide a more detailed log or anything else, please let me know where to send it—I’m happy to help.
Now i try build this with make and i get this:
[ 45%] Generating obj/ldc2.o cd /build/ldc && /usr/bin/gdmd -c -wi -O -inline -release -I/build/ldc -I/build/build-ldc -J/build/ldc/dmd/res -version=IN_LLVM -of/build/build-ldc/obj/ldc2.o /build/ldc/dmd/access.d /build/ldc/dmd/aggregate.d /build/ldc/dmd/aliasthis.d /build/ldc/dmd/argtypes_aarch64.d /build/ldc/dmd/argtypes_sysv_x64.d /build/ldc/dmd/argtypes_x86.d /build/ldc/dmd/arrayop.d /build/ldc/dmd/arraytypes.d /build/ldc/dmd/ast_node.d /build/ldc/dmd/astcodegen.d /build/ldc/dmd/astenums.d /build/ldc/dmd/asttypename.d /build/ldc/dmd/attrib.d /build/ldc/dmd/attribsem.d /build/ldc/dmd/blockexit.d /build/ldc/dmd/builtin.d /build/ldc/dmd/canthrow.d /build/ldc/dmd/chkformat.d /build/ldc/dmd/cli.d /build/ldc/dmd/clone.d /build/ldc/dmd/common/bitfields.d /build/ldc/dmd/common/blake3.d /build/ldc/dmd/common/charactertables.d /build/ldc/dmd/common/file.d /build/ldc/dmd/common/identifiertables.d /build/ldc/dmd/common/int128.d /build/ldc/dmd/common/outbuffer.d /build/ldc/dmd/common/smallbuffer.d /build/ldc/dmd/compiler.d /build/ldc/dmd/cond.d /build/ldc/dmd/console.d /build/ldc/dmd/constfold.d /build/ldc/dmd/cparse.d /build/ldc/dmd/ctfeexpr.d /build/ldc/dmd/ctorflow.d /build/ldc/dmd/cxxfrontend.d /build/ldc/dmd/dcast.d /build/ldc/dmd/dclass.d /build/ldc/dmd/declaration.d /build/ldc/dmd/delegatize.d /build/ldc/dmd/denum.d /build/ldc/dmd/deps.d /build/ldc/dmd/dimport.d /build/ldc/dmd/dinterpret.d /build/ldc/dmd/dmacro.d /build/ldc/dmd/dmodule.d /build/ldc/dmd/doc.d /build/ldc/dmd/dscope.d /build/ldc/dmd/dstruct.d /build/ldc/dmd/dsymbol.d /build/ldc/dmd/dsymbolsem.d /build/ldc/dmd/dtemplate.d /build/ldc/dmd/dtoh.d /build/ldc/dmd/dversion.d /build/ldc/dmd/entity.d /build/ldc/dmd/enumsem.d /build/ldc/dmd/errors.d /build/ldc/dmd/errorsink.d /build/ldc/dmd/escape.d /build/ldc/dmd/expression.d /build/ldc/dmd/expressionsem.d /build/ldc/dmd/file_manager.d /build/ldc/dmd/func.d /build/ldc/dmd/funcsem.d /build/ldc/dmd/globals.d /build/ldc/dmd/gluelayer.d /build/ldc/dmd/hdrgen.d /build/ldc/dmd/hooks.d /build/ldc/dmd/iasmgcc.d /build/ldc/dmd/id.d /build/ldc/dmd/identifier.d /build/ldc/dmd/impcnvtab.d /build/ldc/dmd/imphint.d /build/ldc/dmd/importc.d /build/ldc/dmd/init.d /build/ldc/dmd/initsem.d /build/ldc/dmd/inline.d /build/ldc/dmd/inlinecost.d /build/ldc/dmd/intrange.d /build/ldc/dmd/json.d /build/ldc/dmd/lambdacomp.d /build/ldc/dmd/ldcbindings.d /build/ldc/dmd/lexer.d /build/ldc/dmd/location.d /build/ldc/dmd/main.d /build/ldc/dmd/mangle/basic.d /build/ldc/dmd/mangle/cpp.d /build/ldc/dmd/mangle/cppwin.d /build/ldc/dmd/mangle/package.d /build/ldc/dmd/mars.d /build/ldc/dmd/mtype.d /build/ldc/dmd/mustuse.d /build/ldc/dmd/nogc.d /build/ldc/dmd/nspace.d /build/ldc/dmd/ob.d /build/ldc/dmd/objc.d /build/ldc/dmd/opover.d /build/ldc/dmd/optimize.d /build/ldc/dmd/parse.d /build/ldc/dmd/pragmasem.d /build/ldc/dmd/printast.d /build/ldc/dmd/root/aav.d /build/ldc/dmd/root/array.d /build/ldc/dmd/root/bitarray.d /build/ldc/dmd/root/complex.d /build/ldc/dmd/root/ctfloat.d /build/ldc/dmd/root/file.d /build/ldc/dmd/root/filename.d /build/ldc/dmd/root/hash.d /build/ldc/dmd/root/longdouble.d /build/ldc/dmd/root/optional.d /build/ldc/dmd/root/port.d /build/ldc/dmd/root/region.d /build/ldc/dmd/root/rmem.d /build/ldc/dmd/root/speller.d /build/ldc/dmd/root/string.d /build/ldc/dmd/root/stringtable.d /build/ldc/dmd/root/utf.d /build/ldc/dmd/rootobject.d /build/ldc/dmd/safe.d /build/ldc/dmd/sarif.d /build/ldc/dmd/semantic2.d /build/ldc/dmd/semantic3.d /build/ldc/dmd/sideeffect.d /build/ldc/dmd/statement.d /build/ldc/dmd/statementsem.d /build/ldc/dmd/staticassert.d /build/ldc/dmd/staticcond.d /build/ldc/dmd/stmtstate.d /build/ldc/dmd/target.d /build/ldc/dmd/templateparamsem.d /build/ldc/dmd/templatesem.d /build/ldc/dmd/timetrace.d /build/ldc/dmd/tokens.d /build/ldc/dmd/traits.d /build/ldc/dmd/typesem.d /build/ldc/dmd/typinf.d /build/ldc/dmd/utils.d /build/ldc/dmd/visitor/foreachvar.d /build/ldc/dmd/visitor/package.d /build/ldc/dmd/visitor/parsetime.d /build/ldc/dmd/visitor/permissive.d /build/ldc/dmd/visitor/postorder.d /build/ldc/dmd/visitor/statement_rewrite_walker.d /build/ldc/dmd/visitor/strict.d /build/ldc/dmd/visitor/transitive.d /build/ldc/dmd/vsoptions.d /build/ldc/gen/cpp-imitating-naming.d /build/ldc/gen/dpragma.d /build/ldc/gen/ldctraits.d /build/ldc/gen/llvmhelpers.d /build/ldc/gen/logger.d /build/ldc/gen/semantic.d /build/ldc/driver/cache_pruning.d /build/ldc/driver/config.d /build/ldc/driver/configfile.d /build/ldc/driver/main.d /build/ldc/driver/cache_pruning.d:24:8: error: unable to read module 'datetime' 24 | import std.datetime: Clock, dur, Duration, SysTime; | ^ /build/ldc/driver/cache_pruning.d:24:8: note: Expected 'std/datetime.d' or 'std/datetime/package.d' in one of the following import paths: 24 | import std.datetime: Clock, dur, Duration, SysTime; | ^ import path[0] = /usr/lib/gcc/powerpc64le-linux-gnu/14/include/d import path[1] = /build/ldc import path[2] = /build/build-ldc make[2]: *** [CMakeFiles/ldc2.dir/build.make:234: obj/ldc2.o] Error 1 make[2]: Leaving directory '/build/build-ldc' make[1]: *** [CMakeFiles/Makefile2:331: CMakeFiles/ldc2.dir/all] Error 2 make[1]: Leaving directory '/build/build-ldc' make: *** [Makefile:169: all] Error 2
/build/ldc/driver/cache_pruning.d:24:8: error: unable to read module 'datetime' 24 | import std.datetime: Clock, dur, Duration, SysTime; | ^ /build/ldc/driver/cache_pruning.d:24:8: note: Expected 'std/datetime.d' or 'std/datetime/package.d' in one of the following import paths: 24 | import std.datetime: Clock, dur, Duration, SysTime; | ^
I guess apt-get install libgphobos-dev is missing.