04-17-2020 01:48 PM
Hi Charlie,
See below for the results from running the command with the -r option.
admin@NI-cRIO-9033-01A23322:~# ldd -r /C/ni-rt/startup/data/libHIDAPI.so ldd: warning: you do not have execution permission for `/C/ni-rt/startup/data/libHIDAPI.so'
linux-vdso.so.1 (0x00007ffcb7bd3000)
libc.so.6 => /lib/libc.so.6 (0x00007fd8ca484000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd8caa24000)
undefined symbol: udev_new (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_enumerate_scan_devices (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_unref (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_device_get_parent_with_subsystem_devtype (/C/ni-rt/startup/data/libHI DAPI.so)
undefined symbol: udev_enumerate_new (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_enumerate_add_match_subsystem (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_list_entry_get_next (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_device_new_from_syspath (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_enumerate_get_list_entry (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_device_unref (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_enumerate_unref (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_device_new_from_devnum (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_device_get_sysattr_value (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_list_entry_get_name (/C/ni-rt/startup/data/libHIDAPI.so)
undefined symbol: udev_device_get_devnode (/C/ni-rt/startup/data/libHIDAPI.so)
This is the output of the permissions query/setting. After running the second command, I retried calling the library and got the same result.
admin@NI-cRIO-9033-01A23322:~# ls -l /C/ni-rt/startup/data/libHIDAPI.so
-rw-rw-r-- 1 lvuser ni 121344 Apr 17 02:15 /C/ni-rt/startup/data/libHIDAPI.so
admin@NI-cRIO-9033-01A23322:~# chmod a+x /C/ni-rt/startup/data/libHIDAPI.so
admin@NI-cRIO-9033-01A23322:~# ls -l /C/ni-rt/startup/data/libHIDAPI.so
-rwxrwxr-x 1 lvuser ni 121344 Apr 17 02:15 /C/ni-rt/startup/data/libHIDAPI.so*
04-18-2020 08:28 AM
Follow up responses - this is the output of the nm undefined command:
admin@NI-cRIO-9033-01A23322:~# nm --undefined-only /C/ni-rt/startup/data/libHIDAPI.so
U calloc@@GLIBC_2.2.5
U close@@GLIBC_2.2.5
w __cxa_finalize@@GLIBC_2.2.5
U __errno_location@@GLIBC_2.2.5
U free@@GLIBC_2.2.5
U __fxstat@@GLIBC_2.2.5
w __gmon_start__
U ioctl@@GLIBC_2.2.5
U __isoc99_sscanf@@GLIBC_2.7
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
w _Jv_RegisterClasses
U mbstowcs@@GLIBC_2.2.5
U memset@@GLIBC_2.2.5
U open@@GLIBC_2.2.5
U poll@@GLIBC_2.2.5
U read@@GLIBC_2.2.5
U setlocale@@GLIBC_2.2.5
U strchr@@GLIBC_2.2.5
U strcmp@@GLIBC_2.2.5
U strdup@@GLIBC_2.2.5
U strerror@@GLIBC_2.2.5
U strtok_r@@GLIBC_2.2.5
U strtol@@GLIBC_2.2.5
U __tls_get_addr@@GLIBC_2.3
U udev_device_get_devnode
U udev_device_get_parent_with_subsystem_devtype
U udev_device_get_sysattr_value
U udev_device_new_from_devnum
U udev_device_new_from_syspath
U udev_device_unref
U udev_enumerate_add_match_subsystem
U udev_enumerate_get_list_entry
U udev_enumerate_new
U udev_enumerate_scan_devices
U udev_enumerate_unref
U udev_list_entry_get_name
U udev_list_entry_get_next
U udev_new
U udev_unref
U vsnprintf@@GLIBC_2.2.5
U wcscmp@@GLIBC_2.2.5
U wcsdup@@GLIBC_2.2.5
U wcsncpy@@GLIBC_2.2.5
U write@@GLIBC_2.2.5
Below is the output of the console after running a build in Eclipse.
09:14:47 **** Rebuild of configuration Debug for project HIDAPI ****
Info: Internal Builder is used for build
x86_64-nilrt-linux-gcc "-IC:\\build\\19.0\\oecore-i686-core2-64-toolchain-6.0\\sysroots\\core2-64-nilrt-linux\\usr\\include\\c++\\6.3.0\\x86_64-nilrt-linux" "-IC:\\build\\19.0\\oecore-i686-core2-64-toolchain-6.0\\sysroots\\core2-64-nilrt-linux\\usr\\include\\c++\\6.3.0" "-IC:\\build\\19.0\\oecore-i686-core2-64-toolchain-6.0\\sysroots\\core2-64-nilrt-linux\\usr\\include" -O0 -g3 -Wall -c -fmessage-length=0 "--sysroot=C:\\build\\19.0\\oecore-i686-core2-64-toolchain-6.0\\sysroots\\core2-64-nilrt-linux" -fPIC -o "src\\hid.o" "..\\src\\hid.c"
x86_64-nilrt-linux-gcc "--sysroot=C:\\build\\19.0\\oecore-i686-core2-64-toolchain-6.0\\sysroots\\core2-64-nilrt-linux" -shared -o libHIDAPI.so "src\\hid.o"
09:14:51 Build Finished (took 4s.6ms)
04-20-2020 09:26 AM
Hi Paul,
You need to link libc to resolve open/close/write/etc and libudev to resolve udev_* symbols. They're both located at /lib on NI Linux RT controllers. You can link them by adding the following to your gcc command line: -ludev -lc
04-20-2020 10:16 AM
Haris is correct. You can also do this in Eclipse (though it's a bit of a pain) in the project properties.
04-20-2020 12:46 PM
Well, that seemed to do the trick! Thanks so much for the help!
04-20-2020 01:04 PM
No problem! If you want a different experience than what Eclipse offers, we also recently published a tutorial series for Visual Studio Code. Personally I find the workflow a bit clearer in terms of configuration, but I'm a bit biased on that.
03-29-2021 11:09 AM
I have recently moved to using LabVIEW 2020 - am I going to need to rebuild my library with an updated toolchain if I am running my application in LV2020? If so, is there a link to an updated version of the toolchain? I certainly hope this isn't the case, as having to rebuild an external library file every time we change versions of LabVIEW would be a nightmare.
(I am currently seeing strange behavior that I think may be related to the .so file, trying to figure out if that is the root cause or there is some other problem.)