Skip to content

monero, monero-gui: fix build against current protobuf - #32

Open
vxfemboy wants to merge 3 commits into
mainfrom
monero-protobuf-fix
Open

vxfemboy wants to merge 3 commits into
mainfrom
monero-protobuf-fix

Conversation

@vxfemboy

Copy link
Copy Markdown
Member

Both packages fail to build against current protobuf (35.1) with:

error: no matching function for call to 'hw::trezor::MessageMapper::get_message_wire_number(absl::string_view)'

Root cause

cmake/CheckTrezor.cmake gates monero's own absl::string_view overload of get_message_wire_number() — which exists precisely to handle protobuf's Descriptor::name() now returning absl::string_view — behind Protobuf_VERSION VERSION_GREATER_EQUAL 22.0.

Protobuf_VERSION, as CMake's bundled FindProtobuf.cmake parses it from protoc --version, now reports a decoupled generator-version axis (libprotoc 7.35.1) distinct from the library release version (35.1). So Protobuf_VERSION becomes 7.35.1, and 7 < 22 silently fails the check — even though this protobuf's Descriptor::name() unconditionally returns absl::string_view.

Fix

Replace the version-number comparison with a check_cxx_source_compiles probe of the actual API surface, so detection stays correct regardless of how protobuf numbers future releases.

monero-gui vendors its own internal copy of the monero core (post_extract()), including the same cmake/CheckTrezor.cmake — same root cause, same fix, applied to the vendored path.

Verification

  • Traced the exact root cause: extracted the failing build's CMakeCache.txt, confirmed Protobuf_VERSION resolved to 7.35.1 (FIND_PACKAGE_MESSAGE_DETAILS_Protobuf:INTERNAL=[...][v7.35.1()]), confirmed via check_cxx_source_compiles in /usr/share/cmake-4.2/Modules/FindProtobuf.cmake that this is exactly how the module derives the version.
  • Live-tested the patch inside the xbps-src chroot before writing the final patch file: all 3 previously-failing objects (messages_map.cpp.o, device_trezor_base.cpp.o, device_trezor.cpp.o) compile clean.
  • Full clean ./xbps-src pkg monero and ./xbps-src pkg monero-gui builds succeed end-to-end.
  • Installed both on a real host alongside the libprotobuf upgrade (35.1) that was previously blocked — xbps refused to touch libprotobuf while the installed monero/monero-gui still required libprotobuf.so.25.2.0. Confirmed both binaries now link against libprotobuf.so.35.1.0 and run correctly (monerod --version, monero-wallet-gui linkage).

Test plan

  • monero: full clean build succeeds
  • monero-gui: full clean build succeeds
  • Both install cleanly alongside libprotobuf-35.1_1 on a real system
  • ldd confirms both link against libprotobuf.so.35.1.0
  • monerod --version runs correctly

cmake/CheckTrezor.cmake gated the absl::string_view overload of
get_message_wire_number() behind a Protobuf_VERSION VERSION_GREATER_EQUAL
22.0 check. Protobuf_VERSION (as CMake's FindProtobuf.cmake parses it from
`protoc --version`) now reports a decoupled generator-version axis
("libprotoc 7.35.1") rather than the library release version ("35.1"),
so the check silently failed against protobuf-35.1 even though this
protobuf's Descriptor::name() unconditionally returns absl::string_view.
Every device_trezor call site passing a .name() result to
get_message_wire_number() then failed with "no matching function".

Patch replaces the version-number comparison with a compile-time probe of
the actual API surface, so detection stays correct regardless of how
protobuf numbers future releases.

Verified: extracted the failing build's compiler invocations, confirmed
Protobuf_VERSION resolved to 7.35.1 in CMakeCache.txt, live-tested the
patched CheckTrezor.cmake inside the xbps-src chroot (all 3 previously
failing objects compile clean), then a full clean ./xbps-src pkg monero
build succeeds end-to-end.
monero-gui vendors its own internal copy of the monero core (see
post_extract() in the template), including the same cmake/CheckTrezor.cmake
affected by the protobuf abseil-detection bug fixed in monero
(commit 32fcd13) -- same root cause, same fix, applied to the vendored
copy's path (monero/cmake/CheckTrezor.cmake).

Verified with a full clean ./xbps-src pkg monero-gui build, then confirmed
on the real host: reinstalled both monero and monero-gui against the
upgraded libprotobuf-35.1_1 (previously blocked -- xbps refused to upgrade
libprotobuf while installed monero/monero-gui still required
libprotobuf.so.25.2.0), verified both binaries link against
libprotobuf.so.35.1.0 and run correctly.
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