Skip to content

Make UHD support optional - #1164

Open
Jaychym wants to merge 1 commit into
TrunkRecorder:masterfrom
Jaychym:freebsd-optional-uhd
Open

Jaychym wants to merge 1 commit into
TrunkRecorder:masterfrom
Jaychym:freebsd-optional-uhd

Conversation

@Jaychym

@Jaychym Jaychym commented Oct 3, 2026 •

Copy link
Copy Markdown

Summary

Make UHD/USRP support optional so Trunk Recorder can be built on systems that provide GNU Radio and gr-osmosdr but do not have GNU Radio UHD or the native UHD library installed.

Previously, GnuradioUHD and LibUHD were discovered as optional dependencies, but their library variables were linked unconditionally by the main executable and built-in plugins. When UHD was unavailable, those variables were set to NOTFOUND, causing the CMake generate step to fail.

Changes

Add TR_HAVE_UHD to indicate whether both GNU Radio UHD and the native UHD library are available.

Add TR_UHD_LIBRARIES and TR_UHD_LIBRARY_DIRS so targets can safely reference UHD dependencies only when UHD support is available.

Guard the GNU Radio UHD header and USRP-specific source code with TR_HAVE_UHD.

Remove the unused UHD include from main.cc.

Update built-in plugins to use the optional UHD library list.

Provide a clear runtime error if a configuration requests the usrp driver from a build compiled without UHD support.

USRP behavior is unchanged when UHD is installed.

Testing

Tested on FreeBSD 15.1-RELEASE amd64 with:

Clang 19.1.7

GNU Radio 3.10.12

gr-osmosdr 0.2.6 with Airspy support

libairspy

Trunk Recorder 5.2.x

Verified:

Clean CMake configure succeeds with GNU Radio UHD and native UHD absent.

Full clean build succeeds, including all built-in plugins.

The resulting trunk-recorder binary links against gr-osmosdr and libairspy without linking UHD.

Configuring a usrp source on a non-UHD build exits with a clear error message.

10 Msps complex IQ file replay works.

P25 Phase II control-channel decoding works.

TDMA voice recording works on both slots.

OP25 voice decode works.

WAV creation, FFmpeg processing, loudness normalization, and M4A generation work successfully.

This change is not FreeBSD-specific. It should also allow non-UHD builds on other platforms where only the other supported SDR/input drivers are needed.

Jaychym

This comment was marked as duplicate.

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