Info

此问题已关闭。 请重新打开它进行编辑或回答。

IMAQ custom adaptor wount register on unix

2 次查看(过去 30 天)
I have written a custom adaptor for the Image Aquisition Toolbox to control an IDS camera. The adaptor compiles and runns successfully on Win10 for R2015b, R2013b and R2010b.
Now I am trying to port it to a unix system (Ubuntu 14.04).[ EDIT: the unix machine uses R2015b] Here I am using g++ to compile the code. My problem is that compilation and linking finish successfully, but the adaptor refuses to load using imaqregister('path/to/myadaptor.so'). This is the error:
Error using imaqregister (line 93)
/home/firefoxmetzger/Documents/ITM/itmcam/build_unix/bin/libitmcam.so is not a valid
adaptor. Was the shared library created using the Image Acquisition Toolbox Adaptor
Kit?
Line 93 calls a .mex file, which probably runs tests on the adaptor. Unfortunately I don't know which of the tests fail / where the problem lies. imaq: not a valid adapter (2) suggests that it might be caused by symbols not being present, which I ruled out. Here are the significant lines of nm -D myadaptor.so:
0000000000015120 T createInstance
0000000000014e70 T getAvailHW
0000000000014fd0 T getDeviceAttributes
0000000000014e60 T initializeAdaptor
0000000000015180 T uninitializeAdaptor
Another potential cause could be that some dynamically linked libraries could not be found on execution time, so I made every link I could static. These are the remaining dynamically linked ones found by ldd myadaptor.so:
linux-vdso.so.1 => (0x00007ffe73f1b000)
libmwimaqmex.so => not found
libueye_api.so => /usr/lib/libueye_api.so (0x00007f026fce2000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f026f9de000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f026f7c8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f026f5a9000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f026f1e4000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f026efdc000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f026edd7000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f026ebc8000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f026e8c2000)
/lib64/ld-linux-x86-64.so.2 (0x000055bfd22df000)
Note that libmwimaqmex.so is missing, but I checked other adaptors currently working on the unix system and found that it is missing there as well. The library also compiles in 64-bit which I confirmed using objdump -f myadaptor.so | grep ^architecture
architecture: i386:x86-64, flags 0x00000150:
From here I am puzzled to what may be the cause of above error. It might be due to me rewriting large parts of the makefile and having forgotten one essential flag during compile / link. I have attached it, just in case.
Any help is much appreciated.
Edit 2: There seems to be a problem with dynamically linked libraries. I tried to compile the demo adaptor, which works fine out of the box. Then I've added the camera's shared library containing the API functions to the demo adaptor (without actually using any functions, just so it is linked).
This will create a dynamic link to said API library from IDS. Suddenly I can't load the adaptor into MATLAB and I get above error. It seems that /usr/lib is not part of the search path for shared libraries.
Update 07/17/16: It is not a path problem. I took the out-of-the-box demo adaptor and added a random library from /usr/lib, in my case libgs.so.6. This did not create an error when trying to load the adaptor in matlab. It seems to be an issue with the camera library from IDS.
Further I tested the IDS library with a different program that uses it. There is no problem loading / unloading / using it, so the problem is likely to be the interaction between MATLAB and the library.
  1 个评论
FirefoxMetzger
FirefoxMetzger 2016-7-12
I might have found the culprit. How can I list the paths seached by the Image Aquisition Toolbox for shared libraries? LD_LIBRARY_PATH doesn't seem to influence it

回答(0 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by