Open stevewillson opened 2 years ago
Thanks for writing this up! I'm reopening this to remind us to update the documentation.
After I get past moving to the host/build directory step and try to create the make files with the shown code i get an output like this:
MSYS ~/hackrf/host/build $ ${MINGW_PREFIX}/bin/cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/lib -DFFTW_LIBRARIES=/lib bash: /bin/cmake: No such file or directory
I assume it has something to do with the path and variables however I have: C:\Program Files\CMake\bin , C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin , AND C:\opencv\build\install\x64\mingw\bin
In my PATH environment could someone help me out with this?
Put a $
before {MINGW_PREFIX}
. It should be ${MINGW_PREFIX}
.
Full line:
${MINGW_PREFIX}/bin/cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/lib -DFFTW_LIBRARIES=/lib
When I start MSYS2 in "MinGW x64 mode" from the Windows Start Menu ("MSYS2 MinGW x64") the MINGW_PREFIX
environment variable is set to /mingw64
$ echo $MINGW_PREFIX
/mingw64
I had to include this because there are 2 versions of cmake
on my MSYS2 installation:
/mingw64/bin/cmake
and
/usr/bin/cmake
$ /usr/bin/cmake -version
cmake version 3.22.1
$ /mingw64/bin/cmake -version
cmake version 3.23.2
The /usr/bin/cmake
version (3.22.1) doesn't support the -G "MSYS Makesfiles"
generator option, but the cmake version 3.23.2 supports the "MSYS Makefiles" generator option.
To see which generators are supported by cmake, use cmake -h
and at the bottom of the output text, supported generators are displayed.
$ /mingw64/bin/cmake -h
----- OUTPUT TRUNCATED -----
Generators
The following generators are available on this platform (* marks default):
----- OUTPUT TRUNCATED -----
MSYS Makefiles = Generates MSYS makefiles.
MinGW Makefiles = Generates a make file for use with
mingw32-make.
Green Hills MULTI = Generates Green Hills MULTI files
(experimental, work-in-progress).
Unix Makefiles = Generates standard UNIX makefiles.
----- OUTPUT TRUNCATED -----
thank you for that clarification that helped me overcome that specific line of code however now when I moved onto the make and make install commands I got errors..
It looks like I didn't have libusb.h in the right directory on the make and make install commands but when I generated the make file with the command I was missing the $ with, looking at the output it does show that I have libusb installed correctly for that command to work correctly and output a make file or build files to : C:/msys64/home/jcorc/hackrf/host/build.
I installed libusb with Cygwin and I also followed the link in the documentation listing it as a prereq to be able to install hackRF Software, however the download link downloaded a linux file and i am on windows the name of that file was: libusbx-1.0.18 (1).tar.bz2
Is the Cygwin install of libusb not sufficent for the needs of the hackRF tools installation? I googled more windows friendly libusb installers and ran them as well but these errors I am getting are leading me to believe that a file or directory wasn't created for which the make install command was looking for..
Any thoughts or ideas as to why I am getting the errors I got when running the make and make install commands outputed below??
Thank you
Here is my commandline output:
jcorc@Beast MINGW64 ~
jcorc@Beast MINGW64 ~/hackrf
jcorc@Beast MINGW64 ~/hackrf/host/build
bash: /usr/bin/cmake: No such file or directory
jcorc@Beast MINGW64 ~/hackrf/host/build
cmake version 3.23.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
jcorc@Beast MINGW64 ~/hackrf/host/build
Usage
cmake [options]
Specify a source directory to (re-)generate a build system for it in the current working directory. Specify an existing build directory to re-generate its build system.
Options
-S
Generators
The following generators are available on this platform (* marks default): Visual Studio 17 2022 = Generates Visual Studio 2022 project files. Use -A option to specify architecture. Visual Studio 16 2019 = Generates Visual Studio 2019 project files. Use -A option to specify architecture. Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 10 2010 [arch] = Deprecated. Generates Visual Studio 2010 project files. Optional [arch] can be "Win64" or "IA64". Visual Studio 9 2008 [arch] = Generates Visual Studio 2008 project files. Optional [arch] can be "Win64" or "IA64". Borland Makefiles = Generates Borland makefiles. NMake Makefiles = Generates NMake makefiles. NMake Makefiles JOM = Generates JOM makefiles. MSYS Makefiles = Generates MSYS makefiles. MinGW Makefiles = Generates a make file for use with mingw32-make. Green Hills MULTI = Generates Green Hills MULTI files (experimental, work-in-progress). Unix Makefiles = Generates standard UNIX makefiles.
jcorc@Beast MINGW64 ~/hackrf/host/build
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
-- The C compiler identification is GNU 12.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - 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
CMake Warning (dev) at C:/msys64/mingw64/share/cmake/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: C:/msys64/mingw64/lib/libusb-1.0.dll.a -- 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 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
-- Found FFTW: C:/msys64/lib -- Configuring done -- Generating done -- Build files have been written to: C:/msys64/home/jcorc/hackrf/host/build
jcorc@Beast MINGW64 ~/hackrf/host/build
[ 5%] Building C object libhackrf/src/CMakeFiles/hackrf.dir/hackrf.c.obj
C:/msys64/home/jcorc/hackrf/host/libhackrf/src/hackrf.c:31:10: fatal error: libusb.h: No such file or directory
31 | #include ~~~~~
compilation terminated.
make[2]: [libhackrf/src/CMakeFiles/hackrf.dir/build.make:76: libhackrf/src/CMakeFiles/hackrf.dir/hackrf.c.obj] Error 1
make[1]: [CMakeFiles/Makefile2:189: libhackrf/src/CMakeFiles/hackrf.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
jcorc@Beast MINGW64 ~/hackrf/host/build
[ 5%] Building C object libhackrf/src/CMakeFiles/hackrf.dir/hackrf.c.obj
C:/msys64/home/jcorc/hackrf/host/libhackrf/src/hackrf.c:31:10: fatal error: libusb.h: No such file or directory
31 | #include ~~~~~
compilation terminated.
make[2]: [libhackrf/src/CMakeFiles/hackrf.dir/build.make:76: libhackrf/src/CMakeFiles/hackrf.dir/hackrf.c.obj] Error 1
make[1]: [CMakeFiles/Makefile2:189: libhackrf/src/CMakeFiles/hackrf.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
I'm not sure about using cygwin to install the libusb files.
I am using MSYS2 and used pacman
to install the package mingw-w64-x86_64-libusb
to provide the libusb files.
Here is a listing of the files that the package mingw-w64-x86_64-libusb
provides:
$ pacman -Ql PACKAGE
- list the files owned by the queried package (from $ pacman -Q -h
)
$ pacman -Ql mingw-w64-x86_64-libusb
mingw-w64-x86_64-libusb /mingw64/
mingw-w64-x86_64-libusb /mingw64/bin/
mingw-w64-x86_64-libusb /mingw64/bin/libusb-1.0.dll
mingw-w64-x86_64-libusb /mingw64/include/
mingw-w64-x86_64-libusb /mingw64/include/libusb-1.0/
mingw-w64-x86_64-libusb /mingw64/include/libusb-1.0/libusb.h
mingw-w64-x86_64-libusb /mingw64/lib/
mingw-w64-x86_64-libusb /mingw64/lib/libusb-1.0.a
mingw-w64-x86_64-libusb /mingw64/lib/libusb-1.0.dll.a
mingw-w64-x86_64-libusb /mingw64/lib/pkgconfig/
mingw-w64-x86_64-libusb /mingw64/lib/pkgconfig/libusb-1.0.pc
mingw-w64-x86_64-libusb /mingw64/share/
mingw-w64-x86_64-libusb /mingw64/share/licenses/
mingw-w64-x86_64-libusb /mingw64/share/licenses/libusb/
mingw-w64-x86_64-libusb /mingw64/share/licenses/libusb/COPYING
The file libusb.h
is located at: /mingw64/include/libusb-1.0/libusb.h
Do you have libusb.h
at that same location?
To locate libusb.h
use the locate
command: $ locate libusb.h
, but before doing that, update the local file index using $ updatedb
you use -DLIBUSB_INCLUDE_DIR to include lib path? that makes no sense,you should include header
For anyone that encounter [libusb ](ibusb.h: No such file or directory)
in the make
step. Edit the import in source code helped for me:
Open File-> C:\msys64\home\#include <libusb.h>
To #include <libusb-1.0/libusb.h>
With this fix I got passed this problem:
libusb.h: No such file or directory
31 | #include <libusb.h>
| ^~~~~~~~~~
I should mention I dont know if this is a valid fix, just wanted to post here in case someone else got stuck and want a quick fix.
For anyone that encounter
[libusb ](ibusb.h: No such file or directory)
in themake
step. Edit the import in source code helped for me: Open File-> C:\msys64\home\hackrf\host\libhackrf\src\hackrf.c Change line #include <libusb.h>
To#include <libusb-1.0/libusb.h>
With this fix I got passed this problem:
libusb.h: No such file or directory 31 | #include <libusb.h> | ^~~~~~~~~~
I should mention I dont know if this is a valid fix, just wanted to post here in case someone else got stuck and want a quick fix.
The correct fix to overcome this problem, without modifying the source code, should be calling this as a CMAKE command:
${MINGW_PREFIX}/bin/cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=${MINGW_PREFIX}/include/libusb-1.0 -DFFTW_LIBRARIES=/lib
I'm writing these instructions to document a successful build process of the host software on Windows 11 using MSYS2. I had trouble following the build instructions on the README
How to build host software on Windows:
Prerequisites:
MSYS2 Packages:
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-libusb
mingw-w64-x86_64-fftw
git
Open
MSYS2 MinGW x64
from the Start MenuUpdate the package repository
$ pacman -Syu
Install the required packages
$ pacman -Syu --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-libusb mingw-w64-x86_64-fftw git
Clone the hackrf repository
$ git clone https://github.com/greatscottgadgets/hackrf.git
$ cd hackrf
$ mkdir host/build
$ cd host/build
Create the Makefiles
$ ${MINGW_PREFIX}/bin/cmake ../ -G "MSYS Makefiles" -DLIBUSB_INCLUDE_DIR=/lib -DFFTW_LIBRARIES=/lib
$ make
$ make install
(may require running MSYS2 as Administrator)This will install the hackrf host tools to:
C:\Program Files (x86)\HackRF\bin
When I tried to execute
hackrf_info.exe
from that directory, I had to add the following folder to the WindowsPath
Environment Variable to locate the DLLs. Add the following entry to the Path:C:\msys64\mingw64\bin
Open a Windows CMD Shell and execute:
C:\Program Files (x86)\HackRF\bin\hackrf_info.exe
If a HackRF board is connected, the information should be displayed.