L1L1 / cardpeek

Automatically exported from code.google.com/p/cardpeek
Other
454 stars 117 forks source link

Windows 64-bit build from source fails #123

Open radu-econsult opened 3 years ago

radu-econsult commented 3 years ago

Building from source both from master and from a release tag fails.

OS: Windows Server 2016 Version 1607 (I'm using an Amazon Workspace) Build platform: MSYS2 with MINGW64

For the 0.8.4 release I also had to run: pacman -S mingw-w64-x86_64-pdcurses

Building from master de8cee209b870f3d7aa1c6bd55e84738765dc1e6 fails with errors in _drivers/usbserialdriver.c:

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

Building from cardpeek-0.8.4 fails at link time:

gcc  -mwindows -o cardpeek asn1.o bytestring.o ui/gtk/gui_flexi_cell_renderer.o dyntree_model.o crypto.o  replay.o  ui.o  iso7816.o  lua_nodes.o  lua_asn1.o lua_bit.o  lua_bytes.o  lua_card.o  lua_crypto.o  lua_ext.o lua_log.o  lua_ui.o  main.o misc.o  pathconfig.o  smartcard.o system_info.o  a_string.o  ui/gtk/gui_about.o  ui/gtk/gui_toolbar.o ui/gtk/gui_logview.o  ui/gtk/gui_cardview.o  ui/gtk/gui_readerview.o http_download.o ui/gtk/gui_scratchpad.o  ui/gtk/gui_inprogress.o ui/gtk/gui_core.o ui/console/console_core.o ui/console/console_about.o ui/console/console_inprogress.o lua_iconv.o win32/win32compat.o win32/resource.o cardpeek_resources.o cardpeek_update.o  `pkg-config --libs gtk+-3.0` -L/usr/local/lib -lcurl -L/usr/lib -lssl -lcrypto -llua -L./win32/ -lwinscard -liconv -lreadline -lpdcurses
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lua_bytes.o:lua_bytes.c:(.text+0x32c): undefined reference to `luaL_checkint'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lua_bytes.o:lua_bytes.c:(.text+0x777): undefined reference to `luaL_checkint'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lua_bytes.o:lua_bytes.c:(.text+0x7af): undefined reference to `luaL_checkint'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lua_bytes.o:lua_bytes.c:(.text+0x871): undefined reference to `luaL_checkint'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lua_bytes.o:lua_bytes.c:(.text+0x8a9): undefined reference to `luaL_checkint'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lua_bytes.o:lua_bytes.c:(.text+0x994): more undefined references to `luaL_checkint' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x623): undefined reference to `SCardGetStatusChangeA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x73a): undefined reference to `SCardGetStatusChangeA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x809): undefined reference to `SCardConnectA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x872): undefined reference to `SCardGetAttrib'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x90d): undefined reference to `SCardDisconnect'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x9c8): undefined reference to `SCardReconnect'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0xaeb): undefined reference to `SCardTransmit'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0xb65): undefined reference to `SCardTransmit'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0xd37): undefined reference to `SCardStatusA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0xe57): undefined reference to `SCardStatusA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x1095): undefined reference to `SCardReleaseContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x10fb): undefined reference to `SCardEstablishContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x1dc8): undefined reference to `SCardEstablishContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x1e59): undefined reference to `SCardListReadersA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x1ecf): undefined reference to `SCardListReadersA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: smartcard.o:smartcard.c:(.text+0x2052): undefined reference to `SCardReleaseContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile.win32:28: cardpeek] Error 1
pauchf6 commented 1 year ago

I have same problem, someone have solution ?