nfc-tools / libnfc

Platform independent Near Field Communication (NFC) library
http://nfc-tools.org
GNU Lesser General Public License v3.0
1.72k stars 442 forks source link

undefined reference to `pn53x_transceive' #407

Open Tiwas opened 7 years ago

Tiwas commented 7 years ago

Hi.

I'm trying to install libnfc on my Windows box, but I'm having problems compiling it. After running the cmake gui, configure it and generate the makefile I proceed to run mingw32-make. This seems to work well for a long time until I get the following

[ 90%] Building C object examples/CMakeFiles/pn53x-diagnose.dir/pn53x-diagnose.c.obj [ 91%] Building RC object examples/CMakeFiles/pn53x-diagnose.dir/__/windows/pn53x-diagnose.rc.obj [ 92%] Linking C executable pn53x-diagnose.exe CMakeFiles\pn53x-diagnose.dir/objects.a(pn53x-diagnose.c.obj): In function main': D:/CygStuff/NFC/libnfc-master/examples/pn53x-diagnose.c:106: undefined reference topn53x_transceive' D:/CygStuff/NFC/libnfc-master/examples/pn53x-diagnose.c:117: undefined reference to pn53x_transceive' D:/CygStuff/NFC/libnfc-master/examples/pn53x-diagnose.c:126: undefined reference topn53x_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:1018: recipe for target 'examples/CMakeFiles/pn53x-diagnose.dir/all' failed mingw32-make[1]: [examples/CMakeFiles/pn53x-diagnose.dir/all] Error 2 Makefile:148: recipe for target 'all' failed mingw32-make: *** [all] Error 2

Could someone help me with how to get past this?

Cheers!

Tiwas commented 7 years ago

Yeah. Kind of. It hurt less to repartition my laptop, install linux on it and build all the apps :)

Sorry - wish I could give you a better answer, and if you can make it work for Windows I'd really appreciate it. Until then I'll just have to remote control my linux box...

rlaraujo commented 7 years ago

Oops. Same situation here. Exactly the same. All the rest is working for me. PLEASE HELP!

MegatronsCannon commented 7 years ago

Same situation here. Note: I'm on a windows 7 laptop. Also, I do not yet have the PN532 board. Is this needed prior to the build process? Soooo close ... yet so far.

doegox commented 7 years ago

Sorry, we, the usual maintainers, don't use Windows. Please try asking for help on stackoverflow.

peacepenguin commented 7 years ago

If you've reached the point that you're getting undefined reference related to the pn53x_xxx functions, just make the change noted in my fork: https://github.com/peacepenguin/libnfc/commit/b7d08bff41824255ef7f96535a8bf0b6450f1d14 It just removes the culprit files from the build process, doesn't actually "fix" the root problem. But this change does allow the rest of the utilities and examples to build successfully in windows.

I was able to get a basic compile done in windows using that fork, haven't confirmed it works yet, but here's my progress so far if anyone wants to test in windows. I'm not sure where the config file is supposed to be stored by default in windows. https://github.com/peacepenguin/libnfc-unofficialbuilds

There's detailed instructions there on how I was able to build on windows for anyone that wants to try to get to the root problem quickly.

peacepenguin commented 7 years ago

@Tiwas I've got the fixes done for this problem, pull request is pending acceptance:

https://github.com/nfc-tools/libnfc/pull/457

Try compiling the fork that has those changes using the instructions I've given here: https://github.com/peacepenguin/libnfc/blob/master/README-Windows.md

The changes allow building in mingw64 natively for 64-bit windows, with an up-to-date gcc/g++ tool-chain.

Hope that helps!

-Ben

LoZio commented 4 years ago

@Tiwas I've got the fixes done for this problem, pull request is pending acceptance:

457

Try compiling the fork that has those changes using the instructions I've given here: https://github.com/peacepenguin/libnfc/blob/master/README-Windows.md

The changes allow building in mingw64 natively for 64-bit windows, with an up-to-date gcc/g++ tool-chain.

Hope that helps!

-Ben

Some time has passed, your patch was replaced by #611 in the main code but... I followed your instructions and the ones from Mobfish. No way to compile 1.8 (or 1.7 FWIW) on Win64. First I needed to comment out the include for Doxygen in CMakeLists.txt, and that was fine. The if you do a single cmake, it runs fine and reaches "Generating done". If you do it again as per your instructions you get:

CMake Error at libnfc/CMakeLists.txt:37 (MESSAGE):
  I2C is only (yet) supported in Linux!

If you continue without the second cmake, it compiles until 8% and stops with the attached error log. failed-build.txt

Any hint to continue or we just need to assume that Windows is a "best effort" platform? Thanks

Edit: I quoted the wrong message and not @peacepenguin