From 568398e3381b55b6ac2b5d8a49f04a7e9c2f16a1 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 7 Nov 2022 21:16:38 -0800 Subject: [PATCH 1/3] uhdm: 0.9.1.40 -> 1.45 Update UHDM and also fix for Darwin build. The gtest version used in the project unconditionally uses /tmp as temporary directory in Darwin and does not honor the environment variables introduced in gtest 1.12. Use that gtest version so that it will work in the Hydra build environment. Related: #199919 as this is fixing the Darwin build. Signed-off-by: Henner Zeller --- .../science/logic/uhdm/default.nix | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/science/logic/uhdm/default.nix b/pkgs/applications/science/logic/uhdm/default.nix index 47b9bb0d9423..a87b6fbf35fa 100644 --- a/pkgs/applications/science/logic/uhdm/default.nix +++ b/pkgs/applications/science/logic/uhdm/default.nix @@ -3,26 +3,46 @@ , fetchFromGitHub , cmake , python3 +, gtest +, fetchpatch }: stdenv.mkDerivation rec { pname = "UHDM"; - version = "0.9.1.40"; + version = "1.45"; src = fetchFromGitHub { owner = "chipsalliance"; repo = pname; rev = "v${version}"; - hash = "sha256-CliKU2WM8B9012aDcS/mTyIf+JcsVsc4uRRi9+FRWbM="; + hash = "sha256-mxQRmI8yUUrSUYa4kUT9URgfqYvuz3V9e1IGjtiHyhc="; fetchSubmodules = true; }; + # Add ability to use local googletest provided from nix instead of + # the version from the submodule in third_party/. The third_party/ version + # is slightly older and does not work with our hydra Darwin builds that needs + # to set a particular temp directory. + # This patch allows to choose UHDM_USE_HOST_GTEST=On in the cflags. + patches = [ + (fetchpatch { + url = "https://github.com/chipsalliance/UHDM/commit/ad60fdb65a7c49fdc8ee3fffdca791f9364af4f5.patch"; + sha256 = "sha256-IkwnepWWmBychJ0mu+kaddUEc9jkldIRq+GyJkhrO8A="; + name = "allow-local-gtest.patch"; + }) + ]; + nativeBuildInputs = [ cmake ]; buildInputs = [ (python3.withPackages (p: with p; [ orderedmultidict ])) + gtest + ]; + + cmakeFlags = [ + "-DUHDM_USE_HOST_GTEST=On" ]; doCheck = true; @@ -33,12 +53,6 @@ stdenv.mkDerivation rec { rm -rf $out/lib/uhdm ''; - prePatch = '' - substituteInPlace CMakeLists.txt --replace \ - 'capnp compile' \ - 'capnp compile --src-prefix=''${GENDIR}/..' - ''; - meta = { description = "Universal Hardware Data Model"; homepage = "https://github.com/chipsalliance/UHDM"; From 50c509ecf31818d39abdec57c3df4243bb2e4274 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 8 Nov 2022 10:46:28 -0800 Subject: [PATCH 2/3] surelog: 1.40 -> 1.45 Update Surelog (going along with uhdm 1.45). Fix flaky tests to to parallel execution of ctest by patching in a fix that is already upstream. Result zero hydra failures #199919 Also: using flatbuffers from nix environment instead of third_party/ Signed-off-by: Henner Zeller --- .../science/logic/surelog/default.nix | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/logic/surelog/default.nix b/pkgs/applications/science/logic/surelog/default.nix index b5130654c371..c3e127282cb9 100644 --- a/pkgs/applications/science/logic/surelog/default.nix +++ b/pkgs/applications/science/logic/surelog/default.nix @@ -7,20 +7,33 @@ , libuuid , openjdk11 , gperftools +, flatbuffers +, fetchpatch }: stdenv.mkDerivation rec { pname = "surelog"; - version = "1.40"; + version = "1.45"; src = fetchFromGitHub { owner = "chipsalliance"; repo = pname; rev = "v${version}"; - hash = "sha256-5nhJilFIJJDCnJUEUgyPNtWSQUgWcvM6LDFgFatAl/k="; + hash = "sha256-/SSKcEIhmWDOKN4v3djWTwZ5/nQvR8ibflzSVFDt/rM="; fetchSubmodules = true; }; + # This prevents race conditions in unit tests that surface since we run + # ctest in parallel. + # This patch can be removed with the next version of surelog + patches = [ + (fetchpatch { + url = "https://github.com/chipsalliance/Surelog/commit/9a54efbd156becf65311a4272104810f36041fa6.patch"; + sha256 = "sha256-rU1Z/0wlVTgnPLqTN/87n+gI1iJ+6k/+sunVVd0ulhQ="; + name = "parallel-test-running.patch"; + }) + ]; + nativeBuildInputs = [ cmake pkg-config @@ -34,6 +47,11 @@ stdenv.mkDerivation rec { buildInputs = [ libuuid gperftools + flatbuffers + ]; + + cmakeFlags = [ + "-DSURELOG_USE_HOST_FLATBUFFERS=On" ]; doCheck = true; From ec912ab1dda065810d3f8344de58d0012aefe156 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 8 Nov 2022 11:48:29 -0800 Subject: [PATCH 3/3] yosys-symbiflow: 2022.09.27 -> 2022.11.07 Update plugins to be compatible with latest surelog/uhdm (1.45). Also fix expected googletest path so that it comes from the nix environment, not third_party/. Signed-off-by: Henner Zeller --- .../compilers/yosys/plugins/symbiflow.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/yosys/plugins/symbiflow.nix b/pkgs/development/compilers/yosys/plugins/symbiflow.nix index 97f0cdb7b5fa..31e429284c06 100644 --- a/pkgs/development/compilers/yosys/plugins/symbiflow.nix +++ b/pkgs/development/compilers/yosys/plugins/symbiflow.nix @@ -9,16 +9,17 @@ , yosys-symbiflow , uhdm , surelog +, flatbuffers }: let src = fetchFromGitHub { owner = "chipsalliance"; repo = "yosys-f4pga-plugins"; - rev = "27208ce08200a5e89e3bd4f466bc68824df38c32"; - hash = "sha256-S7txjzlIp+idWIfp/DDOznluA3aMFfosMUt5dvi+g44="; + rev = "e23ff6db487da9ceea576c53ac33853566c3a84e"; + hash = "sha256-HJ4br6lQwRrcnkLgV3aecr3T3zcPzA11MfxhRjwIb0I="; }; - version = "2022.09.27"; + version = "2022.11.07"; # Supported symbiflow plugins. # @@ -60,6 +61,7 @@ in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec { patches = lib.optional ( plugin == "ql-qlf" ) ./symbiflow-pmgen.patch; preBuild = '' + export LDFLAGS="-L${flatbuffers}/lib" mkdir -p ql-qlf-plugin/pmgen '' + lib.optionalString ( plugin == "ql-qlf" ) '' @@ -68,8 +70,8 @@ in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec { # Providing a symlink avoids the need for patching the test makefile postUnpack = '' - mkdir -p source/third_party/googletest/googletest/build/ - ln -s ${static_gtest}/lib source/third_party/googletest/googletest/build/lib + mkdir -p source/third_party/googletest/build/ + ln -s ${static_gtest}/lib source/third_party/googletest/build/lib ''; makeFlags = [