From d44aa5081959cea90ede83f93e10a6d7c75ff3b5 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 12 Mar 2024 19:04:29 -0400 Subject: [PATCH 1/3] systemc: build with cmake, expand platforms to unix --- .../science/electronics/systemc/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/science/electronics/systemc/default.nix b/pkgs/applications/science/electronics/systemc/default.nix index dc6186841f47..4e14d08e63bf 100644 --- a/pkgs/applications/science/electronics/systemc/default.nix +++ b/pkgs/applications/science/electronics/systemc/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, autoreconfHook }: +{ lib, stdenv, fetchFromGitHub, cmake }: stdenv.mkDerivation rec { pname = "systemc"; @@ -11,16 +11,21 @@ stdenv.mkDerivation rec { sha256 = "0sj8wlkp68cjhmkd9c9lvm3lk3sckczpz7w9vby64inc1f9fnf0b"; }; - enableParallelBuilding = true; - nativeBuildInputs = [ autoreconfHook ]; + nativeBuildInputs = [ cmake ]; - configureFlags = [ "--with-unix-layout" ]; + cmakeFlags = [ + # Undefined reference to the sc_core::sc_api_version_2_3_4_XXX + # https://github.com/accellera-official/systemc/issues/21 + "-DCMAKE_CXX_STANDARD=17" + ]; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; meta = with lib; { description = "The language for System-level design, modeling and verification"; homepage = "https://systemc.org/"; license = licenses.asl20; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = with maintainers; [ victormignot amiloradovsky ]; }; } From 2dc4b18eb65b64351e67bdf2f950ab101f150e40 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 12 Mar 2024 19:17:01 -0400 Subject: [PATCH 2/3] verilator: fix locating systemc --- pkgs/applications/science/electronics/verilator/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/science/electronics/verilator/default.nix b/pkgs/applications/science/electronics/verilator/default.nix index 062ba93ca420..9923d8a6a419 100644 --- a/pkgs/applications/science/electronics/verilator/default.nix +++ b/pkgs/applications/science/electronics/verilator/default.nix @@ -37,6 +37,11 @@ stdenv.mkDerivation rec { done ''; + env = { + SYSTEMC_INCLUDE = "${lib.getDev systemc}/include"; + SYSTEMC_LIBDIR = "${lib.getLib systemc}/lib"; + }; + meta = with lib; { description = "Fast and robust (System)Verilog simulator/compiler and linter"; homepage = "https://www.veripool.org/verilator"; From cf7deee3492779ec316526c6c438eb4ca1c567fc Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 12 Mar 2024 19:57:05 -0400 Subject: [PATCH 3/3] verilator: add patch for "attempted to destroy locked Thread Pool" failure in tests --- .../science/electronics/verilator/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/science/electronics/verilator/default.nix b/pkgs/applications/science/electronics/verilator/default.nix index 9923d8a6a419..92f8fa52b91f 100644 --- a/pkgs/applications/science/electronics/verilator/default.nix +++ b/pkgs/applications/science/electronics/verilator/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, perl, flex, bison, python3, autoconf, +{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, flex, bison, python3, autoconf, which, cmake, ccache, help2man, makeWrapper, glibcLocales, systemc, git, numactl }: @@ -13,6 +13,15 @@ stdenv.mkDerivation rec { hash = "sha256-Ya3lqK8BfvMVLZUrD2Et6OmptteWXp5VmZb2x2G/V/E="; }; + patches = [ + (fetchpatch { + # Fix try-lock spuriously fail in V3ThreadPool destructor + # https://github.com/verilator/verilator/pull/4938 + url = "https://github.com/verilator/verilator/commit/4b9cce4369c78423779238e585ed693c456d464e.patch"; + hash = "sha256-sGrk/pxqZqUcmJdzQoPlzXMmYqHCOmd9Y2n6ieVNg1U="; + }) + ]; + enableParallelBuilding = true; buildInputs = [ perl python3 systemc ]; # ccache nativeBuildInputs = [ makeWrapper flex bison autoconf help2man git ];