libnfc-unofficialbuilds icon indicating copy to clipboard operation
libnfc-unofficialbuilds copied to clipboard

CMake Error at cmake/modules/FindLIBUSB.cmake:55 (MESSAGE): Could not find LIBUSB

Open Beatrizjn95 opened this issue 4 years ago • 3 comments

Hi everyone, i am trying to install the libnfc but when try to configure the build with cmake i have the next problem in cmd. how i could solve? thank

C:\Users\beatr\libnfc>cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..\libnfc CMake Error at cmake/modules/FindLIBUSB.cmake:55 (MESSAGE): Could not find LIBUSB Call Stack (most recent call first): cmake/modules/LibnfcDrivers.cmake:22 (FIND_PACKAGE) CMakeLists.txt:146 (INCLUDE)

-- Configuring incomplete, errors occurred! See also "C:/Users/beatr/libnfc/CMakeFiles/CMakeOutput.log".

Beatrizjn95 avatar Mar 26 '20 17:03 Beatrizjn95

I am also getting errors that are similar

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) CMake Error at cmake/modules/FindLIBUSB.cmake:55 (MESSAGE): Could not find LIBUSB Call Stack (most recent call first): cmake/modules/LibnfcDrivers.cmake:22 (FIND_PACKAGE) CMakeLists.txt:146 (INCLUDE)

-- Configuring incomplete, errors occurred!

petersemple avatar Aug 08 '20 10:08 petersemple

you can find LIBUSB library here libusb-win32. or what you need is libnfc-1.8.0, I published a win32 release, you can find in my fork project here

tiny656 avatar Jan 07 '21 00:01 tiny656

Hi,

Under 64-bit Windows, this problem should be fixed by changing NAMES and PATHS values at this line in "libnfc\cmake\modules\FindLIBUSB.cmake" :

FIND_LIBRARY(LIBUSB_LIBRARIES NAMES "libusb" PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib/msvc_x64")

Because there is a file named "libusb0.dll" (with a zero at the end) in "LibUSB-Win32\bin\amd64" but there is no zero at the end of "libusb.lib" in "LibUSB-Win32\lib\msvc_x64".

I also tried to add others path as "$ENV{ProgramFiles}/LibUSB-Win32/lib/msvc_i64" ... in PATHS, for example : FIND_LIBRARY(LIBUSB_LIBRARIES NAMES "libusb" PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib/msvc_x64" "$ENV{ProgramFiles}/LibUSB-Win32/lib/msvc_i64") but the "right" choice is not guaranteed because depend of order.

I also tried to add more choices in NAMES as : NAMES "libusb" "libusb0" is it usefull/risky for future versions ?

I also tried to add PATH_SUFFIXES and change PATHS : PATH_SUFFIXES bcc dynamic gcc msvc msvc_i64 msvc_x64 PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib but bcc was chosen and i use msvc_x64.

I dont know if NO_DEFAULT_PATH is usefull in this case, but maybe you can influence FIND_LIBRARY() by setting CMAKE_LIBRARY_ARCHITECTURE with the good value at runtime as indicated in https://cmake.org/cmake/help/latest/command/find_library.html.

Hope that will help.

JL2014 avatar Nov 23 '21 13:11 JL2014