-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
darwin: go: cycle detected in the references of ... (a private go package) #18131
Comments
@mstone: so you think some of the general frameworks is causing this on Darwin and should be improved? |
I was also struggling with this problem, and after very carefully reading and understanding what @mstone is saying was able to apply this issue to a package I'm building too. Example package using this fix: { pkgs ? import <nixpkgs> {} }:
let
inherit (pkgs) buildGoPackage fetchFromGitHub darwin fixDarwinDylibNames;
in
buildGoPackage rec {
name = "sudolikeaboss-${version}";
version = "0.2.1";
goPackagePath = "github.com/ravenac95/sudolikeaboss";
src = fetchFromGitHub {
owner = "ravenac95";
repo = "sudolikeaboss";
rev = "v${version}";
sha256 = "1zsmy67d334nax76sq0g2sczp4zi19d94d3xfwgadzk7sxvw1z0m";
};
propagatedBuildInputs = with darwin.apple_sdk.frameworks; [
Cocoa
fixDarwinDylibNames
];
postInstall = ''
install_name_tool -delete_rpath $out/lib -add_rpath $bin $bin/bin/sudolikeaboss
'';
goDeps = ./deps.nix;
} Thank you so much, @mstone, for so thoroughly documenting how you debugged the issue and solved the problem. |
Hi y'all I ran into this with a private package too. It feels like |
I just ran into this on #25103 |
This fixes the "cycle detected in the references of" error when building on darwin. The fix is based on the solution in issue NixOS#18131.
This fixes the "cycle detected in the references of" error when building on darwin. The fix is based on the solution in issue NixOS#18131.
* First attempt at making elvish compile on darwin * Fixed cyclic dependency on darwin This fixes the "cycle detected in the references of" error when building on darwin. The fix is based on the solution in issue #18131. * Use version 0.10 and not 0.10.1, which is not officially released yet
* First attempt at making elvish compile on darwin * Fixed cyclic dependency on darwin This fixes the "cycle detected in the references of" error when building on darwin. The fix is based on the solution in issue #18131. * Use version 0.10 and not 0.10.1, which is not officially released yet (cherry picked from commit 8b8a2fd)
Fixes the cyclic dependency issue as described in #18131.
I have done a little research. The I'm using another solution by adding |
Overview
I was just bit by the same issue as #10599 while building a private go package on Darwin and as a result, I'd like to document my debugging efforts so that others who encounter similar problems may find my workaround between now and whenever we decide how to fix the issue for real.
Issue description
The symptom of the issue was that while running
nix-build -K -I nixpkgs=~/nixpkgs -j2 --cores 2 shell.nix
with a recent checkout of nixpkgs (5120af0) on a nix-expression usingbuildGoPackage
to define a multiple-output derivation, I got a cyclic reference error like this one:The fix, as in #10599, is to use
install_name_tool
to repoint the offendingLC_RPATH
tag.Diagnosis
To diagnose the cause(s) of the problem, I rebuilt nix-1.11.3 with a custom backport of NixOS/nix@c87a56f (temporarily published at mstone/nix@a715d9e) which gave me the following clue:
Using this clue, I
cd
'ed to the build directory I kept withnix-build -K
and greppedenv-vars
for the values ofout=
andbin=
and then, using the$bin
directory, I rangrep -r baswj95p801zlfhjxarran4xdyjgz4g8 /nix/store/43wwl5kgh0z9yd92ydc7jahy1yjipmwk-go1.6-whist-20160816-ca1fec0-bin
to find out which files contained cyclic references, which produced one output:Next, to find out why this file contained a cyclic reference, I fiddled with
otool
until I ranotool -l /nix/store/43wwl5kgh0z9yd92ydc7jahy1yjipmwk-go1.6-whist-20160816-ca1fec0-bin/bin/.whist-wrapped | grep -C 5 baswj95p801zlfhjxarran4xdyjgz4g8
which indicated that the problem was an inappropriateLC_RPATH
setting:just as in #10599.
Finally, to fix the problem locally, I applied the fixes proposed in 86dae70 and 4e1fdad to my own nix expression and, thankfully, they worked just fine for me once I adapted them to repoint LC_RPATH from
$lib
to$bin
(sincebuildGoPackage
produces derivations with outputs namedout
andbin
, but notlib
)./cc @pikajude @vcunat @ttuegel
The text was updated successfully, but these errors were encountered: