From 922ccc33640ba1ccc595d16e9bf465e6ded12c18 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Mon, 13 Apr 2026 09:54:57 +1000 Subject: [PATCH] ghdl: 5.1.1 -> 6.0.0, fix gcc build release notes: https://github.com/ghdl/ghdl/releases/tag/v6.0.0 upstream changes: https://github.com/ghdl/ghdl/compare/v5.1.1...v6.0.0 unpins the `ghdl-llvm` backend from llvm 20, as ghdl now supports building with llvm up to version 22 For `ghdl-gcc`, the build was failing because newer gcc versions had requirements for building that neither us or upstream can handle, so pinning the version to gcc13 and building against that, like upstream does, fixed the issues. Also changed the configure flags passed to gcc based on the configure options used in building `pkgs.gcc` Fixes: #447662 --- pkgs/by-name/gh/ghdl/package.nix | 30 ++++++++++++++++++------------ pkgs/top-level/all-packages.nix | 5 +---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/gh/ghdl/package.nix b/pkgs/by-name/gh/ghdl/package.nix index 3b879ebd2052..622e2a15338a 100644 --- a/pkgs/by-name/gh/ghdl/package.nix +++ b/pkgs/by-name/gh/ghdl/package.nix @@ -6,13 +6,12 @@ zlib, llvm, lib, - gcc-unwrapped, + gcc13, texinfo, gmp, mpfr, libmpc, gnutar, - glibc, makeWrapper, backend ? "mcode", }: @@ -21,13 +20,13 @@ assert backend == "mcode" || backend == "llvm" || backend == "gcc"; stdenv.mkDerivation (finalAttrs: { pname = "ghdl-${backend}"; - version = "5.1.1"; + version = "6.0.0"; src = fetchFromGitHub { owner = "ghdl"; repo = "ghdl"; - rev = "v${finalAttrs.version}"; - hash = "sha256-vPeODNTptxIjN6qLoIHaKOFf3P3iAK2GloVreHPaAz8="; + tag = "v${finalAttrs.version}"; + hash = "sha256-Q5lAWMa1SFjoIJTdWlHSbS4Cg5RYWiej8F05Xrz9ArY="; }; env.LIBRARY_PATH = "${stdenv.cc.libc}/lib"; @@ -39,6 +38,7 @@ stdenv.mkDerivation (finalAttrs: { texinfo makeWrapper ]; + buildInputs = [ zlib ] @@ -50,6 +50,7 @@ stdenv.mkDerivation (finalAttrs: { mpfr libmpc ]; + propagatedBuildInputs = [ ] ++ lib.optionals (backend == "llvm" || backend == "gcc") [ @@ -61,7 +62,7 @@ stdenv.mkDerivation (finalAttrs: { sed -i 's/check_version 7.0/check_version 7/g' configure '' + lib.optionalString (backend == "gcc") '' - ${gnutar}/bin/tar -xf ${gcc-unwrapped.src} + ${gnutar}/bin/tar -xf ${gcc13.cc.src} ''; configureFlags = [ @@ -73,16 +74,16 @@ stdenv.mkDerivation (finalAttrs: { "--with-llvm-config=${llvm.dev}/bin/llvm-config" ] ++ lib.optionals (backend == "gcc") [ - "--with-gcc=gcc-${gcc-unwrapped.version}" + "--with-gcc=gcc-${gcc13.cc.version}" ]; buildPhase = lib.optionalString (backend == "gcc") '' make copy-sources mkdir gcc-objs cd gcc-objs - ../gcc-${gcc-unwrapped.version}/configure \ - --with-native-system-header-dir=/include \ - --with-build-sysroot=${lib.getDev glibc} \ + ../gcc-${gcc13.cc.version}/configure \ + --with-native-system-header-dir=${lib.getDev stdenv.cc.libc}/include \ + --with-build-sysroot=/ \ --prefix=$out \ --enable-languages=c,vhdl \ --disable-bootstrap \ @@ -90,7 +91,12 @@ stdenv.mkDerivation (finalAttrs: { --disable-multilib \ --disable-libssp \ --disable-libgomp \ - --disable-libquadmath + --disable-libquadmath \ + --with-gmp-include=${gmp.dev}/include \ + --with-gmp-lib=${gmp.out}/lib \ + --with-mpfr-include=${mpfr.dev}/include \ + --with-mpfr-lib=${mpfr.out}/lib \ + --with-mpc=${libmpc} make -j $NIX_BUILD_CORES make install cd ../ @@ -101,7 +107,7 @@ stdenv.mkDerivation (finalAttrs: { wrapProgram $out/bin/ghdl \ --set LIBRARY_PATH ${ lib.makeLibraryPath [ - glibc + stdenv.cc.libc ] } ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0c7ae8abd103..4365f767f877 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4101,10 +4101,7 @@ with pkgs; ghdl-gcc = ghdl.override { backend = "gcc"; }; - ghdl-llvm = ghdl.override { - backend = "llvm"; - inherit (llvmPackages_20) llvm; - }; + ghdl-llvm = ghdl.override { backend = "llvm"; }; gcc-arm-embedded = gcc-arm-embedded-15;