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

chicken: fix egg installation by preserving compiled libdir #54109

Closed
wants to merge 1 commit into from

Conversation

evhan
Copy link
Contributor

@evhan evhan commented Jan 16, 2019

Setting just PREFIX is enough to put libraries in $out/lib when building CHICKEN, whereas setting VARDIR and then moving files from /var to /lib breaks egg installation because the library installation path ends up differing from the library search path.

This patch also removes CHICKEN_REPOSITORY_PATH from PATH since it contains libraries, not executables, and removes unnecessary trailing slashes on search paths.

All of this applies only to installation of eggs using the tools in the chicken package. Eggs installed via eggDerivation are unaffected.

Motivation for this change

The chicken-install program fails for the reason above. Here are the current settings:

Installation prefix:             /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0
Extension installation location: /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0/var/lib/chicken/9
Extension path:                  /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0/lib/chicken/9

Here is an example installation failure. This installs the extension srfi-13, which depends on srfi-14. The latter is installed successfully (because it has no dependencies), but the former fails since the dependency is not available:

[nix-shell:~]$ chicken-install srfi-13
building srfi-14
   /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0/bin/csc -host -D compiling-extension -J -s -setup-mode -I /home/evhan/.chicken-install/cache/srfi-14 -C -I/home/evhan/.chicken-install/cache/srfi-14 -O3 -d0 srfi-14.scm -o /home/evhan/.chicken-install/cache/srfi-14/srfi-14.so
   /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0/bin/csc -setup-mode -static -I /home/evhan/.chicken-install/cache/srfi-14 -emit-link-file /home/evhan/.chicken-install/cache/srfi-14/srfi-14.link -host -D compiling-extension -c -unit srfi-14 -D compiling-static-extension -C -I/home/evhan/.chicken-install/cache/srfi-14 -O3 -d0 srfi-14.scm -o /home/evhan/.chicken-install/cache/srfi-14/srfi-14.static.o
   /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0/bin/csc -setup-mode -s -host -I /home/evhan/.chicken-install/cache/srfi-14 -C -I/home/evhan/.chicken-install/cache/srfi-14 -O3 -d0 srfi-14.import.scm -o /home/evhan/.chicken-install/cache/srfi-14/srfi-14.import.so
installing srfi-14
building srfi-13
   /nix/store/h5qlx1xjcg2wavq4f60m1qdyrlrkqjrg-chicken-5.0.0/bin/csc -host -D compiling-extension -J -s -setup-mode -I /home/evhan/.chicken-install/cache/srfi-13 -C -I/home/evhan/.chicken-install/cache/srfi-13 -O3 -d0 srfi-13.scm -o /home/evhan/.chicken-install/cache/srfi-13/srfi-13.so

Syntax error (import): cannot import from undefined module

        srfi-14

Error: shell command terminated with nonzero exit code

Note that nox-review currently fails for this PR due to the problem fixed by #53854. When this commit applied after that one, it passes.

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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@infinisil
Copy link
Member

What's the set of commands to reproduce the error you fixed?

@infinisil infinisil self-assigned this Jan 26, 2019
@evhan
Copy link
Contributor Author

evhan commented Jan 27, 2019

What's the set of commands to reproduce the error you fixed?

Running chicken-install -sudo -test srfi-13 with the chicken package installed will reproduce the example above, so I guess nix-shell -p chicken --run "chicken-install -sudo -test srfi-13" will do.

@infinisil
Copy link
Member

I'm calling chicken-install directly, which I thought should work too, but it doesn't:

$ $(nix-build -A chicken)/bin/chicken-install -sudo -test srfi-13
TCP connect timeout
TCP connect timeout
TCP connect timeout
building srfi-14
   /nix/store/8pnxzvc5jrajcihhcq9qxs6p0w8jkl41-chicken-5.0.0/bin/csc -host -D compiling-extension -J -s -setup-mode -I /home/infinisil/.chicken-install/cache/srfi-14 -C -I/home/infinisil/.chicken-install/cache/srfi-14 -O3 -d0 srfi-14.scm -o /home/infinisil/.chicken-install/cache/srfi-14/srfi-14.so
   /nix/store/8pnxzvc5jrajcihhcq9qxs6p0w8jkl41-chicken-5.0.0/bin/csc -setup-mode -static -I /home/infinisil/.chicken-install/cache/srfi-14 -emit-link-file /home/infinisil/.chicken-install/cache/srfi-14/srfi-14.link -host -D compiling-extension -c -unit srfi-14 -D compiling-static-extension -C -I/home/infinisil/.chicken-install/cache/srfi-14 -O3 -d0 srfi-14.scm -o /home/infinisil/.chicken-install/cache/srfi-14/srfi-14.static.o
   /nix/store/8pnxzvc5jrajcihhcq9qxs6p0w8jkl41-chicken-5.0.0/bin/csc -setup-mode -s -host -I /home/infinisil/.chicken-install/cache/srfi-14 -C -I/home/infinisil/.chicken-install/cache/srfi-14 -O3 -d0 srfi-14.import.scm -o /home/infinisil/.chicken-install/cache/srfi-14/srfi-14.import.so
  installing srfi-14
install: cannot create regular file '/nix/store/8pnxzvc5jrajcihhcq9qxs6p0w8jkl41-chicken-5.0.0/lib/chicken/9/srfi-14.o': Read-only file system

Error: shell command terminated with nonzero exit code
256
"sudo sh /home/infinisil/.chicken-install/cache/srfi-14/srfi-14.install.sh"

@evhan
Copy link
Contributor Author

evhan commented Jan 27, 2019

OK. I'd also expect calling it directly to work the same way, and I think it probably is.

I haven't seen that error, but I'm not on NixOS and my /nix/store isn't read-only, so I wouldn't expect to. I guess because the store isn't writable on NixOS then this issue applies only to non-NixOS platforms.

@infinisil
Copy link
Member

but I'm not on NixOS and my /nix/store isn't read-only

A writable store isn't turned on by default, and with good reason, because this breaks a lot of good things on Nix! I really suggest you to turn this setting back, because this just causes problems for others when you contribute, as seen from here.

@evhan
Copy link
Contributor Author

evhan commented Jan 27, 2019

I don't recall changing it, but it's possible I did! In any case, I'll remember to test with a read-only store in the future, sorry about that.

I've just made /nix/store read-only using the instructions here and I see the same error you do, which makes sense as chicken-install is attempting to write to files under the package's install path.

Either way, I think the current build instructions are slightly more complicated than they need to be, and having that install/load path mismatch in the result isn't ideal (even if most people won't come up against it since they'll be stopped short by the read-only store).

Setting PREFIX is sufficient to put libraries in $out/lib, whereas
setting VARDIR and then moving files out from under /var breaks egg
installation because the installation path ends up differing from the
library search path.

Remove CHICKEN_REPOSITORY_PATH from PATH as it contains libraries, not
executables, and remove unnecessary trailing slashes on search paths.
@evhan
Copy link
Contributor Author

evhan commented Apr 29, 2019

Rebased, still tests OK. Any issues with this going in?

@evhan
Copy link
Contributor Author

evhan commented Feb 19, 2020

It seems this has been fixed by some other commit in the intervening year.

Closing.

@evhan evhan closed this Feb 19, 2020
@evhan evhan deleted the fix-chicken-5-libdir branch February 19, 2020 21:22
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