Auto-detect botan-3 vs botan-2 for librnp linking on Unix - #338
Open
SchlauFuchs wants to merge 1 commit into
Open
Auto-detect botan-3 vs botan-2 for librnp linking on Unix#338SchlauFuchs wants to merge 1 commit into
SchlauFuchs wants to merge 1 commit into
Conversation
botan-2 reached end of life in 2024 and has since been dropped by some distributions (Gentoo removed it entirely), breaking the build with "-lbotan-2 cant be found" wherever only botan-3 is installed. librnp's own CMake build (supportlibs/librnp) already auto-detects and adapts to whichever botan version is available. The qmake-level linker flag for RetroShare's own binaries did not: it unconditionally hardcoded -lbotan-2 for all non-Windows platforms. Detect via pkg-config which version is actually available, preferring botan-3 and falling back to botan-2, mirroring the existing SQLCIPHER_OK detection pattern already used elsewhere in this file. Verified via qmake on Ubuntu 24.04 (botan-3 not packaged there): behavior is unchanged, generated Makefile still links -lbotan-2 as before. Related: RetroShare/RetroShare#3190
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
botan-2 reached end of life in 2024 and has since been dropped by some distributions (Gentoo removed it entirely), breaking the build with
-lbotan-2 cant be foundwherever only botan-3 is installed.librnp's own CMake build (supportlibs/librnp) already auto-detects and adapts to whichever botan version is available (FindBotan.cmakesearches for both, andCRYPTO_BACKEND_BOTAN3gets set automatically based on the detected version). The qmake-level linker flag for RetroShare's own binaries did not follow suit — it unconditionally hardcoded-lbotan-2for all non-Windows platforms insrc/use_libretroshare.pri, so even when librnp itself built fine against botan-3, the final link step still failed looking for a botan-2 that no longer exists.This detects via
pkg-configwhich version is actually available, preferring botan-3 and falling back to botan-2 — mirroring the existingSQLCIPHER_OKdetection pattern already used elsewhere in the same file.Fixes the build failure reported in RetroShare/RetroShare#3190
Test plan
qmakeforretroshare-service.prowithCONFIG+=rs_rnplibon Ubuntu 24.04 (where only botan-2 is packaged, botan-3 is not): parses cleanly, generatedMakefilestill links-lbotan-2— confirms no regression for systems without botan-3pkg-config --exists botan-3/botan-2on this host that detection logic resolves to the expected fallback branch