Skip to content

Android: use the librnp built for the sysroot instead of rebuilding it inline - #375

Open
jolavillette wants to merge 1 commit into
RetroShare:masterfrom
jolavillette:fix/android-use-prebuilt-rnp
Open

Android: use the librnp built for the sysroot instead of rebuilding it inline#375
jolavillette wants to merge 1 commit into
RetroShare:masterfrom
jolavillette:fix/android-use-prebuilt-rnp

Conversation

@jolavillette

Copy link
Copy Markdown
Contributor

Supersedes #374, which fixed only the first symptom.

prepare-toolchain-clang.sh builds librnp with the openssl backend and installs it in the Android sysroot, but our own configure ignores it and builds librnp a second time, inline: add_subdirectory() is taken whenever ../supportlibs/librnp/CMakeLists.txt exists, i.e. as soon as libretroshare is checked out inside the RetroShare super-project rather than standalone.

That inline build cannot work on Android, for a reason that has nothing to do with the crypto backend: librnp's FindOpenSSLFeatures.cmake compiles findopensslfeatures and runs it to enumerate the OpenSSL features. The binary it just built is an Android executable, which the build host cannot execute. Where binfmt/qemu picks it up — WSL, typically — it gets as far as the ELF interpreter and stops there:

CMake Error at .../supportlibs/librnp/cmake/Modules/FindOpenSSLFeatures.cmake:151 (message):
  Error getting supported OpenSSL hashes: 255

  qemu-aarch64: Could not open '/system/bin/linker64': No such file or directory

Note the path: that is the super-project's pinned librnp submodule, not the copy the toolchain script clones and patches, so none of the script's cross-compilation workarounds apply to it.

This prefers the pre-built library when RS_ANDROID is set, falling back to the previous behaviour when none is installed. Desktop builds are untouched (RS_ANDROID is OFF, the local librnp source is used exactly as today).

Why CI never saw it: the GitLab AAR jobs build from this repository standalone, so ../supportlibs/librnp does not exist and find_library(NAMES rnp) already picked up the sysroot copy. The bug only shows up in a super-project checkout.

Verified by exercising the three paths of the edited block: desktop + librnp submodule present → inline, unchanged; Android + pre-built librnp → pre-built; Android + nothing installed → inline, as before.

Reported on IRC by defnax, building the AAR for rs-mobile under WSL.

…t inline

prepare-toolchain-clang.sh builds librnp and installs it in the Android
sysroot, but our own configure ignores it and builds librnp a second time,
inline, whenever ../supportlibs/librnp exists -- which is the case as soon as
libretroshare is checked out inside the RetroShare super-project instead of
standalone.

That inline build cannot work: librnp's CMake compiles findopensslfeatures
and runs it to enumerate the OpenSSL features, and that binary is an Android
executable the build host cannot execute. Where binfmt/qemu picks it up, as
on WSL, it fails on the missing Android dynamic linker:

  CMake Error at supportlibs/librnp/cmake/Modules/FindOpenSSLFeatures.cmake:151:
    Error getting supported OpenSSL hashes: 255
    qemu-aarch64: Could not open '/system/bin/linker64': No such file or directory

Prefer the pre-built library on Android, falling back to the previous
behaviour when none is installed. Desktop builds are untouched: RS_ANDROID is
OFF there, so the local librnp source is still used exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant