Nix shell environment to debug a build of an R package

I am trying to investigate rPackages.rJava does not build with Azul JDK · Issue #109419 · NixOS/nixpkgs · GitHub. It looks like the configure script is failing and config.log file can provide some hints. How do I create a nix-shell sandbox where config.log is not removed?

2 Likes

Maybe --keep-failed?

@rmcgibbo Yes, thank you! It looks like something is wrong with the Azul JDK. Running

$ nix-shell --pure -p rPackages.rJava --keep-failed

did allow me to examine that config.log file where I found that there is a missing header file in the directory:

In file included from conftest.c:30:                                                                                                                                             
/nix/store/3xlg2rn1mkpypxd2xvz26xrlgfrbrmnr-zulu-8.48.0.53/include/jni.h:45:10: fatal error: jni_md.h: No such file or directory                                                 
   45 | #include "jni_md.h"                                                                                                                                                      
      |          ^~~~~~~~~~                                                                                                                                                      
compilation terminated.     

Comparing the Azul JDK to Open JDK it is clear that the file is in include\linux subdirectory but while OpenJDK symlinks it back to include, Azul JDK doesn’t - and there is an issue for that (Align JDK packages · Issue #106716 · NixOS/nixpkgs · GitHub). Too bad the issue is still unresolved :frowning:

1 Like

you can also do nix-shell default.nix -A rPackages.rJava
which will drop you into the shell used to conduct the build. You can then do unpackSource and the other phases locally. Really useful when doing a new package and might hit many hiccups.

I have an example using this in https://www.youtube.com/watch?v=sO57VV4Ho5s

2 Likes