~/dev/hackrf$ mkdir host/build
~/dev/hackrf$ cd host/build
~/dev/hackrf/host/build$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Deprecation Warning at libhackrf/CMakeLists.txt:24 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libusb-1.0'
-- Found libusb-1.0, version 1.0.25
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (LIBUSB)
does not match the name of the calling package (USB1). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake/modules/FindUSB1.cmake:39 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
libhackrf/CMakeLists.txt:48 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found LIBUSB: /usr/lib/x86_64-linux-gnu/libusb-1.0.so
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Setting udev rule group to - plugdev
-- HackRF udev rules will be installed to '/etc/udev/rules.d' upon running 'make install'
CMake Deprecation Warning at hackrf-tools/CMakeLists.txt:24 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Found FFTW: /usr/lib/x86_64-linux-gnu/libfftw3f.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/{user}/dev/hackrf/host/build
make
~/dev/hackrf/host/build$ make
[ 5%] Building C object libhackrf/src/CMakeFiles/hackrf.dir/hackrf.c.o
[ 10%] Linking C shared library libhackrf.so
[ 10%] Built target hackrf
[ 15%] Building C object libhackrf/src/CMakeFiles/hackrf-static.dir/hackrf.c.o
[ 20%] Linking C static library libhackrf.a
[ 20%] Built target hackrf-static
[ 25%] Building C object hackrf-tools/src/CMakeFiles/hackrf_transfer.dir/hackrf_transfer.c.o
[ 30%] Linking C executable hackrf_transfer
[ 30%] Built target hackrf_transfer
[ 35%] Building C object hackrf-tools/src/CMakeFiles/hackrf_spiflash.dir/hackrf_spiflash.c.o
[ 40%] Linking C executable hackrf_spiflash
[ 40%] Built target hackrf_spiflash
[ 45%] Building C object hackrf-tools/src/CMakeFiles/hackrf_cpldjtag.dir/hackrf_cpldjtag.c.o
[ 50%] Linking C executable hackrf_cpldjtag
[ 50%] Built target hackrf_cpldjtag
[ 55%] Building C object hackrf-tools/src/CMakeFiles/hackrf_info.dir/hackrf_info.c.o
[ 60%] Linking C executable hackrf_info
[ 60%] Built target hackrf_info
[ 65%] Building C object hackrf-tools/src/CMakeFiles/hackrf_debug.dir/hackrf_debug.c.o
[ 70%] Linking C executable hackrf_debug
[ 70%] Built target hackrf_debug
[ 75%] Building C object hackrf-tools/src/CMakeFiles/hackrf_clock.dir/hackrf_clock.c.o
[ 80%] Linking C executable hackrf_clock
[ 80%] Built target hackrf_clock
[ 85%] Building C object hackrf-tools/src/CMakeFiles/hackrf_sweep.dir/hackrf_sweep.c.o
[ 90%] Linking C executable hackrf_sweep
[ 90%] Built target hackrf_sweep
[ 95%] Building C object hackrf-tools/src/CMakeFiles/hackrf_operacake.dir/hackrf_operacake.c.o
[100%] Linking C executable hackrf_operacake
[100%] Built target hackrf_operacake
sudo make install
~/dev/hackrf/host/build$ sudo make install
Consolidate compiler generated dependencies of target hackrf
[ 10%] Built target hackrf
Consolidate compiler generated dependencies of target hackrf-static
[ 20%] Built target hackrf-static
Consolidate compiler generated dependencies of target hackrf_transfer
[ 30%] Built target hackrf_transfer
Consolidate compiler generated dependencies of target hackrf_spiflash
[ 40%] Built target hackrf_spiflash
Consolidate compiler generated dependencies of target hackrf_cpldjtag
[ 50%] Built target hackrf_cpldjtag
Consolidate compiler generated dependencies of target hackrf_info
[ 60%] Built target hackrf_info
Consolidate compiler generated dependencies of target hackrf_debug
[ 70%] Built target hackrf_debug
Consolidate compiler generated dependencies of target hackrf_clock
[ 80%] Built target hackrf_clock
Consolidate compiler generated dependencies of target hackrf_sweep
[ 90%] Built target hackrf_sweep
Consolidate compiler generated dependencies of target hackrf_operacake
[100%] Built target hackrf_operacake
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pkgconfig/libhackrf.pc
-- Installing: /etc/udev/rules.d/53-hackrf.rules
-- Installing: /usr/local/lib/libhackrf.so.0.8.0
-- Installing: /usr/local/lib/libhackrf.so.0
-- Installing: /usr/local/lib/libhackrf.so
-- Installing: /usr/local/lib/libhackrf.a
-- Installing: /usr/local/include/libhackrf/hackrf.h
-- Installing: /usr/local/bin/hackrf_transfer
-- Set runtime path of "/usr/local/bin/hackrf_transfer" to ""
-- Installing: /usr/local/bin/hackrf_spiflash
-- Set runtime path of "/usr/local/bin/hackrf_spiflash" to ""
-- Installing: /usr/local/bin/hackrf_cpldjtag
-- Set runtime path of "/usr/local/bin/hackrf_cpldjtag" to ""
-- Installing: /usr/local/bin/hackrf_info
-- Set runtime path of "/usr/local/bin/hackrf_info" to ""
-- Installing: /usr/local/bin/hackrf_debug
-- Set runtime path of "/usr/local/bin/hackrf_debug" to ""
-- Installing: /usr/local/bin/hackrf_clock
-- Set runtime path of "/usr/local/bin/hackrf_clock" to ""
-- Installing: /usr/local/bin/hackrf_sweep
-- Set runtime path of "/usr/local/bin/hackrf_sweep" to ""
-- Installing: /usr/local/bin/hackrf_operacake
-- Set runtime path of "/usr/local/bin/hackrf_operacake" to ""
sudo ldconfig
~/dev/hackrf/host/build$ sudo ldconfig
/sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
By default this will attempt to install an udev rule to /etc/udev/rules.d
to provide the the usb or plugdev group access to HackRF.
If your setup requires the udev rule to be installed elsewhere
you can modify the path with -DUDEV_RULES_PATH=/path/to/udev.
Note: The udev rule is not installed by default for PyBOMBS installs as they do not usually get installed with root privileges.
Clean CMake temporary files/dirs:
$ cd host/build
$ rm -rf *
hackrf_transfer
~/dev/hackrf$ hackrf_transfer -h
Usage:
-h # this help
[-d serial_number] # Serial number of desired HackRF.
-r <filename> # Receive data into file (use '-' for stdout).
-t <filename> # Transmit data from file (use '-' for stdin).
-w # Receive data into file with WAV header and automatic name.
# This is for SDR# compatibility and may not work with other software.
[-f freq_hz] # Frequency in Hz [1MHz to 6000MHz supported, 0MHz to 7250MHz forceable].
[-i if_freq_hz] # Intermediate Frequency (IF) in Hz [2170MHz to 2740MHz supported, 2000MHz to 3000MHz forceable].
[-o lo_freq_hz] # Front-end Local Oscillator (LO) frequency in Hz [84MHz to 5400MHz].
[-m image_reject] # Image rejection filter selection, 0=bypass, 1=low pass, 2=high pass.
[-a amp_enable] # RX/TX RF amplifier 1=Enable, 0=Disable.
[-p antenna_enable] # Antenna port power, 1=Enable, 0=Disable.
[-l gain_db] # RX LNA (IF) gain, 0-40dB, 8dB steps
[-g gain_db] # RX VGA (baseband) gain, 0-62dB, 2dB steps
[-x gain_db] # TX VGA (IF) gain, 0-47dB, 1dB steps
[-s sample_rate_hz] # Sample rate in Hz (2-20MHz supported, default 10MHz).
[-F force] # Force use of parameters outside supported ranges.
[-n num_samples] # Number of samples to transfer (default is unlimited).
[-S buf_size] # Enable receive streaming with buffer size buf_size.
[-B] # Print buffer statistics during transfer
[-c amplitude] # CW signal source mode, amplitude 0-127 (DC value to DAC).
[-R] # Repeat TX mode (default is off)
[-b baseband_filter_bw_hz] # Set baseband filter bandwidth in Hz.
Possible values: 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz, default <= 0.75 * sample_rate_hz.
[-C ppm] # Set Internal crystal clock error in ppm.
[-H] # Synchronize RX/TX to external trigger input.
PS C:\dev\vcpkg> .\vcpkg install libusb:x64-windows
Computing installation plan...
The following packages will be built and installed:
libusb[core]:x64-windows -> 1.0.26.11791#3
* pkgconf[core]:x64-windows -> 1.8.0#5
* vcpkg-msbuild[core]:x64-windows -> 2023-08-08
* vcpkg-pkgconfig-get-modules[core]:x64-windows -> 2023-02-25
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
:
:
:
libusb provides CMake targets:
find_package(libusb CONFIG REQUIRED)
target_include_directories(main PRIVATE ${LIBUSB_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${LIBUSB_LIBRARIES})
fftw-3.3.5 or later
PS C:\dev\vcpkg> .\vcpkg search fftw3
dlib[fftw3] fftw3 support for dlib
fftw3 3.3.10#8 FFTW is a C subroutine library for computing the discrete Fourier transfor...
fftw3[avx] Builds part of the library with avx, sse2, sse
fftw3[avx2] Builds part of the library with avx2, fma, avx, sse2, sse
fftw3[openmp] Builds openmp enabled lib
fftw3[sse] Builds part of the library with sse
fftw3[sse2] Builds part of the library with sse2, sse
fftw3[threads] Enable threads in fftw3
matplotplusplus[fftw] fftw3 support for Matplot++
PS C:\dev\vcpkg> .\vcpkg install fftw3:x64-windows
Computing installation plan...
:
fftw3 provides CMake targets:
# this is heuristically generated, and may not be correct
find_package(FFTW3 CONFIG REQUIRED)
target_link_libraries(main PRIVATE FFTW3::fftw3)
find_package(FFTW3f CONFIG REQUIRED)
target_link_libraries(main PRIVATE FFTW3::fftw3f)
find_package(FFTW3l CONFIG REQUIRED)
target_link_libraries(main PRIVATE FFTW3::fftw3l)
hackrf\host\build> cmake ../ -G "Visual Studio 17 2022" -A x64 \
-DLIBUSB_INCLUDE_DIR=C:\Dev\vcpkg\packages\libusb_x64-windows\include\libusb-1.0 \
-DLIBUSB_LIBRARIES=C:\Dev\vcpkg\packages\libusb_x64-windows\lib\libusb-1.0.lib \
-DTHREADS_PTHREADS_INCLUDE_DIR=D:\Dev\HackRF\pthread-win32 \
-DTHREADS_PTHREADS_WIN32_LIBRARY=D:\Dev\HackRF\pthread-win32\windows\VS2022\bin\Release-Unicode-64bit-x64\pthread.lib \
-DFFTW_INCLUDES=C:\Dev\vcpkg\packages\fftw3_x64-windows\include \
-DFFTW_LIBRARIES=C:\Dev\vcpkg\packages\fftw3_x64-windows\lib\fftw3f.lib
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
CMake Deprecation Warning at libhackrf/CMakeLists.txt:24 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at hackrf-tools/CMakeLists.txt:24 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Dev/Defense/HackRF/hackrf/host/build