Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The nloptr package fails to cross-compile on macOS #31

Open
bbolker opened this issue Apr 2, 2024 · 1 comment
Open

The nloptr package fails to cross-compile on macOS #31

bbolker opened this issue Apr 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bbolker
Copy link

bbolker commented Apr 2, 2024

I see that the nloptr package isn't available for webR. It's required for lme4, so if there's anything I can do to help troubleshoot let me know. (nloptr does generally require cmake to build ...)

It would be possible to create a version of lme4 where nloptr was optional, but it would be tedious and wouldn't perform as well without nloptr ...

@georgestagg
Copy link
Member

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:

Screenshot 2024-04-03 at 10 23 33


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.

@georgestagg georgestagg changed the title what's blocking nloptr? The nloptr package fails to cross-compile on macOS Apr 8, 2024
@georgestagg georgestagg transferred this issue from r-wasm/webr Apr 8, 2024
@georgestagg georgestagg added bug Something isn't working and removed package request labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants