Topic: [SOLVED] mingw32-make on Windows 7 x64 undefined reference undefined

Hi,

today my ACR122 reader arrived and I want to get it worked with libnfc. Im using W7 x64 and want to compile libnfc but I have some problems:

mingw32-make

Linking C shared library libnfc.dll
Creating library file: libnfc.dll.a
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0xb4): undefined reference to `SCardTransmit@28'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x1de): undefined reference to `SCardControl@28'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x24f): undefined reference to `SCardTransmit@28'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x309): undefined reference to `SCardDisconnect@8'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x349): undefined reference to `SCardReleaseContext@4'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x3c8): undefined reference to `SCardListReadersA@16'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x513): undefined reference to `SCardReleaseContext@4'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x549): undefined reference to `SCardEstablishContext@16'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x5a0): undefined reference to `SCardEstablishContext@16'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x5e9): undefined reference to `SCardReleaseContext@4'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x68b): undefined reference to `SCardTransmit@28'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x6ce): undefined reference to `SCardControl@28'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x750): undefined reference to `SCardConnectA@24'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x7eb): undefined reference to `SCardConnectA@24'
CMakeFiles\nfc.dir/objects.a(acr122.c.obj):acr122.c:(.text+0x830): undefined reference to `SCardEstablishContext@16'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x137): undefined reference to `usb_get_string_simple'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x16c): undefined reference to `usb_get_string_simple'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x27e): undefined reference to `usb_init'

Any ideas what my problem is?

Re: [SOLVED] mingw32-make on Windows 7 x64 undefined reference undefined

It is the same problem as already posted here:

http://pastebin.com/Nw9NsFUj

Re: [SOLVED] mingw32-make on Windows 7 x64 undefined reference undefined

Hello,

The problem does come from the need to link correctly with PC/SC and libusb.

It don't use Windows systems, so I can't say more.

Try to put compilation in verbose mode to see with which componant the libnfc is linked at this stage and try to debug CMake files and/or your setup to make it works.

I want to help to help you but I cant: I don't have (nor want to have) a Windows 7 system.

Romuald Conty

Re: [SOLVED] mingw32-make on Windows 7 x64 undefined reference undefined

HI,

thanks for your answer. I have already fixed the "SCard.." issues. It was obvisouly a problem with PC/SC, but it is still not working

mingw32-make VERBOSE=1
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -HC:\Users\ole\Downloads\libnfc-1.5.1\libnfc-1.5.1 -BC:\Users\ole\Downloads\libnfc-1.5.1\libnfc-build --check-build-syste
m CMakeFiles\Makefile.cmake 0
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_start C:\Users\ole\Downloads\libnfc-1.5.1\libnfc-build\CMakeFiles C:\Users\ole\Downloads\libnfc-1.5.1\l
ibnfc-build\CMakeFiles\progress.marks
mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory `C:/Users/ole/Downloads/libnfc-1.5.1/libnfc-build'
mingw32-make -f libnfc\CMakeFiles\nfc.dir\build.make libnfc/CMakeFiles/nfc.dir/depend
mingw32-make[2]: Entering directory `C:/Users/ole/Downloads/libnfc-1.5.1/libnfc-build'
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\ole\Downloads\libnfc-1.5.1\libnfc-1.5.1 C:\Users\ole\Downloads\libnfc-1.5.1\l
ibnfc-1.5.1\libnfc C:\Users\ole\Downloads\libnfc-1.5.1\libnfc-build C:\Users\ole\Downloads\libnfc-1.5.1\libnfc-build\libnfc C:\Users\ole\Downloads\libnfc-1.5.1\libnfc-bui
ld\libnfc\CMakeFiles\nfc.dir\DependInfo.cmake --color=
mingw32-make[2]: Leaving directory `C:/Users/ole/Downloads/libnfc-1.5.1/libnfc-build'
mingw32-make -f libnfc\CMakeFiles\nfc.dir\build.make libnfc/CMakeFiles/nfc.dir/build
mingw32-make[2]: Entering directory `C:/Users/ole/Downloads/libnfc-1.5.1/libnfc-build'
Linking C shared library libnfc.dll
cd /d C:\Users\ole\Downloads\libnfc-1.5.1\libnfc-build\libnfc && "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\nfc.dir\link.txt --verbo
se=1
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\nfc.dir/objects.a
C:\MinGW64\bin\ar.exe cr CMakeFiles\nfc.dir/objects.a @CMakeFiles\nfc.dir\objects1.rsp
C:\MinGW64\bin\gcc.exe   -m32 -shared -o libnfc.dll -Wl,--out-implib,libnfc.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles\nfc.dir/objects.a -Wl,--no-whole-archive c:\MinGW64\x86_64-w64-mingw32\lib32\libwinscard.a C:\Users\ole\Downloads\libusb-win32-bin-1.2.5.0\libusb-win32-bin-1.2.5.0\lib\msvc_x64\libusb.lib -lwsock32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
Creating library file: libnfc.dll.a
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x172): undefined reference to `usb_bulk_read'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x1ed): undefined reference to `usb_bulk_write'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x23c): undefined reference to `usb_bulk_write'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x3aa): undefined reference to `usb_init'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x3af): undefined reference to `usb_find_busses'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x3ca): undefined reference to `usb_find_devices'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x3f5): undefined reference to `usb_get_busses'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x4c9): undefined reference to `usb_open'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x4df): undefined reference to `usb_set_configuration'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x4f3): undefined reference to `usb_close'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x52f): undefined reference to `usb_close'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x61f): undefined reference to `usb_get_string_simple'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x6c2): undefined reference to `usb_get_string_simple'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x7a1): undefined reference to `usb_init'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x7b2): undefined reference to `usb_get_busses'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x7e0): undefined reference to `usb_open'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x808): undefined reference to `usb_set_configuration'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x81c): undefined reference to `usb_close'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x839): undefined reference to `usb_claim_interface'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x84d): undefined reference to `usb_close'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0x97d): undefined reference to `usb_close'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0xa37): undefined reference to `usb_release_interface'
CMakeFiles\nfc.dir/objects.a(pn53x_usb.c.obj):pn53x_usb.c:(.text+0xa4a): undefined reference to `usb_close'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [libnfc/libnfc.dll] Error 1
mingw32-make[2]: Leaving directory `C:/Users/ole/Downloads/libnfc-1.5.1/libnfc-build'
mingw32-make[1]: *** [libnfc/CMakeFiles/nfc.dir/all] Error 2
mingw32-make[1]: Leaving directory `C:/Users/ole/Downloads/libnfc-1.5.1/libnfc-build'
mingw32-make: *** [all] Error 2

Re: [SOLVED] mingw32-make on Windows 7 x64 undefined reference undefined

To compile the pn53x_usb driver, you have to install and correctly setup libusb-win32 according to README-Windows.txt file (available at root directory of libnfc source).

BTW, as you will use libnfc without pn53x_usb compiliant device (ACR122 uses acr122.h/c driver) you can disable this driver, this way no more libusb-win32 required but you will not be able to use SCL3711 or ASK LoGO devices, for example.

Romuald Conty

Re: [SOLVED] mingw32-make on Windows 7 x64 undefined reference undefined

Hi,

I'm using a ACR122U so I dont need the pn53x_usb. How can I disable it?
I think I have installed libusb-win32 the right and also have installed the reader as libusb device.

edit: got it. it is compiling now. Thanks for your help

Last edited by xyz__ (2011-11-18 19:58:01)