L1L1 / cardpeek

Automatically exported from code.google.com/p/cardpeek
Other
438 stars 115 forks source link

Build Failure for Windows #119

Open jla3378 opened 3 years ago

jla3378 commented 3 years ago

When cross compiling or compiling natively using the docs, this error pops up. It seems that a header file is all that is needed?

In file included from smartcard.c:96:
drivers/usbserial_driver.c: In function 'usbserial_connect':
drivers/usbserial_driver.c:49:55: error: 'O_NOCTTY' undeclared (first use in this function); did you mean 'ENOTTY'?
   49 |   serial->usbdev_fd = open(serial->dev_path, O_RDWR | O_NOCTTY); //O_NDELAY
      |                                                       ^~~~~~~~
      |                                                       ENOTTY
drivers/usbserial_driver.c:49:55: note: each undeclared identifier is reported only once for each function it appears in
drivers/usbserial_driver.c: In function 'read_APDU_byte':
drivers/usbserial_driver.c:65:9: warning: implicit declaration of function 'fcntl' [-Wimplicit-function-declaration]
   65 |         fcntl(fd, F_SETFL, 0);
      |         ^~~~~
drivers/usbserial_driver.c:65:19: error: 'F_SETFL' undeclared (first use in this function)
   65 |         fcntl(fd, F_SETFL, 0);
      |                   ^~~~~~~
drivers/usbserial_driver.c:67:28: error: 'FNDELAY' undeclared (first use in this function)
   67 |         fcntl(fd, F_SETFL, FNDELAY);
      |                            ^~~~~~~
make: *** [<builtin>: smartcard.o] Error 1
criminalben commented 3 years ago

+1 Did you find a solution?

rena2019 commented 3 years ago

same error here. I tried to add

include <sys/stat.h>

include

but did not help

Pycses commented 3 years ago

Anyone able to find a solution to this? I'm also having this problem.

AKing23T commented 3 years ago

I had solved the problem. In windows, you must comment the code "#include "drivers/usbserial_driver.c"" and "if (usbserial_initialize(reader)==0) return NULL;" to not call usbserial driver, so you can compile and build successfully. You can have a try.