libnfc-unofficialbuilds
libnfc-unofficialbuilds copied to clipboard
Build and finding device issues - solved / FYI
First of all, nice work. I encountered some issues though (on Windows 10 pro 64 bit, version 10.0.19402), which I finally solved. I am sharing my insights. Maybe someone has been struggling with similar problems, or maybe @peacepenguin wants to make an update.
-
CMake Error at cmake/modules/FindLIBUSB.cmake:55 (MESSAGE): Could not find LIBUSB ( probably also the problem of #2) Looking into the code of ..\libnfc\cmake\modules\FindLIBUSB.cmake I see that
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb0 PATHS "$ENV{ProgramFiles}/LibUSB-Win32/bin/amd64")
fails to find anything although the library is at exactly said directory. Somehow this is related to which file ending is expected. On windows machines, just addSET(CMAKE_FIND_LIBRARY_PREFIXES "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
before. -
errors at mingw32-make
Scanning dependencies of target nfc
[ 1%] Building C object libnfc/CMakeFiles/nfc.dir/nfc.c.obj
In file included from C:/msys64/home/work/libnfc/config.h:1,
from C:\msys64\home\work\libnfc\libnfc\nfc.c:74:
C:/msys64/home/work/libnfc/contrib/windows.h:47: warning: "ETIMEDOUT" redefined
47 | # define ETIMEDOUT WSAETIMEDOUT
|
... (and a few similar warnings, followed by a few similar errors, eg. :
In file included from C:/msys64/home/work/libnfc/config.h:1,
from C:\msys64\home\work\libnfc\libnfc\nfc.c:74:
C:/msys64/home/work/libnfc/contrib/windows.h:45:33: error: redefinition of 'sprintf'
45 | # define snprintf(S, n, ...) sprintf(S, __VA_ARGS__)
| ^~~~~~~
here, simply commenting out the respective redefinition lines in ..\libnfc\contrib\windows.h helped - judging from the comments in the code, these were a few hacks which were formerly required (maybe with another version of some software or OS?)
- trouble finding the device Putting the config file into the folder as described worked for me, but the question arises regarding the content: A search quick search on the internet didn't reveal immediately, how the correct device.connstring should look like for the particular device on a Windows machine. Therefore just put the following in the config for now (you can go back later to disable the intrusive scan and add the correct device.connstring once the device has been found once):
# Allow device auto-detection (default: true)
# Note: if this auto-detection is disabled, user has to set manually a device
# configuration using file or environment variable
allow_autoscan = true
# Allow intrusive auto-detection (default: false)
# Warning: intrusive auto-detection can seriously disturb other devices
# This option is not recommended, user should prefer to add manually his device.
allow_intrusive_scan = true
# Set log level (default: error)
# Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug)
# Note: if you compiled with --enable-debug option, the default log level is "debug"
log_level = 3
# Manually set default device (no default)
# To set a default device, you must set both name and connstring for your device
# Note: if autoscan is enabled, default device will be the first device available in device list.
# device.name = "<YOUR NAME>"
# device.connstring = "<YOUR STRING>"
Finally in windows device manager, the device should not show up as driverless. In my case, I had to use zadig to assign the libusb-win32 (v1.2.6.0) driver (thanks for the hint in the answers to #1 )
Hi @noregretti Thanks for the updates. I'm trying to get an automated build pipeline going, but keep hitting into
C:\projects\libnfc\libnfc\drivers\acr122_usb.c:586:3: error: unknown type name 'off_t'
586 | off_t offset = 0;
| ^~~~~
libnfc\CMakeFiles\nfc.dir\build.make:195: recipe for target 'libnfc/CMakeFiles/nfc.dir/drivers/acr122_usb.c.obj' failed
mingw32-make[2]: *** [libnfc/CMakeFiles/nfc.dir/drivers/acr122_usb.c.obj] Error 1
CMakeFiles\Makefile
Did you encounter this problem ?
Hi @noregretti Thanks for the updates. I'm trying to get an automated build pipeline going, but keep hitting into
C:\projects\libnfc\libnfc\drivers\acr122_usb.c:586:3: error: unknown type name 'off_t' 586 | off_t offset = 0; | ^~~~~ libnfc\CMakeFiles\nfc.dir\build.make:195: recipe for target 'libnfc/CMakeFiles/nfc.dir/drivers/acr122_usb.c.obj' failed mingw32-make[2]: *** [libnfc/CMakeFiles/nfc.dir/drivers/acr122_usb.c.obj] Error 1 CMakeFiles\Makefile
Did you encounter this problem ?
(Un)fortunately I did not encounter such problem, sorry.