Segmentation fault on import caused by dlopen

Hello everyone,

I have been downgrading Xenomai recently. My configuration is now:
- Ubuntu 12.04
- Linux Kernel 2.6.37
- Xenomai 2.5.6
- GCC 4.4
- ROS Fuerte
- Orocos Toolchain 2.6

I configured Xenomai with the --enable-dlopen-skins option.
I have been testing the deployer with a single "import" command on a dummy
component. To my surprise, I got this error:

0.040 [ ERROR ][Logger] could not load library
'/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos/xenomai/./types/librtt-transport-mqueue-xenomai.so':
/usr/xenomai/lib/libpthread_rt.so.1: undefined symbol: shm_unlink
0.040 [ Warning][Logger] Some found plugins could not be loaded !
0.040 [ Warning][Logger] Corrupted files found in
'/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos'. Fix
or remove these plugins.
0.110 [ Info ][DeploymentComponent::import] Importing directory
/home/alex/ros_workspace/dummy/lib/orocos/xenomai ...
0.110 [ Debug ][DeploymentComponent::import] Scanning file
/home/alex/ros_workspace/dummy/lib/orocos/xenomai/plugins ...not a regular
file: ignored.
Segmentation error (core dumped)

Here is the backtrace:

#0 0x00003216 in ?? ()
#1 0xb6097546 in __init_posix_interface () from
/usr/xenomai/lib/libpthread_rt.so.1
#2 0xb7815e9b in ?? () from /lib/ld-linux.so.2
#3 0xb7815f84 in ?? () from /lib/ld-linux.so.2
#4 0xb7819f96 in ?? () from /lib/ld-linux.so.2
#5 0xb7815cbf in ?? () from /lib/ld-linux.so.2
#6 0xb78197e4 in ?? () from /lib/ld-linux.so.2
#7 0xb7012be9 in ?? () from /lib/i386-linux-gnu/libdl.so.2
#8 0xb7815cbf in ?? () from /lib/ld-linux.so.2
#9 0xb701333a in ?? () from /lib/i386-linux-gnu/libdl.so.2
#10 0xb7012c97 in dlopen () from /lib/i386-linux-gnu/libdl.so.2
#11 0xb779812c in RTT::ComponentLoader::loadInProcess (this=0x832c918,
file=..., libname=..., log_error=true)
at
/home/alex/ros_workspace/orocos/orocos_toolchain/rtt/rtt/deployment/ComponentLoader.cpp:678

I never had this problem on Xenomai 2.6. Maybe it comes from the fact that
I used a former version of GCC that I had (I used to run GCC 4.6), but I
installed GCC4.4 because the 4.6 couldn't compile the linux 2.6.37 kernel
(which is a documented issue).

Any ideas?

Thanks in advance

Ruben Smits's picture

Segmentation fault on import caused by dlopen

Op woensdag 26 juni 2013 schreef Flavian Hautbois (f [dot] hautbois [..] ...)
het volgende:

> Hello everyone,
>
> I have been downgrading Xenomai recently. My configuration is now:
> - Ubuntu 12.04
> - Linux Kernel 2.6.37
> - Xenomai 2.5.6
> - GCC 4.4
> - ROS Fuerte
> - Orocos Toolchain 2.6
>
> I configured Xenomai with the --enable-dlopen-skins option.
> I have been testing the deployer with a single "import" command on a dummy
> component. To my surprise, I got this error:
>
> 0.040 [ ERROR ][Logger] could not load library
> '/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos/xenomai/./types/librtt-transport-mqueue-xenomai.so':
> /usr/xenomai/lib/libpthread_rt.so.1: undefined symbol: shm_unlink
> 0.040 [ Warning][Logger] Some found plugins could not be loaded !
> 0.040 [ Warning][Logger] Corrupted files found in
> '/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos'. Fix
> or remove these plugins.
> 0.110 [ Info ][DeploymentComponent::import] Importing directory
> /home/alex/ros_workspace/dummy/lib/orocos/xenomai ...
> 0.110 [ Debug ][DeploymentComponent::import] Scanning file
> /home/alex/ros_workspace/dummy/lib/orocos/xenomai/plugins ...not a regular
> file: ignored.
> Segmentation error (core dumped)
>
> Here is the backtrace:
>
> #0 0x00003216 in ?? ()
> #1 0xb6097546 in __init_posix_interface () from
> /usr/xenomai/lib/libpthread_rt.so.1
> #2 0xb7815e9b in ?? () from /lib/ld-linux.so.2
> #3 0xb7815f84 in ?? () from /lib/ld-linux.so.2
> #4 0xb7819f96 in ?? () from /lib/ld-linux.so.2
> #5 0xb7815cbf in ?? () from /lib/ld-linux.so.2
> #6 0xb78197e4 in ?? () from /lib/ld-linux.so.2
> #7 0xb7012be9 in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #8 0xb7815cbf in ?? () from /lib/ld-linux.so.2
> #9 0xb701333a in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #10 0xb7012c97 in dlopen () from /lib/i386-linux-gnu/libdl.so.2
> #11 0xb779812c in RTT::ComponentLoader::loadInProcess (this=0x832c918,
> file=..., libname=..., log_error=true)
> at
> /home/alex/ros_workspace/orocos/orocos_toolchain/rtt/rtt/deployment/ComponentLoader.cpp:678
>
> I never had this problem on Xenomai 2.6. Maybe it comes from the fact that
> I used a former version of GCC that I had (I used to run GCC 4.6), but I
> installed GCC4.4 because the 4.6 couldn't compile the linux 2.6.37 kernel
> (which is a documented issue).
>
> Any ideas?
>
>
Could it be that you have old libs lying around?

