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

Working build #4

Merged
merged 2 commits into from
Sep 20, 2021
Merged

Working build #4

merged 2 commits into from
Sep 20, 2021

Conversation

garrison
Copy link
Contributor

This is probably not the final solution, but it at least works!

@garrison garrison mentioned this pull request Sep 20, 2021
Copy link
Owner

@zenhack zenhack left a comment

Choose a reason for hiding this comment

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

Nice!

Maybe @kentonv can comment re: whether there's a better workaround for when /var/tmp isn't available?

cp -r "$capnprotoSrc" deps/capnproto
chmod u+w deps/capnproto/c++/src/kj -R
sed -i 's/\/var\/tmp/\/tmp/g' deps/capnproto/c++/src/kj/filesystem-disk-test.c++
unset NIX_ENFORCE_PURITY
Copy link
Owner

Choose a reason for hiding this comment

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

If this is going to be our solution, I think it could stand a comment explaining what the issues/with links to relevant docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I can link to that previous issue (and perhaps this one), but I really have no deep understanding of what is going on so far. I figured this out by noticing that builder.sh fails under nix-shell but succeeds if the line . "$stdenv/setup" is commented out (#2). So I ran the following script under nix-shell

set > env-pre
. "$stdenv/setup"
set > env-post

... diffed the outputs, and then manually set the environment variables that were different. I bisected them (started by commenting out half of the lines) and after a few such rounds determined that NIX_ENFORCE_PURITY alone is causing the issues. Interestingly, the linked issue is pretty much the first thing that comes up when searching the internet for that identifier. I had found that issue previously, but thought it must have been closed for good reason.

Also, while the current workaround is good enough to get ekam to build, I suspect that ekam is unlikely to be able to build anything else unless the user were to unset NIX_ENFORCE_PURITY before invoking ekam in that build as well.

Copy link
Contributor Author

@garrison garrison Sep 20, 2021

Choose a reason for hiding this comment

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

Hmm, there are a handful of other expressions in nixpkgs that either unset NIX_ENFORCE_PURITY or set it to the empty string. So maybe my solution is an acceptable one after all.

@garrison
Copy link
Contributor Author

garrison commented Sep 20, 2021

I find it curious that the capnproto nix expression does not require the same /var/tmp workaround. I wonder: are the tests even being run there? By nixpkgs defaults, a build that relies on autotools will at least run make check, I think. EDIT: I was wrong; see comment below.

Also, should we really be keeping the bin/capnp* files in the output build directory? Or a more basic question: what is the role of the capnproto binaries once the build is complete? It seems a bit odd to include them here, since there is nothing preventing ekam from appearing before capnproto in the PATH, and thus the binaries provided here could potentially be picked up instead of the binaries actually provided by the capnproto expression.

@garrison
Copy link
Contributor Author

garrison commented Sep 20, 2021

I understand this a little bit better now. The only role of NIX_ENFORCE_PURITY is to filter out paths that do not refer to the NIX_STORE (see here and here). There must be something being filtered out that ekam was expecting.

Here's the complete list of NIX_ENFORCE_PURITY's usage in nixpkgs and nix:

@garrison
Copy link
Contributor Author

whether there's a better workaround for when /var/tmp isn't available

I'm not sure that it matters much, since this is only used for tests. We could, perhaps, have the tests write somewhere in the build directory tree, but I'm not sure this helps anything, as the whole build tree is (I believe) a chroot in /tmp.

@zenhack zenhack merged commit 0b732c2 into zenhack:master Sep 20, 2021
@garrison garrison deleted the working-build branch September 20, 2021 18:50
@garrison
Copy link
Contributor Author

By nixpkgs defaults, a build that relies on autotools will at least run make check, I think

I was wrong: it only happens if doCheck is set to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants