Skip to content

Fix Android cross-build with vendored OpenSSL#100

Closed
lucidium wants to merge 1 commit into
Mygod:mainfrom
lucidium:cross-build-fixes
Closed

Fix Android cross-build with vendored OpenSSL#100
lucidium wants to merge 1 commit into
Mygod:mainfrom
lucidium:cross-build-fixes

Conversation

@lucidium
Copy link
Copy Markdown

@lucidium lucidium commented Jun 1, 2026

Summary

This fixes Android cargo-ndk cross-compilation of slipstream-client with vendored OpenSSL enabled.

The changes:

  • forward vendored OPENSSL_CRYPTO_LIBRARY / OPENSSL_SSL_LIBRARY paths to picoquic CMake when available;
  • force static OpenSSL lookup for vendored Android builds;
  • isolate Android builds from host pkg-config paths to avoid accidentally picking up Homebrew/macOS OpenSSL;
  • enable minimal picoquic build mode for Android;
  • replace Bash 4-only lowercase expansion in scripts/build_picoquic.sh with portable tr, so the script works with macOS default Bash 3.2.

Validation

Validated from an Android Gradle/cargo-ndk integration by building slipstream-client successfully for:

  • aarch64-linux-android / arm64-v8a
  • x86_64-linux-android / x86_64
  • armv7-linux-androideabi / armeabi-v7a
  • i686-linux-android / x86

The build keeps OpenSSL enabled for picotls-openssl / certificate pinning support.

Forward vendored OpenSSL library paths to picoquic CMake during Android cargo-ndk builds, isolate Android builds from host pkg-config state, enable minimal picoquic Android builds, and avoid Bash 4-only lowercase expansion in build_picoquic.sh for macOS Bash compatibility.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 872e14735e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +58 to +62
if let Some(crypto) = find_openssl_library(root, "crypto") {
command.env("OPENSSL_CRYPTO_LIBRARY", crypto);
}
if let Some(ssl) = find_openssl_library(root, "ssl") {
command.env("OPENSSL_SSL_LIBRARY", ssl);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve explicit OpenSSL library overrides

When callers set OPENSSL_ROOT_DIR together with explicit OPENSSL_SSL_LIBRARY/OPENSSL_CRYPTO_LIBRARY (which build.rs accepts as a supported override), these new Command.env calls replace the inherited explicit paths before scripts/build_picoquic.sh sees them. In cross-builds where the root is used for headers but the usable target libraries live in a different directory or have a nonstandard name, picoquic will be configured against the first lib{ssl,crypto}.{a,so} under the root instead of the caller-selected libraries, regressing previously working override-based builds.

Useful? React with 👍 / 👎.

@Mygod
Copy link
Copy Markdown
Owner

Mygod commented Jun 1, 2026

@lucidium
Copy link
Copy Markdown
Author

lucidium commented Jun 2, 2026

https://github.com/Mygod/slipstream-plugin-android ?

D'oh! That's exactly what I needed. Thanks. I'll close this PR.

@lucidium lucidium closed this Jun 2, 2026
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

Successfully merging this pull request may close these issues.

2 participants