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

buildRustPackage now installs binaries to bin and libraries to lib #47556

Closed
wants to merge 3 commits into from

Conversation

et4te
Copy link
Contributor

@et4te et4te commented Sep 30, 2018

Motivation for this change

buildRustPackage was not installing static libs and was installing .so to bin.

Fixes this issue: #46985

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Fits CONTRIBUTING.md.

pkgs/build-support/rust/default.nix Outdated Show resolved Hide resolved
pkgs/build-support/rust/default.nix Outdated Show resolved Hide resolved
pkgs/build-support/rust/default.nix Outdated Show resolved Hide resolved
pkgs/build-support/rust/default.nix Show resolved Hide resolved
find target/release -maxdepth 1 -executable -type f -exec cp "{}" $out/bin \;
mkdir -p $out/bin $out/lib
find target/release -maxdepth 1 -type f -executable ! \( -regex ".*.\(so.[0-9]\|so\|a\|dylib\)" \) -print0 | xargs -r -0 cp -t $out/bin
find target/release -maxdepth 1 -regex ".*.\(so.[0-9]\|so\|a\|dylib\)" -print0 | xargs -r -0 cp -t $out/lib
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what the rust does but openssl has more complex sonames: libcrypto.so.1.0.0

Should be covered by

so.[0-9.]\+

I hope.

Copy link
Member

Choose a reason for hiding this comment

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

Does find match the whole string with the regex or does it need a $ at the end?

Copy link
Contributor Author

@et4te et4te Oct 1, 2018

Choose a reason for hiding this comment

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

I changed it to [0-9.]+ since the escape char breaks it. According to man find matches on the whole path.

@Mic92
Copy link
Member

Mic92 commented Oct 1, 2018

@GrahamcOfBorg build fd

@Mic92
Copy link
Member

Mic92 commented Oct 1, 2018

Please change this pull request to the staging branch (since it rebuilds quite a lot).
This will also require a local rebase + force push usually.
Alternatively you can use git cherry-pick on the checked out staging branch.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: fd

Partial log (click to expand)

post-installation fixup
moving /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0/man to /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0/share/man
shrinking RPATHs of ELF executables and libraries in /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0
shrinking /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0/bin/fd
gzipping man pages under /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0/share/man/
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0/bin
patching script interpreter paths in /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0
checking for references to /build in /nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0...
/nix/store/mq81ah48s92xqnnsjqnsa3bbfyd3520p-fd-7.1.0

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: fd

Partial log (click to expand)

test result: ok. 36 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

installing
post-installation fixup
moving /nix/store/24f19d9ay5wvfr0adfpp6x5raglr16b9-fd-7.1.0/man to /nix/store/24f19d9ay5wvfr0adfpp6x5raglr16b9-fd-7.1.0/share/man
gzipping man pages under /nix/store/24f19d9ay5wvfr0adfpp6x5raglr16b9-fd-7.1.0/share/man/
strip is /nix/store/4w56qihlrddav67p7d1vy5qkyayaqw11-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/24f19d9ay5wvfr0adfpp6x5raglr16b9-fd-7.1.0/bin
patching script interpreter paths in /nix/store/24f19d9ay5wvfr0adfpp6x5raglr16b9-fd-7.1.0
/nix/store/24f19d9ay5wvfr0adfpp6x5raglr16b9-fd-7.1.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: fd

Partial log (click to expand)

post-installation fixup
moving /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0/man to /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0/share/man
shrinking RPATHs of ELF executables and libraries in /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0
shrinking /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0/bin/fd
gzipping man pages under /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0/share/man/
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0/bin
patching script interpreter paths in /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0
checking for references to /build in /nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0...
/nix/store/pbwwr1g1ic714jdpchsf3dyz5lb9hg5p-fd-7.1.0

@et4te
Copy link
Contributor Author

et4te commented Oct 2, 2018

Please change this pull request to the staging branch (since it rebuilds quite a lot).
This will also require a local rebase + force push usually.
Alternatively you can use git cherry-pick on the checked out staging branch.

Generally I agree that patches should go in staging. This change however is required for any Rust project which builds static libraries and changes a very small amount of code - it is a required bugfix for anyone writing Rust FFI code which depends on static libraries. IMO this qualifies for a change that should be expeditiously merged into master. If the final commit is deemed to not be appropriate (final) and requires extra future rebuilds then rebasing onto staging seems like a better idea but I don't think this is the case here.

@Mic92
Copy link
Member

Mic92 commented Oct 2, 2018

Well also it is a small change it still will rebuild many packages. We only try to merge code we are confident about to staging. It has nothing to do with the complexity of the change but the amount of rebuilds.

@Mic92 Mic92 mentioned this pull request Oct 2, 2018
9 tasks
@Mic92
Copy link
Member

Mic92 commented Oct 2, 2018

This should also go to staging-18.09

@et4te
Copy link
Contributor Author

et4te commented Oct 3, 2018

Made a pull request on staging-18.09 here #47709

@Mic92
Copy link
Member

Mic92 commented Oct 3, 2018

Your change was merged into staging

@Mic92 Mic92 closed this Oct 3, 2018
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

3 participants