Posted comments (26)

Posted by Adam at November 5, 2013 12:08:32 CET
Hi. Nice guide but I have a problem after running cmake. I get all this errors. Where is my error

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: C:/libnfc-build/CMakeFiles/2.8.12/CMakeCCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!
Posted by Wouter at March 25, 2014 16:48:35 CET
Hi,

I've been following all of your steps until the last one: mingw32-make. Cmake fully configured the installation. Sad enough, when I run mingw32-make in the build folder. I'm getting the following output and errors:

http://pastebin.com/wMKmAdLE

I hope someone can help me with this.

I'm runnig Windows 8 64 bit by the way.
Posted by Thomas at May 6, 2014 13:34:01 CEST
Hi Wouter,

I try to install libnfc but I have the same problem as you.
Did you find an answer about that ?

Thanks.
Posted by Kantum at May 31, 2014 19:01:18 CEST
Hi everybody,

Same configuraiton and same problem too.
Do you have any answer ?

Thanks a lot.
Posted by Guglielmo at October 16, 2014 11:48:58 CEST
i follow all step: compile 32 bit version... no problem! If i try to compile under a 64 bit machine it still build a 32 bit version, i check all and i don't understand why it doensn't compile a 64 bit version. How to force target to 64 bit?
Posted by Sliman at October 26, 2014 10:19:14 CET
Hi everybody,

When I compile the libnfc-1.7.0 (win), i get the message that the libnfc.rc not at the location already set. Can you please tell me how can I get or generate the rc file?

Thanks a lot.
Regards
Posted by Pramod at March 12, 2015 13:06:39 CET
Hi, Very well explained guide. Thaks for providing such a nice guide.

I am getting following error during mingw32-make. Can you please point me what needs to be done to get rid of this issue.

