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

use new crate-type flag to build cdylib for android #64

Open
dvc94ch opened this issue Apr 21, 2022 · 4 comments
Open

use new crate-type flag to build cdylib for android #64

dvc94ch opened this issue Apr 21, 2022 · 4 comments
Labels
C-bug Something isn't working

Comments

@dvc94ch
Copy link
Contributor

dvc94ch commented Apr 21, 2022

currently it causes cdylibs to be included on all platforms when it's set in Cargo.toml.

@dvc94ch dvc94ch added the C-bug Something isn't working label Apr 21, 2022
@MarijnS95
Copy link
Member

@dvc94ch Do you think this is something we can insert manually? It can be passed as a flag to rustc which perhaps relieves some of the overhead of setting this in Cargo.toml manually.

I've also been wanting to figure this out (or find a workaround) for binaries so that you don't need to jump through hoops to make bin targets compatible on at least Android, and because a crate can have multiple bins but only a single lib.

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Apr 25, 2022

Yes. If it's a cdylib on all platforms, set it in Cargo.toml, on android add the crate-type cdylib

@MarijnS95
Copy link
Member

@dvc94ch I ended up trying this out on cargo-apk and it seems to work, shall I port it to xbuild as well?

rust-mobile/cargo-apk#28

@MarijnS95
Copy link
Member

Hmm, given the design of xbuild it seems to first call cargo build (which we'd have to replace by cargo rustc --crate-type ...), followed by platform-specific logic figuring out what would have been built, in order to collect the paths.

It supports a comma-separated list at least, so we'd have to list the build-requirements up-front...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants