Closed elonen closed 9 years ago
Hi,
Definetely an issue from your side, with vanilla libnfc 1.7.1 from archlinux I get these:
$ objdump -tT /usr/lib/libnfc.so|grep iso1444
000000000000aa30 g DF .text 0000000000000054 Base iso14443b_crc
000000000000aa20 g DF .text 0000000000000009 Base iso14443a_crc_append
000000000000aaa0 g DF .text 000000000000004a Base iso14443a_locate_historical_bytes
000000000000c6c0 g DF .text 0000000000000038 Base snprint_nfc_iso14443b2sr_info
000000000000c570 g DF .text 0000000000000142 Base snprint_nfc_iso14443bi_info
000000000001dd70 g DO .rodata 0000000000000008 Base pn53x_iso14443a_supported_baud_rates
000000000000a9c0 g DF .text 0000000000000053 Base iso14443a_crc
000000000001dd20 g DO .rodata 0000000000000014 Base pn533_iso14443b_supported_baud_rates
000000000000aa90 g DF .text 0000000000000009 Base iso14443b_crc_append
000000000000aaf0 g DF .text 00000000000000a3 Base iso14443_cascade_uid
000000000001dd38 g DO .rodata 0000000000000008 Base pn532_iso14443b_supported_baud_rates
000000000000c090 g DF .text 00000000000004d7 Base snprint_nfc_iso14443b_info
000000000000c700 g DF .text 00000000000000d0 Base snprint_nfc_iso14443b2ct_info
000000000000acc0 g DF .text 0000000000001261 Base snprint_nfc_iso14443a_info
Are you sure it's v1.7.1 ? I remember a related issue being fixed between 1.7.0 and 1.7.1.
It is 1.7.1, and the function seems to be in the .c files. Packaging must be broken somehow.
@elonen I guess packaging used autotools : https://github.com/nfc-tools/libnfc/commit/68094b4f6d9d9f68ded22ca8fd1ace56e6751885
Yes! Nfc-bindings now compiles and works after that update.
Hi, I am getting the same error. I am using raspberry pi, python 2.7.
First I was following these steps http://nfc-tools.org/index.php?title=Libnfc#Debian_.2F_Ubuntu. Everything works fine, when I run sudo nfc-poll
my touchago read card.
Then I followed steps from this library, but I get the same result as above.
Do you have any solution or suggestions?
@D0d0, As you're using git you can simply backport that commit:
...
git checkout libnfc-1.7.1
git cherry-pick 68094b4
...
Then rebuild/reinstall etc
@D0d0, nfc-bindings now handles both cases cc @elonen
Well, now it builds, but new error shows
pi@raspberrypi:~/Desktop/nfc-bindings $ cmake -DCMAKE_INSTALL_PREFIX=~/.local .
-- The C compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- checking for module 'libnfc'
-- found libnfc, version 1.7.1
-- Found LibNFC: /usr/local/lib/libnfc.so (found suitable version "1.7.1", minimum required is "1.7.1")
-- Looking for iso14443b_crc
-- Looking for iso14443b_crc - found
-- Found SWIG: /usr/local/bin/swig (found version "3.0.10")
-- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython3.4m.so (found version "3.4.2")
-- Found PythonInterp: /usr/bin/python (found version "2.7.9")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/Desktop/nfc-bindings
pi@raspberrypi:~/Desktop/nfc-bindings $ sudo make install
[ 50%] Swig source
Scanning dependencies of target _nfc
[100%] Building C object python/CMakeFiles/_nfc.dir/nfcPYTHON_wrap.c.o
/home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c: In function ‘_wrap_device_get_supported_modulation’:
/home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c:4584:63: warning: passing argument 3 of ‘nfc_device_get_supported_modulation’ from incompatible pointer type
result = (int)nfc_device_get_supported_modulation(arg1,arg2,(enum nfc_modulation_type const **)arg3);
^
In file included from /home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c:3390:0:
/usr/local/include/nfc/nfc.h:126:16: note: expected ‘const enum nfc_modulation_type ** const’ but argument is of type ‘const enum nfc_modulation_type **’
NFC_EXPORT int nfc_device_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt);
^
/home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c: In function ‘_wrap_device_get_supported_baud_rate’:
/home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c:4624:62: warning: passing argument 3 of ‘nfc_device_get_supported_baud_rate’ from incompatible pointer type
result = (int)nfc_device_get_supported_baud_rate(arg1,arg2,(enum nfc_baud_rate const **)arg3);
^
In file included from /home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c:3390:0:
/usr/local/include/nfc/nfc.h:127:16: note: expected ‘const enum nfc_baud_rate ** const’ but argument is of type ‘const enum nfc_baud_rate **’
NFC_EXPORT int nfc_device_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
^
/home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c: In function ‘_wrap_device_get_supported_baud_rate_target_mode’:
/home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c:8144:74: warning: passing argument 3 of ‘nfc_device_get_supported_baud_rate_target_mode’ from incompatible pointer type
result = (int)nfc_device_get_supported_baud_rate_target_mode(arg1,arg2,(enum nfc_baud_rate const **)arg3);
^
In file included from /home/pi/Desktop/nfc-bindings/python/nfcPYTHON_wrap.c:3390:0:
/usr/local/include/nfc/nfc.h:128:16: note: expected ‘const enum nfc_baud_rate ** const’ but argument is of type ‘const enum nfc_baud_rate **’
NFC_EXPORT int nfc_device_get_supported_baud_rate_target_mode(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
^
Linking C shared module _nfc.so
[100%] Built target _nfc
Install the project...
-- Install configuration: ""
-- Installing: /home/pi/.local/lib/python2.7/site-packages/nfc.py
-- Installing: /home/pi/.local/lib/python2.7/site-packages/_nfc.so
-- Removed runtime path from "/home/pi/.local/lib/python2.7/site-packages/_nfc.so"
-- Installing: /home/pi/.local/share/nfc-bindings/examples/nfc-anticol.py
-- Installing: /home/pi/.local/share/nfc-bindings/examples/nfc-dep-target.py
-- Installing: /home/pi/.local/share/nfc-bindings/examples/nfc-list.py
-- Installing: /home/pi/.local/share/nfc-bindings/examples/quick_start_example.py
@D0d0, these are only warnings
@D0d0 no need for sudo when installing into ~
Of course these are just warnings (i got them before your commit), but when running next script i get this output. Error is referencing to one function from warning
pi@raspberrypi:~/Desktop $ python quick_start_example.py
Traceback (most recent call last):
File "quick_start_example.py", line 7, in <module>
import nfc
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 20, in <module>
_nfc = swig_import_helper()
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 19, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: /home/pi/.local/lib/python2.7/site-packages/_nfc.so: undefined symbol: nfc_device_get_supported_baud_rate_target_mode
@D0d0 So you followed http://nfc-tools.org/index.php?title=Libnfc#Debian_.2F_Ubuntu ? So which version of libnfc did you install, the tag or the HEAD ? Using autotools, cmake or the debian package ?
@xantares Yes, I followed the steps in the mentioned page. One command is git checkout libnfc-1.7.1
so I believe version is 1.7.1. Also when I installed your lib I got this
-- checking for module 'libnfc'
-- found libnfc, version 1.7.1
-- Found LibNFC: /usr/local/lib/libnfc.so (found suitable version "1.7.1", minimum required is "1.7.1")
and when i run nfc-poll
, i get
nfc-poll uses libnfc libnfc-1.7.1
@D0d0 what's the result of: objdump -T /usr/local/lib/libnfc.so|grep nfc_device_get
@xantares
pi@raspberrypi:~/Desktop/nfc-bindings $ objdump -T /usr/local/lib/libnfc.so|grep nfc_device_get
00004a70 g DF .text 0000004c Base nfc_device_get_supported_baud_rate_target_mode
00004700 g DF .text 00000048 Base nfc_device_get_supported_baud_rate
000046c0 g DF .text 00000008 Base nfc_device_get_connstring
000046b0 g DF .text 00000008 Base nfc_device_get_last_error
000046c8 g DF .text 00000038 Base nfc_device_get_supported_modulation
000046b8 g DF .text 00000008 Base nfc_device_get_name
00004ad0 g DF .text 00000030 Base nfc_device_get_information_about
@D0d0, the symbol is there, do you have another libnfc.so installed ? maybe in /usr/lib ?
can you do: ldd /home/pi/.local/lib/python2.7/site-packages/_nfc.so
pi@raspberrypi:~/Desktop $ ldd /home/pi/.local/lib/python2.7/site-packages/_nfc.so
linux-vdso.so.1 (0x76f55000)
/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f03000)
libnfc.so.5 => /usr/lib/arm-linux-gnueabihf/libnfc.so.5 (0x76ec1000)
libusb-0.1.so.4 => /lib/arm-linux-gnueabihf/libusb-0.1.so.4 (0x76ea9000)
libpython3.4m.so.1.0 => /usr/lib/arm-linux-gnueabihf/libpython3.4m.so.1.0 (0x76aee000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x769ad000)
/lib/ld-linux-armhf.so.3 (0x54ad4000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x76996000)
libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0x76963000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x7693c000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76914000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76901000)
libutil.so.1 => /lib/arm-linux-gnueabihf/libutil.so.1 (0x768ee000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76872000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76845000)
@D0d0 ls -l /usr/local/lib/libnfc.so objdump -T /usr/lib/arm-linux-gnueabihf/libnfc.so.5|grep nfc_device_get
@xantares
pi@raspberrypi:~/Desktop $ ls -l /usr/local/lib/libnfc.so
lrwxrwxrwx 1 root staff 15 May 31 18:10 /usr/local/lib/libnfc.so -> libnfc.so.5.0.1
pi@raspberrypi:~/Desktop $ objdump -T /usr/lib/arm-linux-gnueabihf/libnfc.so.5|grep nfc_device_get
00004ad4 g DF .text 00000038 Base nfc_device_get_supported_baud_rate
00004a94 g DF .text 00000008 Base nfc_device_get_connstring
00004a84 g DF .text 00000008 Base nfc_device_get_last_error
00004a9c g DF .text 00000038 Base nfc_device_get_supported_modulation
00004a8c g DF .text 00000008 Base nfc_device_get_name
00004b20 g DF .text 00000030 Base nfc_device_get_information_about
pi@raspberrypi:~/Desktop $ python quick_start_example.py
Traceback (most recent call last):
File "quick_start_example.py", line 7, in <module>
import nfc
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 20, in <module>
_nfc = swig_import_helper()
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 19, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: /home/pi/.local/lib/python2.7/site-packages/_nfc.so: undefined symbol: nfc_device_get_supported_baud_rate_target_mode
and then i tried reinstall your lib with the same result
ls -l /usr/lib/arm-linux-gnueabihf/libnfc.so.5 ?
pi@raspberrypi:~/Desktop $ ls -l /usr/lib/arm-linux-gnueabihf/libnfc.so.5
lrwxrwxrwx 1 root root 15 May 31 18:15 /usr/lib/arm-linux-gnueabihf/libnfc.so.5 -> libnfc.so.5.0.1
@D0d0 you've definetely got two versions installed one in /usr/lib/arm-linux-gnueabihf/, the other in /usr/local try to rename this one: sudo mv /usr/lib/arm-linux-gnueabihf/libnfc.so.5 /usr/lib/arm-linux-gnueabihf/libnfc.so.5zzzz
pi@raspberrypi:~/Desktop $ python quick_start_example.py
Traceback (most recent call last):
File "quick_start_example.py", line 7, in <module>
import nfc
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 20, in <module>
_nfc = swig_import_helper()
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 19, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: libnfc.so.5: cannot open shared object file: No such file or directory
and also tried reinstall your package with the same result. I tried cp one from /usr/local to /usr/lib with this result
pi@raspberrypi:~/Desktop $ sudo cp /usr/local/lib/libnfc.so /usr/lib/arm-linux-gnueabihf/libnfc.so.5
pi@raspberrypi:~/Desktop $ python quick_start_example.py
Traceback (most recent call last):
File "quick_start_example.py", line 7, in <module>
import nfc
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 20, in <module>
_nfc = swig_import_helper()
File "/home/pi/.local/lib/python2.7/site-packages/nfc.py", line 19, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: dynamic module does not define init function (init_nfc)
@D0d0 that's progress, the bug now is that you link against py3 libs but use the py2 interpreter: -- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython3.4m.so -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
@xantares yes, I saw it first time i built lib, but did not know how to change interpreter or libs (for me it does not matter if it is py2 or py3)
@D0d0 pass -DPYTHON_EXECUTABLE=/usr/bin/python3 to cmake and use python3 to execute
@xantares i own you a lot beer! thank you for your patience!
Also it would be great to add python3 build into docs.
pi@raspberrypi:~/Desktop $ sudo cp /usr/local/lib/libnfc.so /usr/lib/arm-linux-gnueabihf/libnfc.so.5
pi@raspberrypi:~/Desktop $ python3 quick_start_example.py
Version: libnfc-1.7.1-89-g403650a
NFC reader: / CCID USB Reader opened
The following (NFC) ISO14443A tag was found:
ATQA (SENS_RES): 00 44
UID (NFCID1): 04 76 32 d9 a1 25 80
SAK (SEL_RES): 0
@D0d0 great success!
Trying to build nfc-bindings on a Raspberry Pi (Raspbian Wheezy party upgraded to Jessie), on Python3.4 under venv, I get
undefined symbol: iso14443b_crc
when importing the module.Apparently the libnfc header file contains
iso14443b_crc()
, butlibnfc.so.5
doesn't:Should I report this to libnfc's Debian packager or is this an issue with nfc-binding?