Description
Describe the bug
r-lib/actions/setup-r-dependencies fails to build binary windows packages
snippet from our log when using setup-r-dependencies
to install nloptr
i Building nloptr 1.2.2.3
x Failed to build nloptr 1.2.2.3
Error: Error: <callr_remote_error: Failed to build source package 'nloptr'>
in process 3456
-->
Failed to build source package 'nloptr', stdout + stderr:
OE> * installing *source* package 'nloptr' ...
OE> ** package 'nloptr' successfully unpacked and MD5 sums checked
OE> staged installation is only possible with locking
OE> ** using non-staged installation
OE>
OE> **********************************************
OE> WARNING: this package has a configure script
OE> It probably needs manual configuration
OE> **********************************************
OE>
OE>
OE> ** libs
OE>
OE> *** arch - i386
OE> "C:/rtools40/mingw32/bin/"g++ -std=gnu++11 -I"C:/R/include" -DNDEBUG -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -c dummy.cpp -o dummy.o
OE> "C:/rtools40/mingw32/bin/"gcc -I"C:/R/include" -DNDEBUG -I"/i386/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -c init_nloptr.c -o init_nloptr.o
OE> init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
OE> #include "nlopt.h"
OE> ^~~~~~~~~
OE> compilation terminated.
OE> make: *** [C:/R/etc/i386/Makeconf:238: init_nloptr.o] Error 1
OE> ERROR: compilation failed for package 'nloptr'
OE> * removing 'C:/Users/RUNNER~1/AppData/Local/Temp/Rtmp0MAAsz/pkg-libd80776418f1/nloptr'
Stack trace:
12. (function (...) ...
13. base:::withCallingHandlers(cli_message = function(msg) { ...
14. get("pkg_install_do_plan", asNamespace("pak"))(...)
15. pkgdepends::install_package_plan(plan = plan, lib = lib, num_workers = num_ ...
16. base:::withCallingHandlers({ ...
17. pkgdepends:::handle_events(state, events)
18. pkgdepends:::handle_event(state, i)
19. pkgdepends:::stop_task(state, worker)
20. pkgdepends:::stop_task_build(state, worker)
21. base:::throw(new_pkg_build_error("Failed to build source package {pkg}", ...
22. base:::signalCondition(cond)
23. (function (e) ...
24. base:::stop(e)
25. (function (e) ...
x Failed to build source package 'nloptr'
To Reproduce
https://github.com/insightsengineering/rbmi/runs/4228691735?check_suite_focus=true
This should be open/accessible but please let me know if you don't have access (its an open repo in a private organisation). Essentially our package is dependent on glmmTMB -> lme4 -> nloptr however it looks like the current highest version of nloptr available on cran-windows as a binary. That is for our windows build,r-lib/actions/setup-r-dependencies
tries to install this binary package and fails with the above error. Looking at stackoverflow I found this which suggests that you need to run some additional Rtools commands to ensure the nlopt library is available though I couldn't see any options in the existing action to do this :(
Expected behavior
I would have expected r-lib/actions/setup-r-dependencies
to have installed the nlopt dependency and then installed nloptr without erroring
Additional context
None
Please let me know if you need any more information