Skip to content

Auto-detect botan-3 vs botan-2 for librnp linking on Unix - #338

Open
SchlauFuchs wants to merge 1 commit into
RetroShare:masterfrom
SchlauFuchs:fix/botan3-fallback
Open

Auto-detect botan-3 vs botan-2 for librnp linking on Unix#338
SchlauFuchs wants to merge 1 commit into
RetroShare:masterfrom
SchlauFuchs:fix/botan3-fallback

Conversation

@SchlauFuchs

Copy link
Copy Markdown

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 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 (FindBotan.cmake searches for both, and CRYPTO_BACKEND_BOTAN3 gets 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-2 for all non-Windows platforms in src/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-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 the same file.

Fixes the build failure reported in RetroShare/RetroShare#3190

Test plan

  • Ran qmake for retroshare-service.pro with CONFIG+=rs_rnplib on Ubuntu 24.04 (where only botan-2 is packaged, botan-3 is not): parses cleanly, generated Makefile still links -lbotan-2 — confirms no regression for systems without botan-3
  • Confirmed via pkg-config --exists botan-3/botan-2 on this host that detection logic resolves to the expected fallback branch
  • Not able to verify the botan-3 branch end-to-end (no botan-3 package available on this host) — would appreciate a check from someone on Gentoo/Arch where botan-3 is packaged

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
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