From 4de69110fa769f9fd072e0153d89aa2c83281b4d Mon Sep 17 00:00:00 2001 From: Bjørn Forsman Date: Fri, 6 Oct 2023 17:00:47 +0200 Subject: quartus-prime-lite: modelsim: fix compiling encrypted device models LD_PRELOADing libudev breaks compiling encrypted device models in ModelSim, so only use LD_PRELOAD for non-ModelSim wrappers. Before: $ "$(NIXPKGS_ALLOW_UNFREE=1 nix-build -A quartus-prime-lite)/bin/vlog" "$(NIXPKGS_ALLOW_UNFREE=1 nix-build -A quartus-prime-lite.unwrapped)/modelsim_ase/altera/verilog/src/arriav_atoms_ncrypt.v" [...] ** Error: /nix/store/szcr2q24izqvhz7ybalar43y5xdg172a-quartus-prime-lite-unwrapped-20.1.1.720/modelsim_ase/altera/verilog/src/arriav_atoms_ncrypt.v(38): (vlog-2163) Macro ` is undefined. ** Error: /nix/store/szcr2q24izqvhz7ybalar43y5xdg172a-quartus-prime-lite-unwrapped-20.1.1.720/modelsim_ase/altera/verilog/src/arriav_atoms_ncrypt.v(38): (vlog-2163) Macro ` is undefined. ** Error: (vlog-13069) /nix/store/szcr2q24izqvhz7ybalar43y5xdg172a-quartus-prime-lite-unwrapped-20.1.1.720/modelsim_ase/altera/verilog/src/arriav_atoms_ncrypt.v(38): syntax error in protected region. [...] Errors: 4, Warnings: 0 After: $ "$(NIXPKGS_ALLOW_UNFREE=1 nix-build -A quartus-prime-lite)/bin/vlog" "$(NIXPKGS_ALLOW_UNFREE=1 nix-build -A quartus-prime-lite.unwrapped)/modelsim_ase/altera/verilog/src/arriav_atoms_ncrypt.v" [...] Errors: 0, Warnings: 0 --- .../applications/editors/quartus-prime/default.nix | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'pkgs/applications/editors') diff --git a/pkgs/applications/editors/quartus-prime/default.nix b/pkgs/applications/editors/quartus-prime/default.nix index 84a587e9621..cdeabc837ab 100644 --- a/pkgs/applications/editors/quartus-prime/default.nix +++ b/pkgs/applications/editors/quartus-prime/default.nix @@ -77,6 +77,11 @@ in buildFHSEnv rec { progs_wrapped+=("$wrapped") mkdir -p "$(dirname "$wrapped")" echo "#!${stdenv.shell}" >> "$wrapped" + case "$relname" in + modelsim_ase/*) + echo "export NIXPKGS_IS_MODELSIM_WRAPPER=1" >> "$wrapped" + ;; + esac echo "$wrapper $prog \"\$@\"" >> "$wrapped" done @@ -86,13 +91,20 @@ in buildFHSEnv rec { ln --symbolic --relative --target-directory ./bin ''${progs_wrapped[@]} ''; - # LD_PRELOAD fixes issues in the licensing system that cause memory corruption and crashes when - # starting most operations in many containerized environments, including WSL2, Docker, and LXC - # (a similiar fix involving LD_PRELOADing tcmalloc did not solve the issue in my situation) - # we use the name so that quartus can load the 64 bit verson and modelsim can load the 32 bit version - # https://community.intel.com/t5/Intel-FPGA-Software-Installation/Running-Quartus-Prime-Standard-on-WSL-crashes-in-libudev-so/m-p/1189032 profile = '' - export LD_PRELOAD=''${LD_PRELOAD:+$LD_PRELOAD:}libudev.so.0 + # LD_PRELOAD fixes issues in the licensing system that cause memory corruption and crashes when + # starting most operations in many containerized environments, including WSL2, Docker, and LXC + # (a similiar fix involving LD_PRELOADing tcmalloc did not solve the issue in my situation) + # we use the name so that quartus can load the 64 bit verson and modelsim can load the 32 bit version + # https://community.intel.com/t5/Intel-FPGA-Software-Installation/Running-Quartus-Prime-Standard-on-WSL-crashes-in-libudev-so/m-p/1189032 + # + # But, as can be seen in the above resource, LD_PRELOADing libudev breaks + # compiling encrypted device libraries in ModelSim (with error + # `(vlog-2163) Macro ` is undefined.`), so only use LD_PRELOAD + # for non-ModelSim wrappers. + if [ "$NIXPKGS_IS_MODELSIM_WRAPPER" != 1 ]; then + export LD_PRELOAD=''${LD_PRELOAD:+$LD_PRELOAD:}libudev.so.0 + fi ''; # Run the wrappers directly, instead of going via bash. -- cgit 1.4.1