Open bbolker opened 7 months ago
The nloptr
package failed to build for WebAssembly during my last set of R package upgrades. Checking logs, a problem happened during the cmake
build of libnlopt.a
. It looks like the Emscripten compiler does not like one of the flags passed to it during the linking step:
wasm-ld: error: unknown argument: -headerpad_max_install_names
Investigating this more just now, it looks like this might be due to the fact that I'm cross-compiling packages for Wasm from my macOS machine. This might actually work better in Linux. Let me spin up a webR development Docker container and try there...
Nice, the build is indeed successful under Linux! I'll upload the package to the webR binary repository now.
It seems to work:
It would be good to fix the -headerpad_max_install_names
issue when cross-compiling from macOS to WebAssembly, but I'm not entirely sure how that could be done. It would probably require some tweaking to how the nlopt
library's cmake
scripts are invoked during the R package build, with a workaround that kicks in only when the host machine is Darwin
, and the target machine is Emscripten
.
Perhaps it does not matter so much, most people building Wasm packages will be doing so from inside the reproducible Linux environment provided by the webR development Docker container in any case.
I see that the
nloptr
package isn't available for webR. It's required forlme4
, so if there's anything I can do to help troubleshoot let me know. (nloptr
does generally requirecmake
to build ...)It would be possible to create a version of
lme4
wherenloptr
was optional, but it would be tedious and wouldn't perform as well withoutnloptr
...