Closed LnL7 closed 3 years ago
These changes are enough to work around this and link against a tbd libSystem in the first bootstrap stages, however using fetchurl for github archives is not stable so we'll need a separate release archive for this.
https://gist.github.com/LnL7/a17a042dd21258b957279637bb6be627
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/is-there-a-plan-that-nix-can-bootstrap-itself-on-macos-big-sur/10043/2
There's another issue in stage2 with Security/boot.nix
which gets referenced by configd.
There's another issue in stage2 with
Security/boot.nix
which gets referenced by configd.
For what it's worth, those referenced files do exist on Big Sur. Still not good for purity though.
As I misread what it was symlinking.
@LnL7 on a clean install of Big Sur 11.0.1 on x86_64 I installed nix, cloned nixpkgs master, applied your patch and used it to try and build ICU using -I nixpkgs=/path/to/patched/nixpkgs
but I'm still running into this issue. Is that expected?
These changes are enough to work around this and link against a tbd libSystem in the first bootstrap stages, however using fetchurl for github archives is not stable so we'll need a separate release archive for this.
We've added an archive for tagged releases via github actions (https://github.com/NixOS/darwin-stubs/pull/4). We should add any missing libraries and tag a release to make the tarball available.
can anyone please elaborate on how to workaround this? i tried the same thing @edude03 described and it didn't work for me too i also tried switching to staging/unstable channels and that didn't work either is there a workaround except downgrading to catalina for now?
@edude03 @KolesnichenkoDS Unless you're building staging or another mass rebuild this issue won't be relevant to your problem.
@LnL7: I am using nix-shell for my Python projects, pinned to latest nixos-20.09 and master of https://github.com/nix-community/poetry2nix. I am definitely affected by this because some Python packages come with C extensions that need to be compiled. Most of the time nix-shell building fails on my Big Sur and I have to wait for our CI (still on Catalina) to build and upload derivations to cache.
That error has nothing to do with the issue described here, firstly none of the initial compatibility changes have been backported to 20.09. Secondly if it doesn't work on master either there's a good chance this is something something specific to upstream python or the python infrastructure. In that case please report it in a separate issue.
Is there a workaround for those looking to build staging on Big Sur specifically for flake support?
Or is it more worth it to just downgrade or copy the cache over for now?
Running into ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
here, is this the same issue?
@jerbaroo No, that's not an stdenv build.
Hey @LnL7, I've prepared a minimal shell.nix
with a Poetry-based Python environment that showcases the problem I have: https://github.com/niteoweb/big-sur-poetry-test
Running nix-shell
in this test repo:
configure: error: C compiler cannot create executables
Should I move this to a new issue? If yes, to which repo, https://github.com/nixOS/nixpkgs, https://github.com/LnL7/nix-darwin or https://github.com/nix-community/poetry2nix?
Finally, thank you for all your hard work keeping Nix running on Macs!
Update: actually, let me test against master first Update2: works with nixpkgs set to https://github.com/NixOS/nixpkgs/commit/e9158eca70ae59e73fae23be5d13d3fa0cfc78b4, sorry for the noise! (actually while I have your attention, how can I help getting the fixes backported to 20.09?
@zupo Opening a PR to the release-20.09
branch with the commit(s) you'd like backported cherry-picked (with -x
) is the way to go. See also https://nixos.org/manual/nixpkgs/stable/#submitting-changes-stable-release-branches.
Is this now resolved by the merge of #107013?
I tried pinning https://github.com/niteoweb/big-sur-poetry-test to latest nixos-20.09 commit (41dddb1283733c4993cb6be9573d5cef937c1375
), but got the same error as always. How can I try staging? I don't see any staging channel on https://status.nixos.org/?
@zupo https://github.com/NixOS/nixpkgs/pull/107013 was merged into staging but I don't think (I'm not sure if) it was merged into 20.09 - so to confirm I'd try using the latest commit from staging.
Maybe related: https://github.com/NixOS/nixpkgs/pull/104150#pullrequestreview-579892668.
nix-build -I nixpkgs=. -A pkgs.pypy
on staging
fails with Cannot find C library, ctypes.util.find_library('c') returned None
.
It also shows following errors:
[platform:WARNING] ld: warning: directory not found for option '-L/nix/store/0gm1wsc6q4sii8py1kf83isx8aaq03mj-xlibs-wrapper/lib'
[platform:WARNING] ld: warning: directory not found for option '-L/nix/store/pslgzws8yag8fp0srcfk83ky1zxf62mz-apple-framework-Security/lib'
I just ran into something similar so I thought I'd comment:
Apple removed the /usr/lib/libc.dylib from disk on macOS Big Sur and only has it available in the linker cache now. The API calls still work, but things that actually look for the file do not.
This was the patch that fixed it for Python: https://bugs.python.org/issue41100 Any chance that is related?
Is this now resolved by the merge of #107013?
I believe it is. I'll tentatively close this issue since the exact bug that it represents has been fixed. I don't mean to cut off the conversation, and if there are still bootstrapping problems on Big Sur with master
/ nixpkgs-unstable
feel free to reopen.
For the python ctypes issue, there's a ticket for tracking that at https://github.com/NixOS/nixpkgs/issues/105038
@thefloweringash @LnL7 I see this was closed as fixed, but I'm still seeing issues (on a fresh Big Sur 11.4 install) with ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
Am I missing some work-around?
% nix-shell --run "niv update"
...
building '/nix/store/nh146kfyhf0lra9nry12z2n44m59zszg-niv-0.2.18.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/s6mfg7bn91sh22pkqsqj2246wrl52v4b-ghc-8.8.4.
unpacking sources
unpacking source archive /nix/store/gayb02fj8nss712krr1j798ynxxxldvc-niv-0.2.18.tar.gz
source root is niv-0.2.18
setting SOURCE_DATE_EPOCH to timestamp 1600342311 of file niv-0.2.18/src/Niv/Update/Test.hs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/private/tmp/nix-build-niv-0.2.18.drv-0/setup-package.conf.d -j16 -threaded -rtsopts
[1 of 1] Compiling Main ( Setup.hs, /private/tmp/nix-build-niv-0.2.18.drv-0/Main.o )
Linking Setup ...
ld: warning: passed two min versions (10.12.0, 10.12) for platform macOS. Using 10.12.
ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/nh146kfyhf0lra9nry12z2n44m59zszg-niv-0.2.18.drv' failed with exit code 1
error: build of '/nix/store/nh146kfyhf0lra9nry12z2n44m59zszg-niv-0.2.18.drv' failed
nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.01 MiB download, 0.03 MiB unpacked):
/nix/store/xycwyp06s3hjafaiplh1f87jsn36mwps-nix-info
/nix/store/yca7h9lyacs16sk44jsw987jhrdqsdmr-DarwinTools-1
copying path '/nix/store/yca7h9lyacs16sk44jsw987jhrdqsdmr-DarwinTools-1' from 'https://cache.nixos.org'...
copying path '/nix/store/xycwyp06s3hjafaiplh1f87jsn36mwps-nix-info' from 'https://cache.nixos.org'...
- system: `"x86_64-darwin"`
- host os: `Darwin 20.5.0, macOS 10.16`
- multi-user?: `no`
- sandbox: `no`
- version: `nix-env (Nix) 2.3.12`
- channels(ldeck): `"nixpkgs-21.11pre300283.f930ea227ce"`
- nixpkgs: `/Users/ldeck/.nix-defexpr/channels/nixpkgs`
Niv is likely pinning an older version of nixpkgs without this issue fixed
Get Outlook for iOShttps://aka.ms/o0ukef
From: ldeck @.> Sent: Tuesday, July 6, 2021 1:06:38 PM To: NixOS/nixpkgs @.> Cc: Michael Francis @.>; Mention @.> Subject: Re: [NixOS/nixpkgs] darwin stdenv can't bootstrap on macOS 11.0 Big Sur (#104580)
@thefloweringashhttps://github.com/thefloweringash @LnL7https://github.com/LnL7 I see this was closed as fixed, but I'm still seeing issues (on a fresh Big Sur 11.4 install) with ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
Am I missing some work-around?
% nix-shell --run "niv update"
...
building '/nix/store/nh146kfyhf0lra9nry12z2n44m59zszg-niv-0.2.18.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/s6mfg7bn91sh22pkqsqj2246wrl52v4b-ghc-8.8.4.
unpacking sources
unpacking source archive /nix/store/gayb02fj8nss712krr1j798ynxxxldvc-niv-0.2.18.tar.gz
source root is niv-0.2.18
setting SOURCE_DATE_EPOCH to timestamp 1600342311 of file niv-0.2.18/src/Niv/Update/Test.hs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/private/tmp/nix-build-niv-0.2.18.drv-0/setup-package.conf.d -j16 -threaded -rtsopts
[1 of 1] Compiling Main ( Setup.hs, /private/tmp/nix-build-niv-0.2.18.drv-0/Main.o )
Linking Setup ...
ld: warning: passed two min versions (10.12.0, 10.12) for platform macOS. Using 10.12.
ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
cc' failed in phase
Linker'. (Exit code: 1)
builder for '/nix/store/nh146kfyhf0lra9nry12z2n44m59zszg-niv-0.2.18.drv' failed with exit code 1
error: build of '/nix/store/nh146kfyhf0lra9nry12z2n44m59zszg-niv-0.2.18.drv' failed
nix-shell -p nix-info --run "nix-info -m" these paths will be fetched (0.01 MiB download, 0.03 MiB unpacked): /nix/store/xycwyp06s3hjafaiplh1f87jsn36mwps-nix-info /nix/store/yca7h9lyacs16sk44jsw987jhrdqsdmr-DarwinTools-1 copying path '/nix/store/yca7h9lyacs16sk44jsw987jhrdqsdmr-DarwinTools-1' from 'https://cache.nixos.org'... copying path '/nix/store/xycwyp06s3hjafaiplh1f87jsn36mwps-nix-info' from 'https://cache.nixos.org'...
"x86_64-darwin"
Darwin 20.5.0, macOS 10.16
no
no
nix-env (Nix) 2.3.12
"nixpkgs-21.11pre300283.f930ea227ce"
/Users/ldeck/.nix-defexpr/channels/nixpkgs
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NixOS/nixpkgs/issues/104580#issuecomment-874933639, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADYXE5VOHZ65DRLYQRYIY3TWMZZ5ANCNFSM4T6L6LRA.
Initial support for builds on Big Sur was added in https://github.com/NixOS/nixpkgs/pull/98541 but the initial bootstrapping stages in the stdenv still link against the libSystem library that's part of bootstrap tools. This means builds depend on having a cached stdenv built by 11.15 or earlier available.
To Reproduce
On macOS 11.0 run