How to use libueye_api.so version 4.91 with ROS Melodic?
I am using ROS Melodic and ueye api version 4.91.1 Using catkin build the build succeeds without warnings.
I am writing a simple camera listening node for a SICK camera in C++.
I am getting a runtime error whenever the is_InitCamera(&hCam)
command is present somewhere in the code. When I remove that command from code then there is no runtime error.
The error is not raised by this command, but by the ros::init(argc, argv, "my_camera_handler");
command.
gdb gives the following output:
(gdb) where
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff6459801 in __GI_abort () at abort.c:79
#2 0x00007ffff64a2897 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff65cfb9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007ffff64a990a in malloc_printerr (str=str@entry=0x7ffff65d17a8 "munmap_chunk(): invalid pointer") at malloc.c:5350
#4 0x00007ffff64b0ecc in munmap_chunk (p=0x555555772ce0) at malloc.c:2846
#5 __GI___libc_free (mem=0x555555772cf0) at malloc.c:3117
#6 0x00007ffff6eb4440 in ros::file_log::init(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&) () from /opt/ros/melodic/lib/libroscpp.so
#7 0x00007ffff6edc141 in ros::init(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) () from /opt/ros/melodic/lib/libroscpp.so
#8 0x00007ffff6edea8c in ros::init(int&, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) () from /opt/ros/melodic/lib/libroscpp.so
#9 0x00005555555568a0 in main (argc=1, argv=0x7fffffffdc28) at /home/timo/ros/catkin_ws/src/driverless-system-v2/cameras/camera_test/src/main.cpp:6
I have tried using the 4.80.2 version of the ueye library and that worked fine, but since I am developing for a 64 bit ARM system which only has a 4.91 version available then I can't use the older version outside of development.
The library commands themselves are working, but the problem is with ros::init
command.
Changing the order of the commands hasn't changed the result.
main.cpp
#include "ros/ros.h"
#include "ueye.h"
int main(int argc, char **argv)
{
ros::init(argc, argv, "my_camera_handler");
ros::NodeHandle n;
HIDS hCam = 1;
INT nRet = is_InitCamera(&hCam, NULL);
return 0;
}
CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(camera_test)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
message_generation
std_msgs
roslib
)
catkin_package(
CATKIN_DEPENDS message_runtime roscpp rospy std_msgs roslib
)
include_directories(
${catkin_INCLUDE_DIRS}
include/
)
add_executable(camera_handler
src/main.cpp
)
target_link_libraries(camera_handler ${PROJECT_SOURCE_DIR}/lib/amd_64_4_91/libueye_api.so ${catkin_LIBRARIES})
add_dependencies(camera_handler ${catkin_EXPORTED_TARGETS})
EDIT 1: The error given by rosrun:
munmap_chunk(): invalid pointer
Aborted (core dumped)
The error given by gdb:
(gdb) run
Starting program: /home/timo/ros/catkin_ws/devel/lib/camera_test/camera_handler
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
munmap_chunk(): invalid pointer
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory
EDIT 2: The libueye_api.so seems to use following libraries:
$ ldd libueye_api.so
linux-vdso.so.1 (0x00007fff430a2000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4942294000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f494208c000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4941e88000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4941c69000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f4941a3a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f494169c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4941484000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4941093000)
$ readelf -d libueye_api.so
Dynamic section at offset 0x8867a8 contains 29 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [librt.so.1]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libgomp.so.1]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname: [libueye_api.so]
0x000000000000000c (INIT) 0xd9528
0x000000000000000d (FINI) 0x741428
0x0000000000000004 (HASH) 0x1f0
0x000000006ffffef5 (GNU_HASH) 0x13d0
0x0000000000000005 (STRTAB) 0x5770
0x0000000000000006 (SYMTAB) 0x1d50
0x000000000000000a (STRSZ) 13016 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0xa86fe8
0x0000000000000002 (PLTRELSZ) 7632 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0xd7758
0x0000000000000007 (RELA) 0x90d0
0x0000000000000008 (RELASZ) 845448 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x8f20
0x000000006fffffff (VERNEEDNUM) 8
0x000000006ffffff0 (VERSYM) 0x8a48
0x000000006ffffff9 (RELACOUNT) 28147
0x0000000000000000 (NULL) 0x0
I don't see boost anywhere in there. Is it possible that there is a conflict with one of the other libraries?
Asked by Timo.Loomets on 2019-05-15 07:45:31 UTC
Comments
which error specifically? You never show it.
Asked by gvdhoorn on 2019-05-15 08:09:19 UTC
re: edit: this could be a ABI incompatibility between the ueye library and some library linked in by your ROS node.
Does the ueye library use a different version of Boost fi (strong candidate)?
Asked by gvdhoorn on 2019-05-15 09:25:36 UTC