Observation: openssl has a dev output (of course).
I’ve been diffing the NIX_DEBUG = 7 logs, which include traces of the shell script.
The writing of this file is among the last things that happen and frustratingly the pipe target paths aren’t shown in the trace so it is difficult to determine where this is going wrong. The trace shows essentially nothing interesting different between the two:
+++ local 'po_dirty=bin dev out'
+++ set +o pipefail
++++ echo 'bin dev out'
++++ tr -s ' ' '\n'
++++ grep -v -F dev
++++ sort -u
++++ tr '\n' ' '
+++ propagatedBuildOutputs='bin out '
+++ set -o pipefail
+++ '[' -z 'bin out ' ']'
+++ mkdir -p /nix/store/5ll3kccsgh0giw51gqby8135yjba8a1s-openssl-aarch64-unknown-linux-gnu-3.3.2-dev/nix-support
+++ for output in $propagatedBuildOutputs
+++ echo -n ' /nix/store/a5nwxf802jfh0p55cd919scxm69dzlpb-openssl-aarch64-unknown-linux-gnu-3.3.2-bin'
+++ for output in $propagatedBuildOutputs
+++ echo -n ' /nix/store/rbw39g87zd8j4nm93680yin708glxrd0-openssl-aarch64-unknown-linux-gnu-3.3.2'
+++ return 0
I think it’s the second echo here creating the cycle. Perplexingly, it is present in the ‘good’ case as well as the bad case.
That it’s present in the good case can be seen with something as simple as:
nix-build --arg overlays '[(self: super: {
openssl = super.openssl.overrideAttrs { NIX_DEBUG = 7; };
})]' -A openssl '<nixpkgs>'
(I don’t have a public reproducer for the bad case currently)
The key part of the log is right at the end, shortly before fixupPhase completed
is printed.
Edit:
OK, that’s a red herring for openssl. For the original reproducer (shared by @PhilipTaron) we see mkdir -p $out/nix-support
, but for openssl, it’s always $dev/nix-support
(in both good and bad cases).
This is leading me to speculate that in my case there could actually be a cycle being introduced by switching out the compiler somehow. (Even though the compiler I’m interested in, pkgsLLVM.openssl isn’t always creating this situation).
Edit 2:
Argh, finally found it. I had a wrapper which was writing some files out, and one of those files was introducing a reference. It would be great if there was some way to get nix
to tell you where the reference creating the cycle was; it was difficult to find buried inside a nontrivial build.
(edits rather than posts because discourse won’t let me make more replies currently).