Loadlibrary fails in linux

3 views (last 30 days)
Sietse
Sietse on 11 Feb 2014
Commented: Sietse on 11 Feb 2014
I create a shared library in linux as follows.
gcc -c -fPIC -I ../include/PERA_USB_IO rtmotion_usb_conf.c
gcc -shared rtmotion_usb_conf.o -o rtmotion_usb_conf.so
The (shared) library can be used in a C-program like:
#include <stdio.h>
#include <rtmotion_usb_conf.h>
main () {
int x;
x = rtm_usb_init();
printf("x = %d\n",x);
}
but using it in Matlab using:
[notfound,warnings]=loadlibrary('/home/p100213/Systemen/PhilipsRobotArm/MatlabRTMUSB/rtmotion_usb_conf','/home/p100213/rosbuild_ws/PERA_USB_IO/include/PERA_USB_IO/rtmotion_usb_conf.h')
yields the warnings below. And a calllib cannot use this library. What is wrong? As if the environment is different in Matlab.
Thanks in advance,
Sietse
====================== output of diary
rtm_usb_init()
notfound =
Empty cell array: 0-by-1
warnings =
Type '__mbstate_t' was not found. Defaulting to type error.
Found on line 1560 of input from line 26 of file /usr/include/_G_config.h
Type '__mbstate_t' was not found. Defaulting to type error.
Found on line 1565 of input from line 31 of file /usr/include/_G_config.h
Type '__builtin_va_list' was not found. Defaulting to type error.
Found on line 1575 of input from line 40 of file /usr/lib/gcc/x86_64-linux-gnu/4.6/include/stdarg.h
No match found for enum value expression sizeof in 15 * sizeof ( int ) - 4 * sizeof ( void *) - sizeof ( size_t ) expression ignored. Found on line 1658 of input from line 340 of file /usr/include/libio.h
Type 'char__signed__' was not found. Defaulting to type error.
Found on line 2339 of input from line 19 of file /usr/include/asm-generic/int-ll64.h
Type 'short__signed__' was not found. Defaulting to type error.
Found on line 2342 of input from line 22 of file /usr/include/asm-generic/int-ll64.h
Type 'int__signed__' was not found. Defaulting to type error.
Found on line 2345 of input from line 25 of file /usr/include/asm-generic/int-ll64.h
Type 'longlong__signed__' was not found. Defaulting to type error.
Found on line 2349 of input from line 29 of file /usr/include/asm-generic/int-ll64.h
ans =
0
  2 Comments
Philip Borghesani
Philip Borghesani on 11 Feb 2014
How do you know those warnings are preventing calls to the library? What error do you get from a calllib call?
calllib('rtmotion_usb_conf','rtm_usb_init')
What is the output of libfunctions rtmotion_usb_conf -full ?
Sietse
Sietse on 11 Feb 2014
I used the command:
success = calllib('/home/p100213/Systemen/PhilipsRobotArm/MatlabRTMUSB/rtmotion_usb_conf', 'rtm_usb_init')
and got:
Error using calllib
Library was not found
Error in rtm_usb_init (line 41)
success = calllib('/home/p100213/Systemen/PhilipsRobotArm/MatlabRTMUSB/rtmotion_usb_conf', 'rtm_usb_init')
BUT changing to the shorter version:
success = calllib('rtmotion_usb_conf', 'rtm_usb_init')
IT RAN OK!!
(apparently the absolute path is a problem?)
Now i will try using the library in earnest.
Thanks for the help!
(still wondering about all the warnings though)

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!