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

How to include a native library? #151

Closed
TheButlah opened this issue Nov 9, 2023 · 2 comments
Closed

How to include a native library? #151

TheButlah opened this issue Nov 9, 2023 · 2 comments

Comments

@TheButlah
Copy link

TheButlah commented Nov 9, 2023

I'm trying to use xbuild to compile some code to run on an Oculus Quest, which is android. I need to include the libopenxr_loader.so native library, and either dlopen or link against it.

How do I do this with xbuild? I think it should be one of the runtime_libs, but this doesn't seem to do anything if I include it in the manifest.yaml. Is this functionality supported yet in xbuild?

Note: I am using crates.io version 0.2.0

@TheButlah TheButlah changed the title How to include native library? How to include a native library? Nov 9, 2023
@TheButlah
Copy link
Author

TheButlah commented Nov 9, 2023

I think this functionality was added in #106 back in february, but the last release was in December so the 0.2.0 release was too old to support it. I upgraded to the version from git and things are bundled properly now!

@MarijnS95
Copy link
Member

MarijnS95 commented Nov 9, 2023

It is probably even better to link it dynamically instead of at runtime via dlopen(), and have https://github.com/rust-mobile/xbuild/pull/65/files (that is in the 0.2.0 release) pick up the libraries automatically by scanning cargo:rustc-link-search=.

Nowadays the search path from runtime_libs should also be appended to that system, meaning it can both detect needed dynamically linked libraries in there (and include them instead of throwing a "missing dependency" error), as well as make sure that those runtime_libs have their dynamically linked libraries satisfied as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants