• Cannot compile libnfc - regex.h
    2 replies, posted
For the past several days, I have been trying to compile libnfc for Windows 7 x64. This is for use in a production application (check-in using RFID cards and an ACR122S RFID reader). After much ado, I have overcome the initial errors, but I am stuck at this one: After configuring everything correctly (I think), I run mingw32-make as recommended in libnfc-1.7.0-rc4/readme-windows.txt:49 in order to compile libnfc. This gives the error, and I quote: [CODE] E:\dev\libnfc-1.7.0-rc4\libnfc\conf.c:28:19: fatal error: regex.h: No such file or directory compilation terminated. libnfc\CMakeFiles\nfc.dir\build.make:153: recipe for target 'libnfc/CMakeFiles/nfc.dir/conf.c.obj' failed mingw32-make[2]: *** [libnfc/CMakeFiles/nfc.dir/conf.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 [/CODE] What should I do to fix this? It's probably something really stupid and noobish that I just haven't thought about :( [B]Disregard the above, it has been fixed. New problems have arisen, however.[/B] I managed to find a working regex.h and used that one, it compiled a few of the files but never finished. It required a winscard.h, winsmcrd.h and winapifamily.h. I obtained the first two from MinGW64, the last one from C:\Program Files (x86)\Windows Kits\8.0\Include\shared (maybe the wrong version?), and it passed until I got this: [CODE]E:\dev\libnfc-build\bin>mingw32-make [ 1%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.obj E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c: In function 'pn53x_usb_connstring_decode': E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:276:5: warning: implicit declaration of function 'strdup' [-Wimplicit-function-declaration] E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:276:20: warning: assignment makes pointer from integer without a cast [enabled by default] E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:277:20: warning: assignment makes pointer from integer without a cast [enabled by default] E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c: In function 'pn53x_usb_receive': E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:520:3: error: unknown type name 'off_t' E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:606:5: warning: unknown conversion type character 'z' in format [-Wformat] E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:606:5: warning: unknown conversion type character 'z' in format [-Wformat] E:\dev\libnfc-1.7.0-rc4\libnfc\drivers\pn53x_usb.c:606:5: warning: too many arguments for format [-Wformat-extra-args] libnfc\CMakeFiles\nfc.dir\build.make:297: recipe for target 'libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.obj' failed mingw32-make[2]: *** [libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.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[/CODE] It appears that the problematic line is (line 520 of pn53x_usb.c) [CODE] off_t offset = 0;[/CODE] Any suggestions?
[QUOTE=Bjonnfesk;39536260][CODE] off_t offset = 0;[/CODE] Any suggestions?[/QUOTE] off_t appears to be included in sys/types.h but I don't know if MinGW would contain that file. [url]http://pubs.opengroup.org/onlinepubs/000095399/basedefs/sys/types.h.html[/url] It is also possible that your headers are incorrect and resolving this issue will lead to more issues. You might look around for an alternate regex.h.
An alternate regex.h might be the solution, although I would find that strange since the regex.h I used was from PCRE, which is referenced in the libnfc readme. I'd rather think it was winapifamily.h that was the problem, since it comes from the Windows 8 SDK (which seems very strange to me), but I was unable to find another version with the same name. Sometimes I just want to drop the talentless Windows and use Linux exclusively (Linux, of course, compiles libnfc without blinking), but I don't think the people I'm making this for would be very happy with me if I told them it only works on Linux.
Sorry, you need to Log In to post a reply to this thread.