Search code examples
c++visual-c++boostusrpuhd

UHD USRP crash in debug mode


I have a simple receiver application with USRP B200. It works fine in release mode but crashes in debug mode. Program crashes when following method is called.

uhd::usrp::multi_usrp::make(args)

Here the stack view when it crashes: enter image description here

The program only requires libboost_thread from the boost library. I tried with different versions (libboost_thread-vc141-mt-x64-1_69.lib, libboost_thread-vc141-mt-gd-x64-1_69.lib, libboost_thread-vc141-mt-sgd-x64-1_69.lib) of that library but got the same result.

Environment :
OS: Windows 10 and 11
Compiler: MSVC2017, MSVC2015 64 bit
UHD version: 3.15.0.0 and 4.1.0.5
Boost versions : 1.69, 1.69, 1.77 and 1.79
Libusb version: 1.0 (debug mode dll)

Edit: This program works stably in release mode. Also, a similar program like this one works fine in release and debug modes on Ubuntu, but crashes in debug mode on Windows. So, I don't think it's a hidden bug causing the crash. I suspect there is a point between UHD, Boost, and MSVC for the debug mode in Windows. I would be grateful for any help.


Solution

  • I found the problem. The same build configuration must be used for UHD binaries. Using release built uhd.dll in debug mode causes the crash.

    Unfortunately, The official build of UHD doesn't contain debug builds. Those who need the debug version, need to compile it themselves. Here is the build guide:
    https://files.ettus.com/manual/page_build_guide.html

    And here are the debug builds of mine for testing purposes.
    https://github.com/huzeyfe-erkek/UHD-binaries