-
Notifications
You must be signed in to change notification settings - Fork 23
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
allow dynamic lookup of symbols on macOS? #110
Comments
Hey! If you have a solution at hand to your problem, let's see it. |
Here's one solution I've been testing: kevinushey@3f022f2 I still need to do some more reading to better understand if this is the right way to approach the problem, since there's a number of questions I don't know the answer to yet:
|
Tricky questions, I, unfortunately, do not have the capacity to answer everything.
The R-Rust interop is an exciting journey, but for us, it is done mostly through trial&error. If you change it & it works (and more importantly, it works as you expect), it is good enough to start the PR process. |
Thanks! I appreciate the quick and thoughtful response. I'll try to investigate a bit more and see if I can put together a PR. |
I spent some more time looking at this, and I think it ultimately becomes a bit too complicated to thread these linker flags through through both libR-sys and the dependencies of libR-sys. (It also becomes a headache once you think about running Instead, I think a workable solution for users who need this is to just post-process the generated executable; e.g. using |
And just to close the thread (for anyone else who stumbled here...) other applications using Rust to embed other libraries recommend using
It's not perfect (since these flags apply to all link invocations) but in practice it's fine. |
I thInk it can be set via |
On macOS, one can use the linker flags
-undefined dynamic_lookup
to basically tell macOS that the application will provide the required symbols at runtime, rather than via explicitly linking with some library at build time.This is mainly relevant for applications which embed R, but want to be able to "load" different versions of R at runtime. Otherwise, the library location will be embedded in the compiled library / application, and one cannot (easily) switch to a different version.
If I understand correctly, libR-sys declares that it will link to libR.dylib here:
libR-sys/build.rs
Lines 491 to 493 in d91909b
Would you consider a PR that relaxes this requirement (perhaps behind a separate feature)?
The text was updated successfully, but these errors were encountered: