Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vivado: init at 2017.2 #93436

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

vivado: init at 2017.2 #93436

wants to merge 14 commits into from

Conversation

matthuszagh
Copy link
Contributor

@matthuszagh matthuszagh commented Jul 18, 2020

Adds Vivado 2017.2. Note that most of the work is not my own. I received permission to create this PR by @lukaslaobeyer here. Since Vivado is not open source, you must prefetch the file (see derivation message) in order to build it. Finally, 2017 is not the newest version, but I was unable to make much headway on 2019.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Comment on lines +39 to +52
# requireFile prevents rehashing each time, which saves time during
# rebuilds.
src = requireFile rec {
name = "Xilinx_Vivado_SDK_2017.2_0616_1.tar.gz";
message = ''
This nix expression requires that ${name} is already part of the store.
Login to Xilinx, download from
https://www.xilinx.com/support/download.html,
rename the file to ${name}, and add it to the nix store with
"nix-prefetch-url file:///path/to/${name}".
'';
sha256 = "06pb4wjz76wlwhhzky9vkyi4aq6775k63c2kw3j9prqdipxqzf9j";
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the requireFile arguments (name and sha256) arguments with default values to the derivation (i.e. after line 21)? That'll make it a bit easier for people to upgrade on their own (with vivado.override { name = "..."; sha256 = "..."; } rather than making an overlay) after Xilinx releases new versions that haven't been hashed/submitted here yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@9999years definitely. The only thing is I can't guarantee the builder will work for anything other than this version. For instance, the builder failed for 2019.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with vivado.override { name = "..."; sha256 = "..."; } rather than making an overlay

For instance, the builder failed for 2019.

Than we should not add this and let people overwrite it with overwriteAttr

@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@RaitoBezarius
Copy link
Member

@flokli you told me you had some Vivado exprs, do you know which version it is for?
@matthuszagh Can I do something to help you get this merged?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 1, 2022
@matthuszagh
Copy link
Contributor Author

@RaitoBezarius thanks for the reminder - I'd let this PR slip. I think the only remaining thing to do is to migrate the stuff from builder.sh into the appropriate phases. I'm going to try to get started on that, but I'm a bit strapped for time so I'm not entirely sure how long it will take. If you're feeling impatient, I wouldn't be opposed to you tackling some of that.

@matthuszagh
Copy link
Contributor Author

I made a simple attempt to migrate builder.sh into default.nix. Builds fine, although I haven't tested the vivado binary since I'm running into this at the moment.

@matthuszagh
Copy link
Contributor Author

matthuszagh commented Dec 1, 2022

Something we might want to consider is the installed modules are currently not configurable. It might be better to allow these to be easily overridden. I don't know what happens with the installation when modules that are not supported by the free edition are selected. But, for instance, some Kintex-7 devices are available in the free edition and these are not currently installed.

@RaitoBezarius
Copy link
Member

I made a simple attempt to migrate builder.sh into default.nix. Builds fine, although I haven't tested the vivado binary since I'm running into this at the moment.

Do you know which glibc is needed and can you attempt a explicit LD_PRELOAD?

@RaitoBezarius
Copy link
Member

Something we might want to consider is the installed modules are currently not configurable. It might be better to allow these to be easily overridden. I don't know what happens with the installation when modules that are not supported by the free edition are selected. But, for instance, some Kintex-7 devices are available in the free edition and these are not currently installed.

I think we can revisit this later, ultimately, but it's good to keep it in mind.

pkgs/applications/science/electronics/vivado/default.nix Outdated Show resolved Hide resolved
pkgs/applications/science/electronics/vivado/default.nix Outdated Show resolved Hide resolved
dontBuild = true;

installPhase = ''
# generate an installation config file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From where did you get this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, along with pretty much everything else, I took from the original derivation (see this). Do you want something changed from it? Some of these settings could probably exposed so that someone can customize them more easily.

CreateFileAssociation=0
EOF

($(pwd)/xsetup --agree 3rdPartyEULA,WebTalkTerms,XilinxEULA --batch Install --config install_config.txt || true) | while read line
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
($(pwd)/xsetup --agree 3rdPartyEULA,WebTalkTerms,XilinxEULA --batch Install --config install_config.txt || true) | while read line
(./xsetup --agree 3rdPartyEULA,WebTalkTerms,XilinxEULA --batch Install --config install_config.txt || true) | while read line

Why do we allow it to fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I didn't write it. But, I suppose I can test what happens when it does fail.

pkgs/applications/science/electronics/vivado/default.nix Outdated Show resolved Hide resolved
pkgs/applications/science/electronics/vivado/default.nix Outdated Show resolved Hide resolved
sed -i -- 's|`basename "\$0"`|xsdk|g' $out/opt/SDK/2017.2/bin/.xsdk-wrapped
'';

libPath = lib.makeLibraryPath [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this into a let in to postFixup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error when I try to run vivado after doing this: application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory. It works if I keep it out of the let though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is because your are using bash variables instead of nix ones in preFixup. Please use nix variables there.

pkgs/applications/science/electronics/vivado/default.nix Outdated Show resolved Hide resolved
pkgs/applications/science/electronics/vivado/default.nix Outdated Show resolved Hide resolved
@flokli
Copy link
Contributor

flokli commented Dec 5, 2022

@flokli you told me you had some Vivado exprs, do you know which version it is for? @matthuszagh Can I do something to help you get this merged?

@RaitoBezarius I have a vivado 2019.2 expression, you can source it from here: https://github.com/flokli/pynq/blob/master/nix/pkgs/vivado/default.nix

@matthuszagh
Copy link
Contributor Author

@SuperSandro2000 I left a few of your comments open because I'm not totally sure I addressed them, but I did update a lot of things. Let me know what you think now.

Comment on lines +116 to +124
# Patch ELFs
for f in $out/opt/Vivado/$version/bin/unwrapped/lnx64.o/*
do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f || true
done
for f in $out/opt/SDK/$version/bin/unwrapped/lnx64.o/*
do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f || true
done
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Patch ELFs
for f in $out/opt/Vivado/$version/bin/unwrapped/lnx64.o/*
do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f || true
done
for f in $out/opt/SDK/$version/bin/unwrapped/lnx64.o/*
do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f || true
done
# Patch ELFs
for f in $out/opt/Vivado/$version/bin/unwrapped/lnx64.o/*; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f
done
for f in $out/opt/SDK/$version/bin/unwrapped/lnx64.o/*; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f
done

the build should fail if patchelf fails

Comment on lines +128 to +131
wrapProgram $out/opt/Vivado/$version/bin/vivado --prefix LD_LIBRARY_PATH : "$libPath"
wrapProgram $out/opt/SDK/$version/bin/xsdk --prefix LD_LIBRARY_PATH : "$libPath"
wrapProgram $out/opt/SDK/$version/eclipse/lnx64.o/eclipse --prefix LD_LIBRARY_PATH : "$libPath"
wrapProgram $out/opt/SDK/$version/tps/lnx64/jre/bin/java --prefix LD_LIBRARY_PATH : "$libPath"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wrapProgram $out/opt/Vivado/$version/bin/vivado --prefix LD_LIBRARY_PATH : "$libPath"
wrapProgram $out/opt/SDK/$version/bin/xsdk --prefix LD_LIBRARY_PATH : "$libPath"
wrapProgram $out/opt/SDK/$version/eclipse/lnx64.o/eclipse --prefix LD_LIBRARY_PATH : "$libPath"
wrapProgram $out/opt/SDK/$version/tps/lnx64/jre/bin/java --prefix LD_LIBRARY_PATH : "$libPath"
for file in $out/opt/Vivado/$version/bin/vivado $out/opt/SDK/$version/bin/xsdk $out/opt/SDK/$version/eclipse/lnx64.o/eclipse $out/opt/SDK/$version/tps/lnx64/jre/bin/java ; do
wrapProgram $file --prefix LD_LIBRARY_PATH : "$libPath"
done

Comment on lines +112 to +114
# Hack around lack of libtinfo in NixOS
ln -s $ncurses/lib/libncursesw.so.6 $out/opt/Vivado/$version/lib/lnx64.o/libtinfo.so.5
ln -s $ncurses/lib/libncursesw.so.6 $out/opt/SDK/$version/lib/lnx64.o/libtinfo.so.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change that name with patchelf which is a bit cleaner

Comment on lines +108 to +110
# Patch installed files
patchShebangs $out/opt/Vivado/$version/bin
patchShebangs $out/opt/SDK/$version/bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Patch installed files
patchShebangs $out/opt/Vivado/$version/bin
patchShebangs $out/opt/SDK/$version/bin
patchShebangs $out/opt/{Vivado,SDK}/$version/bin

@flokli
Copy link
Contributor

flokli commented Jan 12, 2023

What's with #93436 (comment) ?

@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants