peacepenguin / libnfc-unofficialbuilds

Repository for unofficial compilations of NFC-Tools and libnfc
35 stars 10 forks source link

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

Open Beatrizjn95 opened 4 years ago

Beatrizjn95 commented 4 years ago

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".

petersemple commented 4 years ago

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!

tiny656 commented 3 years ago

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

JL2014 commented 3 years ago

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 _PATHSUFFIXES 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_DEFAULTPATH is usefull in this case, but maybe you can influence _FINDLIBRARY() by setting _CMAKE_LIBRARYARCHITECTURE with the good value at runtime as indicated in https://cmake.org/cmake/help/latest/command/find_library.html.

Hope that will help.