jankae / LibreVNA

100kHz to 6GHz 2 port USB based VNA
GNU General Public License v3.0
1.08k stars 204 forks source link

Software (PC_App) build fails due to libusb-1.0 dependencies in QT5 #24

Closed alextsure closed 3 years ago

alextsure commented 3 years ago

Hello Jan, Thank You very much for sharing this great project, Could You, please, give some comments about details of QT5 Development environment setup, especially how should the libusb-1.0 files be installed in the QT5 ? I have encountered a following problem while trying to compile the PC software in QT5.12.10 (using the MinGW73_64 compiler) under Windows x64: "./../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lusb-1.0 collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [Makefile.Debug:581: debug/Application.exe] Error "

It's not obvious from the compiler error log why did the software build fails due to errors with libusb-1.0 included files installation. I have tried to follow the recommendations and have copied all the libusb *.a files from Libusb-1.0 archive as the instructions says: "MinGW/cygwin:

May be I am doing something wrong, or have set up the compiler environment paths incorrectly, or have missed a '-lusb-1.0' linker option when compiling ? Any advice would be appreciated, sorry for a messy questions. Thanks!

jankae commented 3 years ago

Hi,

did you install the QtCreator as well or did you setup your toolchain manually? (I believe going with the QtCreator is the easier option on Windows). My current setup is slightly different than yours:

My Qt installation directory is C:\Qt, so I copied the libusb-1.0.a to C:\Qt\5.15.1\mingw81_64\lib and the libusb.h to C:\Qt\5.15.1\mingw81_64\include\libusb

Your error message is from the linker, meaning your compiler finds the libusb.h, you must have copied it to the right place already. You also didn't forget a linker option (in that case the linker wouldn't look for the lib and you would get "undefined reference" errors). The '-lusb-1.0' is in the Application.pro file.

At the moment I can think of two things you could try:

nbgsmk commented 3 years ago

Hello! I was able to set it up like this: Qt is installed in C:\Qt Below left you see where my libusb is, and it's contents. On the right side I marked the two lines which I add to the Application.pro. Surely there is a more correct way, but once I got it working, I was afraid to touch it again. :-)

image

alextsure commented 3 years ago

Thanks for help, after substitution of the local path to the libusb files the build goes without errors.

jankae commented 3 years ago

Glad to hear that :)