NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.52k stars 13.69k forks source link

rPackages.deldir fails to build on Darwin #196940

Closed Aehmlo closed 1 year ago

Aehmlo commented 1 year ago

Steps To Reproduce

  1. Build deldir (nix-shell -p pkgs.rPackages.deldir).

Build log

Tail (full log):

/nix/store/j8w19vhk1yazy96zm22apalqm1jvvlrg-clang-wrapper-11.1.0/bin/cc -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/nix/store/304fs644xapqnaz5wzh805inlfi1gmj2-R-4.2.1/lib/R/lib -L/nix/store/8qr4a99758ck931xj312yzj032jlq8v3-libcxx-11.1.0/lib -o deldir.so acchk.o addpt.o adjchk.o binsrt.o circen.o cross.o crossutil.o delet.o delet1.o delout.o delseg.o dirout.o dirseg.o dldins.o init.o initad.o insrt.o insrt1.o intri.o locn.o master.o mnnd.o pred.o qtest.o qtest1.o stoke.o succ.o swap.o testeq.o triar.o trifnd.o -L/nix/store/60g92jw5cbmsv853ajdfbnip4qp3gnw5-gfortran-11.2.0-lib/lib -L/nix/store/pfglcjndzqjjljq2rj7bzcbawxvha1sv-gfortran-wrapper-11.2.0/bin -L/nix/store/wpxisl5716sn2kipigg19pk6wrgaa21l-gfortran-11.2.0/lib/gcc/aarch64-apple-darwin/11.2.0 -L/nix/store/wpxisl5716sn2kipigg19pk6wrgaa21l-gfortran-11.2.0/lib -lintl -liconv -lgfortran -lm -L/nix/store/304fs644xapqnaz5wzh805inlfi1gmj2-R-4.2.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: library not found for -liconv
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/nix/store/304fs644xapqnaz5wzh805inlfi1gmj2-R-4.2.1/lib/R/share/make/shlib.mk:10: deldir.so] Error 1
ERROR: compilation failed for package ‘deldir’
* removing ‘/nix/store/xl1r02dz8fiw4rc3gz1da9n34czypyl7-r-deldir-1.0-6/library/deldir’

Additional context

I am actually trying to install pkgs.rPackages.interp, of which deldir appears to be a transitive dependency.

Notify maintainers

@jbedo (best guess per git blame)

Metadata

[alex@mor306-4:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.6.0, macOS 12.6`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.0`
 - channels(alex): `""`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
Et7f3 commented 1 year ago

Also reproduce with x86_64-darwin can you update your title

jbedo commented 1 year ago

Darwin requires libiconv as an additional dependency for many packages, but we don't have hydra building the tree on darwin to find them. I also don't have a mac so it's hard for me to work on darwin support. Maybe we could propagate libiconv in the R expression on darwin systems. Any thoughts @collares @bcdarwin?

Et7f3 commented 1 year ago

Can you give command to build all R packages so I can see the list of packages that require it maybe the set is small.

jbedo commented 1 year ago

Easiest way is probably run the hydra jobset defined at pkgs/top-level/release-r.nix with x86_64-darwin set. If you don't have/want a hydra server then you can get a list of derivations to build by using the evaluator out of the hydra package:

hydra-eval-jobs -I . pkgs/top-level/release-r.nix --arg supportedSystems '["x86_64-darwin"]'

This will dump JSON to stdout containing details about each of the packages, including the derivation path. If you pull out the derivation paths (e.g., with jq -r '.[]|.drvPath) you can then build them with nix-build.

Et7f3 commented 1 year ago

Closest package name I found is nix-eval-jobs and it failed:

$ nix-eval-jobs  -I . pkgs/top-level/release-r.nix --arg supportedSystems '["x86_64-darwin"]'
warning: `--gc-roots-dir' not specified
error: value is a set while a Boolean was expected
error: unexpected EOF reading a line
collares commented 1 year ago

hydra-eval-jobs is in the hydra_unstable package.

Et7f3 commented 1 year ago

It is unsupported on Darwin.

collares commented 1 year ago

Not sure it is useful data, but I've attached the output of the suggested command (with --arg supportedSystems '["x86_64-darwin"]') ran on a x86_64-linux machine. Obviously this won't give you the derivations, but maybe the package names are enough? packages.json.txt stderr.log

Et7f3 commented 1 year ago

It require the deriver file 😅I will find a solution, will try to generate a command from name inside builtins.attrNames rPackages. Still it doesn't block the associated PR.

collares commented 1 year ago

The first key in the json file I attached is rPackages.A3.x86_64-darwin, and I can build it by executing nix-build -E 'with (import ./. {}); rPackages.A3' in the root nixpkgs dir. Hopefully a similar procedure works for all relevant packages without having the .drv files.

Et7f3 commented 1 year ago

Oh I haven't though to that way. a simpler invocation can be done with nix-build . -A rPackages.A3 or with flakes nix build .#rPackages.A3

Et7f3 commented 1 year ago
nix-repl> :b pkgs.writeScript "file_r.nix" ("{rPackages, stdenv}: stdenv.mkDerivation { name = ''all''; buildInputs = [\n" + builtins.concatStringsSep " " (builtins.map (e: "rPackages.${e}\n") (builtins.attrNames rPackages)) + "];}")

This derivation produced the following outputs:
  out -> /nix/store/g28idx91b0hmlaz6z6403qh4gqjxr9k6-file_r.nix
[1 built]
$ cp /nix/store/g28idx91b0hmlaz6z6403qh4gqjxr9k6-file_r.nix all_r_packages.nix.txt

all_r_packages.nix.txt I removed rPackages.buildRPackage since it is not a packages.

with the numbers of packages and my disk space I think it won't fit in my disk. Can ofBorg build all those ? if no I will try to do by batch.