c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/sec_api/time_s.h:45: multiple definition of `localtime_s'

c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/sec_api/time_s.h:45: first defined here
Posted by Hans E at April 24, 2015 16:06:31 CEST
Thank you soo much for this guide! Would never have managed this with out you! :) now its reading nfc like a champ!! :D

A slight comment to those who install on 64 bit windows systems and get the "This application has failed to start because libnfc.dll was not found. Re-installing the application may fix this problem." - message: the libnfc.dll file should be copied to the C:\Windows\SysWOW64 folder as this is the system directory for 32 bit files.!!!
Posted by Nicholas B at April 28, 2015 22:04:20 CEST
First, thank you for the instructions! I had to "install both the libnfc.dll and libusb0.dll as I got the same error for both when trying to launch one of the applications. I had to copy the .dll files to the system or sysWOW64 directories. Now I am getting an error...

The application failed to start correctly (0xc000007b). Click OK to close the application.

Any thoughts?
Posted by Bobbymcguire at July 22, 2015 07:25:42 CEST
I got the same error as Nicholas B, any idea to solve it ?
Posted by Julio Jose Gg at October 4, 2015 08:44:25 CEST
He seguido todos los pasos y me sale este error en cmake:

Could NOT find LATEX (missing: LATEX_COMPILER)
CMake Warning (dev) at cmake/modules/UseDoxygen.cmake:94 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target "doc".
Call Stack (most recent call first):
CMakeLists.txt:70 (INCLUDE)
This warning is for project developers. Use -Wno-dev to suppress it.

Found LIBUSB: C:/tools/libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a C:/tools/libnfc 1.7.1/include
Year for copyright is 2015
CMake Error at C:/tools/CMake/share/cmake-3.3/Modules/CMakePackageConfigHelpers.cmake:258 (message):
Variable LIBNFC_ROOT_DIR does not exist
Call Stack (most recent call first):
CMakeLists.txt:195 (configure_package_config_file)


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

ME PUEDEN AYUDAR???? GRACIAS.
Posted by Don at October 9, 2015 01:28:45 CEST
I coppied both the libnfc.dll and libusb0.dll to the executable directory as I got the same error for both when trying to launch one of the applications. I too am getting an error...

The application failed to start correctly (0xc000007b). Click OK to close the application.

Google hasn't turned up much.
Posted by Don at October 9, 2015 01:45:47 CEST
The application failed to start correctly (0xc000007b). Click OK to close the application.

*FIX*
In CMAKE choose
libusb-win32-bin-1.2.6.0\lib\msvc_x64\libusb.lib
as your
LIBUSB_LIBRARIES value
Posted by Forec at November 4, 2015 13:05:31 CET
I finished all the steps above, but I got a different message after my attemp to execute nfc-list.exe. My PC is 64bit Windows 10. It told me I lost usblib0.dll. I found that file in libusb-win32-bin-1.2.6.0/bin/amd64/libusb0.dll, and copied that file to both C:/Windows/system32 and C:/Windows/Wowsystem64. However I still can't run that application because it told me the file libusb0.dll is wrong. What should I do?
Posted by Tom at November 10, 2015 15:07:08 CET
FOR ALL WINDOWS 64 BIT USER:

1. copy libnfc.dll to C:\Windows\SysWOW64
2. copy C:\Tools\libusb-win32-bin-1.2.6.0\bin\x86\libusb0_x86.dll
to C:\Windows\SysWOW64
3. rename C:\Windows\SysWOW64\libusb0_x86.dll to libusb0.dll

the hint is in C:\Tools\libusb-win32-bin-1.2.6.0\bin\libusb-win32-bin-README.txt ;)

hope it works for you. Tested at Windows 7 64bit
Posted by Tom at November 10, 2015 15:18:06 CET
@ Julio Jose

just click "Add Entry" in cmake-gui and add LIBNFC_ROOT_DIR and put it to path and inset as example C:/Tools/libnfc
Posted by Abdullah at February 2, 2016 10:57:03 CET
Hey, just wanted to say I really appreciate this post. You're a life saver!
Posted by Somsay at February 22, 2017 08:52:46 CET
Hi
Though I god success on CMake step, i can not have good result as mingw32-make

....
c:/.../lib/libmsvcrt.a when searching for -lmsvcrt
c:/.../bin/ld.exe: cannot find -lmsvcrt
...
Makefile:148: recipe for target 'all' failed

But i can see libmsvcrt.a
i hope your guide
Posted by Marc A at April 25, 2017 16:02:31 CEST
I copied libnfc.dll and libusb0.dll to C:\Windows\SysWOW64 directory. Everything builds up to pn53x-diagnose.exe. Here's my output.

[ 19%] Built target nfc
[ 20%] Built target win32lib
[ 22%] Built target nfcutils
[ 26%] Built target nfc-list
[ 30%] Built target nfc-emulate-forum-tag4
[ 34%] Built target nfc-jewel
[ 39%] Built target nfc-mfclassic
[ 43%] Built target nfc-relay-picc
[ 48%] Built target nfc-mfultralight
[ 53%] Built target nfc-scan-device
[ 56%] Built target nfc-read-forum-tag3
[ 60%] Built target nfc-anticol
[ 63%] Built target nfc-dep-initiator
[ 67%] Built target nfc-dep-target
[ 71%] Built target nfc-emulate-forum-tag2
[ 74%] Built target nfc-emulate-tag
[ 78%] Built target nfc-emulate-uid
[ 81%] Built target nfc-mfsetuid
[ 85%] Built target nfc-poll
[ 89%] Built target nfc-relay
[ 90%] Linking C executable pn53x-diagnose.exe
CMakeFiles\pn53x-diagnose.dir/objects.a(pn53x-diagnose.c.obj): In function `main':
C:/SUPPORT_TOOLS/libnfc-master/examples/pn53x-diagnose.c:106: undefined reference to `pn53x_transceive'
C:/SUPPORT_TOOLS/libnfc-master/examples/pn53x-diagnose.c:117: undefined reference to `pn53x_transceive'
C:/SUPPORT_TOOLS/libnfc-master/examples/pn53x-diagnose.c:126: undefined reference to `pn53x_transceive'
collect2.exe: error: ld returned 1 exit status
examples\CMakeFiles\pn53x-diagnose.dir\build.make:117: recipe for target 'examples/pn53x-diagnose.exe' failed
mingw32-make[2]: *** [examples/pn53x-diagnose.exe] Error 1
CMakeFiles\Makefile2:954: recipe for target 'examples/CMakeFiles/pn53x-diagnose.dir/all' failed
mingw32-make[1]: *** [examples/CMakeFiles/pn53x-diagnose.dir/all] Error 2
Makefile:150: recipe for target 'all' failed
mingw32-make: *** [all] Error 2


Any ideas? Some people apparently got the original code to work in linux. Not sure what would be happening on Windows 7 64 bit PC? Issue seems code related though, somehow.
Posted by Steave at October 2, 2017 15:37:14 CEST
HI.
I have follow errors when compile LIBNFC_DRIVER_ACR122_USB.
Any ideas?
Thanks.

CMakeFiles\nfc.dir/objects.a(acr122_usb.c.obj): In function `acr122_usb_scan':
F:/libNFC/libnfc-1.7.1/libnfc/drivers/acr122_usb.c:302: undefined reference to `usb_prepare'
CMakeFiles\nfc.dir/objects.a(acr122_usb.c.obj): In function `acr122_usb_open':
F:/libNFC/libnfc-1.7.1/libnfc/drivers/acr122_usb.c:399: undefined reference to `usb_prepare'
collect2.exe: error: ld returned 1 exit status
libnfc\CMakeFiles\nfc.dir\build.make:440: recipe for target 'libnfc/libnfc.dll' failed
mingw32-make[2]: *** [libnfc/libnfc.dll] Error 1
CMakeFiles\Makefile2:86: recipe for target 'libnfc/CMakeFiles/nfc.dir/all' failed
mingw32-make[1]: *** [libnfc/CMakeFiles/nfc.dir/all] Error 2
Makefile:150: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Posted by George at February 18, 2019 18:40:35 CET
Thanks for this guide. I get this error message on Windows 10:

CMake Warning at C:/Program Files/CMake/share/cmake-3.14/Modules/Platform/Windows-GNU.cmake:199 (message):
Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.14/Modules/Platform/Windows-GNU-C-ABI.cmake:1 (__windows_compiler_gnu_abi)
C:/Program Files/CMake/share/cmake-3.14/Modules/CMakeCInformation.cmake:71 (include)


CMake Error at CMakeLists.txt:105 (INSTALL):
INSTALL FILES given no DESTINATION!

Thank you for any hints!
Posted by Xavave at September 11, 2019 18:16:05 CEST
clicking on the advanced checkbox in cmake-gui shows ALL missing references so,after fixing missing paths, I was able to follow the process on this tutorial and generate dll with mingw32-make.exe
I've also had to copy my source folder (for me : C:/tools/libnfc-master) into target build folder C:/libnfc-build, for configuration settings
then i have copied libnfc.dll in the same folder then nfc-list.exe
but when I run nfc-list.exe Nothing happens (no display, just a waiting cursor)
Posted by Xavave at January 8, 2020 12:47:48 CET
Hi, thanks for your tutorial
I've cross compiled mfoc.exe , cropto1_bs.exe, mfcuk.exe, nfc-mfcclassic.exe for windows 10 x64
here is the link to my blog post : http://legacy.averbouch.biz/libnfc-and-nfc-utils-binaries-on-windows-10/ if some is interested :-)
Posted by Belenki at July 12, 2021 12:42:50 CEST
I get this error message on Windows 10:
C:/tools/libnfc-1.7.0-rc7/contrib/windows.h:44:33: error: redefinition of 'sprintf'
44 | # define snprintf(S, n, ...) sprintf(S, __VA_ARGS__)

C:/tools/TDM-GCC-64/x86_64-w64-mingw32/include/stdio.h:441:43: note: each undeclared identifier is reported only once for each function it appears in
libnfc\CMakeFiles\nfc.dir\build.make:57: recipe for target 'libnfc/CMakeFiles/nfc.dir/nfc.c.obj' failed
mingw32-make[2]: *** [libnfc/CMakeFiles/nfc.dir/nfc.c.obj] Error 1
CMakeFiles\Makefile2:79: recipe for target 'libnfc/CMakeFiles/nfc.dir/all' failed
mingw32-make[1]: *** [libnfc/CMakeFiles/nfc.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Thank you for any hints!
Posted by Nik at January 19, 2022 13:50:25 CET
Hi, I get same error message like Belenki:
libnfc-master/contrib/windows.h:45:33: error: redefinition of 'sprintf'
45 | # define snprintf(S, n, ...) sprintf(S, __VA_ARGS__)

C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdio.h:382:5: note: previous definition of 'sprintf' was here
382 | int sprintf (char *__stream, const char *__format, ...)
| ^~~~~~~

Have somebody any solution?
Thanks
Posted by Holo.310 at April 24, 2022 10:45:35 CEST
get the same error message like Belenki&Nik:
D:/ProgramFiles/MinGW64/x86_64-w64-mingw32/include/stdio.h:441:43: note: each un
declared identifier is reported only once for each function it appears in
libnfc\CMakeFiles\nfc.dir\build.make:75: recipe for target 'libnfc/CMakeFiles/nf
c.dir/nfc.c.obj' failed
mingw32-make.exe[2]: *** [libnfc/CMakeFiles/nfc.dir/nfc.c.obj] Error 1
CMakeFiles\Makefile2:199: recipe for target 'libnfc/CMakeFiles/nfc.dir/all' fail
ed
mingw32-make.exe[1]: *** [libnfc/CMakeFiles/nfc.dir/all] Error 2
Makefile:154: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2

Thank you for any hints!