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

Need documentation on cross-compiling for Android #57

Open
Tracked by #60
jrobsonchase opened this issue Aug 16, 2024 · 0 comments
Open
Tracked by #60

Need documentation on cross-compiling for Android #57

jrobsonchase opened this issue Aug 16, 2024 · 0 comments
Labels
android documentation Improvements or additions to documentation

Comments

@jrobsonchase
Copy link
Collaborator

jrobsonchase commented Aug 16, 2024

I almost got this working, but not quite.

I created a branch that sets the proper cargo environment variables to point at the android compiler/linker via the flake: cross-android. With these set, it should be possible to either cargo build --target aarch64-linux-android --release in ngrok-java-native or mvn --global-toolchains toolchains.xml --batch-mode --projects ngrok-java-native --also-make package --activate-profiles ci-native --define 'ngrok.native.classifier=linux-android-aarch_64' --define 'ngrok.native.target=aarch64-linux-android' --define 'skipTests' from the root, but both of them give me the same dump of link errors: Whoops, I was using the uppercased target triple for the CC_ and AR_ variables. Now it works!

One can either do:

  • mvn --global-toolchains toolchains.xml package --activate-profiles ci-native --define 'ngrok.native.classifier=linux-android-aarch_64' --define 'ngrok.native.target=aarch64-linux-android' --define 'skipTests' from the top-level
  • mvn --global-toolchains toolchains.xml compile from the top-level, followed by cargo build --target aarch64-linux-android --release from ngrok-java-native

Neither of which are terribly ergonomic. The latter is probably the easiest and most direct way to get just the .so to build, since loading it from the jar seems broken anyway (#50).

@jrobsonchase jrobsonchase mentioned this issue Aug 20, 2024
5 tasks
@russorat russorat added the documentation Improvements or additions to documentation label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants