quartus-prime-lite: improvements & fixes#257089
Conversation
Instead of maintaining both a list of executables to wrap and their directory names, extract the directory names from the executables and run mkdir as needed. Keep DRY.
Upper case shell variables are generally for internal variables (SHELL, BASH_VERSION) or environment variables (PAGER, EDITOR). Other variables should be lower case.
This opens up for using sh globbing (and possibly wrapping *all* programs), something which is not possible when the program list is coded in Nix.
(In preparation for adding lmutil.) Quartus is a mix of 32- and 64-bit programs, and these "lsb" loaders are required by some of the unwrapped binaries: $ find /nix/store/HASH-quartus-prime-lite-unwrapped-20.1.1.720 -type f -executable | xargs -n1 patchelf --print-interpreter |& grep "ld-lsb" | sort -u /lib64/ld-lsb-x86-64.so.3 /lib/ld-lsb.so.3
It's tool to check the validity of licenses, and vsim suggests running it when it has issues validating a license. (At least in Quartus 22.1.2.)
These are useful for Modelsim scripting.
* Upstream recommends it (adding $QUARTUS_ROOTDIR/bin to $PATH). * It's cool that nixpkgs *can* do these tricks (only expose a subset of programs), but in this case I don't think it's a good idea. For example, before this change I was missing the `jtagconfig` program. * This increases the number of programs in .../bin from 29 to 80.
* Set LD_PRELOAD in the profile snippet to eliminate one execve() for `env`. * Set runScript to "" to eliminate one execve() for bash.
Instead, merge the user provided LD_PRELOAD environment variable with the hardcoded libudev.so.1 entry. User provided libs are loaded first.
The former is deprecated. The latter is implemented with buildFHSEnvBubblewrap. The reason this package was switched to buildFHSEnvChroot in the first place[1] is fixed by passing `multiArch = true` (which brings e.g. 32-bit dynamic loader /lib/ld-linux.so.2). [1] Commit cae417d ("quartus-prime: use buildFHSEnvChroot")
Coding style.
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 `<protected> 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 `<protected> 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
Prevent regressions.
stdenv.shell is a shell for building, runtimeShell is for running, so the latter should be used in wrappers. (The distinction only matters when cross-compiling.)
|
Merging in two days unless there are objections. |
Mic92
left a comment
There was a problem hiding this comment.
Looks fine visually. Didn't test it.
kwohlfahrt
left a comment
There was a problem hiding this comment.
I don't have time to test, but this looks good to me.
| wrapper=$out/bin/${name} | ||
| progs_wrapped=() | ||
| for prog in ''${progs_to_wrap[@]}; do | ||
| relname="''${prog#"${unwrapped}/"}" |
There was a problem hiding this comment.
I'm not up on my bash-isms, this is doing something like realpath --relative-to "${unwrapped}" "$prog"?
There was a problem hiding this comment.
Yes, looks like it.
|
I will test later today |
|
Some other suggestions you might or might not consider taking:
Other than that, I was able to generate a design with Qsys then synthesize it with Quartus both as GUI apps and in the Nix sandbox. I was also able to USB blast my design onto a board. I did not check Modelsim. |
I'm not familiar with that tool, but the GUI comes up (with seemingly working fonts) both on nixpkgs-unstable and on this PR branch. I suggest making further imrovements in other PRs. Good to merge or does anyone want to test more? |
All this should need is to add the two packages under |
I see, but since I don't know how to test it, and qsys-edit already launch for me, I'd prefer if that can be done in another PR. (You also mentioned other fixes (qemu), which I don't feel comfortable with including here just because it's related to quartus.) |
|
Successfully created backport PR for |
Description of changes
Best reviewed per commit:
UPDATE: More commits:
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)