liblabjackusb.so: undefined symbol: DigitalIO | LabJack
 

liblabjackusb.so: undefined symbol: DigitalIO

4 posts / 0 new
Last post
llarose
llarose's picture
liblabjackusb.so: undefined symbol: DigitalIO

I got an installation and library issue.

I followed these installation steps for an installation on ubuntu 16.04.
https://labjack.com/support/software/installers/exodriver/mac-and-linux/...

The following code brings me to an undefined symbol for DigitalIO in the liblabjackusb.so

$ python
>>> import u12
>>> d =u12.U12()
>>> d.digitalIO(idNum=-1, demo=0, trisD=3, trisIO=0, stateD=0, stateIO=0, updateDigital=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/u12.py", line 2506, in digitalIO
    def getFirmwareVersion(self, idNum=None):
  File "/usr/lib/python2.7/ctypes/__init__.py", line 375, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 380, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/local/lib/liblabjackusb.so: undefined symbol: DigitalIO

I was looking around for the DigitalIO implementation and i found it in ljacklm.h and ljacklm.c.

$cd ljacklm/libljacklm
$ nm ljacklm.o | grep DigitalIO
0000000000007489 T DigitalIO
$ nm libljacklm.so.1.20.2 | grep DigitalIO
00000000000091a9 T DigitalIO

This shows that the lib was generated correctly.

How come u12.py loads the liblabjackusb.so since it does not have the DigitalIO function declaration and implementation ?
(see u12.py line 348) . Should the function _loadLinuxSo() load libljacklm.so instead of liblabjackusb.so !?

It this a bug ?

Does anyone have encounter this ?

LabJack Support
LabJack Support's picture
U12 support in the

U12 support in the LabJackPython u12 module was implemented before ljacklm was available, and currently only uses labjackusb (Exodriver). Functions from ljacklm, such as DigitalIO, are unavailable in the u12 module on MacOS and Linux. Use the raw version, rawDIO, instead. The U12 module description discusses UW, "e", and low-level (raw) functions.

https://github.com/labjack/LabJackPython/blob/master/src/u12.py

llarose
llarose's picture
Hi 

Hi 

Thank for your great answer. 

We choose labjack for its python support since it a easy portable language between OS (Window, Ubuntu, etc)
This issues can be mark as a bug that you guys needs to fix to follow the principle of portable library in python. 

Your proposal is a workaround that breaks our internal tool portability. 

We have open an thread about this in stack overflow : 
https://stackoverflow.com/questions/46206357/liblabjackusb-so-undefined-...

And I've opened a issue in your github project : 
https://github.com/labjack/LabJackPython/issues/100

LabJack Support
LabJack Support's picture
If you need an immediate

If you need an immediate solution, you may want to do something like this:

if sys.platform.startswith("win32"):
    #Use DigitalIO
else:
    #Use rawDIO

There is no timeline on when I can look into updating the u12 module, but maybe soon.