Ruben

> Thanks in advance
>
> --
> F. Hautbois
>

Segmentation fault on import caused by dlopen

Hi Ruben,

I got rid of everything that was about Xenomai 2.6.2. I also made sure the
library called was the right one.
I made sure that shm_unlink was effectively in kallsyms (so it's not
undefined), I also created a dummy program that used it and didn't have any
problem running.

Even more disturbing: I made a small program consisting in:
> dlopen(/home/alex/ros_workspace/
orocos/orocos_toolchain/install/lib/orocos/xenomai/./types/librtt-transport-mqueue-xenomai.so,
RTLD_NOW, RTLD_GLOBAL)

(which is exactly what fails in Orocos)

and this succeeded...

I must be missing something.

2013/6/26 Ruben Smits <ruben [dot] smits [..] ...>

>
>
> Op woensdag 26 juni 2013 schreef Flavian Hautbois (f [dot] hautbois [..] ...)
> het volgende:
>
> Hello everyone,
>>
>> I have been downgrading Xenomai recently. My configuration is now:
>> - Ubuntu 12.04
>> - Linux Kernel 2.6.37
>> - Xenomai 2.5.6
>> - GCC 4.4
>> - ROS Fuerte
>> - Orocos Toolchain 2.6
>>
>> I configured Xenomai with the --enable-dlopen-skins option.
>> I have been testing the deployer with a single "import" command on a
>> dummy component. To my surprise, I got this error:
>>
>> 0.040 [ ERROR ][Logger] could not load library
>> '/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos/xenomai/./types/librtt-transport-mqueue-xenomai.so':
>> /usr/xenomai/lib/libpthread_rt.so.1: undefined symbol: shm_unlink
>> 0.040 [ Warning][Logger] Some found plugins could not be loaded !
>> 0.040 [ Warning][Logger] Corrupted files found in
>> '/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos'. Fix
>> or remove these plugins.
>> 0.110 [ Info ][DeploymentComponent::import] Importing directory
>> /home/alex/ros_workspace/dummy/lib/orocos/xenomai ...
>> 0.110 [ Debug ][DeploymentComponent::import] Scanning file
>> /home/alex/ros_workspace/dummy/lib/orocos/xenomai/plugins ...not a regular
>> file: ignored.
>> Segmentation error (core dumped)
>>
>> Here is the backtrace:
>>
>> #0 0x00003216 in ?? ()
>> #1 0xb6097546 in __init_posix_interface () from
>> /usr/xenomai/lib/libpthread_rt.so.1
>> #2 0xb7815e9b in ?? () from /lib/ld-linux.so.2
>> #3 0xb7815f84 in ?? () from /lib/ld-linux.so.2
>> #4 0xb7819f96 in ?? () from /lib/ld-linux.so.2
>> #5 0xb7815cbf in ?? () from /lib/ld-linux.so.2
>> #6 0xb78197e4 in ?? () from /lib/ld-linux.so.2
>> #7 0xb7012be9 in ?? () from /lib/i386-linux-gnu/libdl.so.2
>> #8 0xb7815cbf in ?? () from /lib/ld-linux.so.2
>> #9 0xb701333a in ?? () from /lib/i386-linux-gnu/libdl.so.2
>> #10 0xb7012c97 in dlopen () from /lib/i386-linux-gnu/libdl.so.2
>> #11 0xb779812c in RTT::ComponentLoader::loadInProcess (this=0x832c918,
>> file=..., libname=..., log_error=true)
>> at
>> /home/alex/ros_workspace/orocos/orocos_toolchain/rtt/rtt/deployment/ComponentLoader.cpp:678
>>
>> I never had this problem on Xenomai 2.6. Maybe it comes from the fact
>> that I used a former version of GCC that I had (I used to run GCC 4.6), but
>> I installed GCC4.4 because the 4.6 couldn't compile the linux 2.6.37 kernel
>> (which is a documented issue).
>>
>> Any ideas?
>>
>>
> Could it be that you have old libs lying around?
>
> Ruben
>
>
>
>
>> Thanks in advance
>>
>> --
>> F. Hautbois
>>
>
>
> --
> Ruben Smits, Phd
> Chief Technology Officer
> Intermodalics BVBA
> +32479511786
> www.intermodalics.eu
>

Segmentation fault on import caused by dlopen

I finally figured out what the problem was. When compiling, rtt uses the
"xeno-config" binary to retrieve the xenomai linking flags. However, ocl
does _not_ seem to use them (at least on my system) to build the
deployer-xenomai binary. Instead the libraries path seem to be hard coded
and some flags (such as -lpthread_rt) are not included. I had to rerun the
make command for deployer-xenomai and add `usr/xenomai/bin.xeno-config
--skin=posix --ldflags`in it.
This is strange because I didn't have this problem on Xenomai 2.6.2.1.
Should I file a bug report for it?

Flavian Hautbois

2013/6/27 Flavian Hautbois <f [dot] hautbois [..] ...>

> Hi Ruben,
>
> I got rid of everything that was about Xenomai 2.6.2. I also made sure the
> library called was the right one.
> I made sure that shm_unlink was effectively in kallsyms (so it's not
> undefined), I also created a dummy program that used it and didn't have any
> problem running.
>
> Even more disturbing: I made a small program consisting in:
> > dlopen(/home/alex/ros_workspace/
> orocos/orocos_toolchain/install/lib/orocos/xenomai/./types/librtt-transport-mqueue-xenomai.so,
> RTLD_NOW, RTLD_GLOBAL)
>
> (which is exactly what fails in Orocos)
>
> and this succeeded...
>
> I must be missing something.
>
>
>
> 2013/6/26 Ruben Smits <ruben [dot] smits [..] ...>
>
>>
>>
>> Op woensdag 26 juni 2013 schreef Flavian Hautbois (f [dot] hautbois [..] ...)
>> het volgende:
>>
>> Hello everyone,
>>>
>>> I have been downgrading Xenomai recently. My configuration is now:
>>> - Ubuntu 12.04
>>> - Linux Kernel 2.6.37
>>> - Xenomai 2.5.6
>>> - GCC 4.4
>>> - ROS Fuerte
>>> - Orocos Toolchain 2.6
>>>
>>> I configured Xenomai with the --enable-dlopen-skins option.
>>> I have been testing the deployer with a single "import" command on a
>>> dummy component. To my surprise, I got this error:
>>>
>>> 0.040 [ ERROR ][Logger] could not load library
>>> '/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos/xenomai/./types/librtt-transport-mqueue-xenomai.so':
>>> /usr/xenomai/lib/libpthread_rt.so.1: undefined symbol: shm_unlink
>>> 0.040 [ Warning][Logger] Some found plugins could not be loaded !
>>> 0.040 [ Warning][Logger] Corrupted files found in
>>> '/home/alex/ros_workspace/orocos/orocos_toolchain/install/lib/orocos'. Fix
>>> or remove these plugins.
>>> 0.110 [ Info ][DeploymentComponent::import] Importing directory
>>> /home/alex/ros_workspace/dummy/lib/orocos/xenomai ...
>>> 0.110 [ Debug ][DeploymentComponent::import] Scanning file
>>> /home/alex/ros_workspace/dummy/lib/orocos/xenomai/plugins ...not a regular
>>> file: ignored.
>>> Segmentation error (core dumped)
>>>
>>> Here is the backtrace:
>>>
>>> #0 0x00003216 in ?? ()
>>> #1 0xb6097546 in __init_posix_interface () from
>>> /usr/xenomai/lib/libpthread_rt.so.1
>>> #2 0xb7815e9b in ?? () from /lib/ld-linux.so.2
>>> #3 0xb7815f84 in ?? () from /lib/ld-linux.so.2
>>> #4 0xb7819f96 in ?? () from /lib/ld-linux.so.2
>>> #5 0xb7815cbf in ?? () from /lib/ld-linux.so.2
>>> #6 0xb78197e4 in ?? () from /lib/ld-linux.so.2
>>> #7 0xb7012be9 in ?? () from /lib/i386-linux-gnu/libdl.so.2
>>> #8 0xb7815cbf in ?? () from /lib/ld-linux.so.2
>>> #9 0xb701333a in ?? () from /lib/i386-linux-gnu/libdl.so.2
>>> #10 0xb7012c97 in dlopen () from /lib/i386-linux-gnu/libdl.so.2
>>> #11 0xb779812c in RTT::ComponentLoader::loadInProcess (this=0x832c918,
>>> file=..., libname=..., log_error=true)
>>> at
>>> /home/alex/ros_workspace/orocos/orocos_toolchain/rtt/rtt/deployment/ComponentLoader.cpp:678
>>>
>>> I never had this problem on Xenomai 2.6. Maybe it comes from the fact
>>> that I used a former version of GCC that I had (I used to run GCC 4.6), but
>>> I installed GCC4.4 because the 4.6 couldn't compile the linux 2.6.37 kernel
>>> (which is a documented issue).
>>>
>>> Any ideas?
>>>
>>>
>> Could it be that you have old libs lying around?
>>
>> Ruben
>>
>>
>>
>>
>>> Thanks in advance
>>>
>>> --
>>> F. Hautbois
>>>
>>
>>
>> --
>> Ruben Smits, Phd
>> Chief Technology Officer
>> Intermodalics BVBA
>> +32479511786
>> www.intermodalics.eu
>>
>
>
>
> --
> F. Hautbois
>