All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] dlopen of libnative fails
@ 2011-04-29  9:24 martin mangard
  2011-04-29 11:03 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: martin mangard @ 2011-04-29  9:24 UTC (permalink / raw)
  To: xenomai

Hello,

I installed xenomai Version 2.5.6 on a x86 machine. I use dlopen in
order to use the xenomai libraries.


    hXenomai=dlopen("/usr/lib/libxenocalls-2.5.6.so",RTLD_NOW);
    if(!hXenomai)
	{
        fprintf (stderr, "%s\n", dlerror());
        fflush(stderr);
	}


dlopen aborts with the error: "/usr/lib/libnative.so.3: undefined
symbol: xeno_current_mode_key"

I configured xenomai with the option " --enable-dlopen-skins "

What do I have to change in order be able to dlopen the libnative.so.3 library?

Martin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] dlopen of libnative fails
  2011-04-29  9:24 [Xenomai-help] dlopen of libnative fails martin mangard
@ 2011-04-29 11:03 ` Gilles Chanteperdrix
  2011-04-29 12:30   ` martin mangard
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2011-04-29 11:03 UTC (permalink / raw)
  To: martin mangard; +Cc: xenomai

martin mangard wrote:
> Hello,
> 
> I installed xenomai Version 2.5.6 on a x86 machine. I use dlopen in
> order to use the xenomai libraries.
> 
> 
>     hXenomai=dlopen("/usr/lib/libxenocalls-2.5.6.so",RTLD_NOW);
>     if(!hXenomai)
> 	{
>         fprintf (stderr, "%s\n", dlerror());
>         fflush(stderr);
> 	}
> 
> 
> dlopen aborts with the error: "/usr/lib/libnative.so.3: undefined
> symbol: xeno_current_mode_key"
> 
> I configured xenomai with the option " --enable-dlopen-skins "
> 
> What do I have to change in order be able to dlopen the libnative.so.3 library?

xeno_current_mod_key is defined in the libxenomai.so library. So, we
have two solutions:

either we make explicit the dependence between libnative.so and
libxenomai.so, as in the following patch:

index 3497f90..23beb50 100644
--- a/src/skins/native/Makefile.am
+++ b/src/skins/native/Makefile.am
@@ -2,6 +2,8 @@ lib_LTLIBRARIES = libnative.la
 
 libnative_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 3:0:0 -lpthread
 
+libnative_la_LIBADD = ../common/libxenomai.la
+
 libnative_la_SOURCES = \
 	alarm.c \
 	buffer.c \
diff --git a/src/skins/native/Makefile.in b/src/skins/native/Makefile.in
index 2775661..011f380 100644
--- a/src/skins/native/Makefile.in
+++ b/src/skins/native/Makefile.in
@@ -58,7 +58,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(libdir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libnative_la_LIBADD =
+libnative_la_DEPENDENCIES = ../common/libxenomai.la
 am_libnative_la_OBJECTS = libnative_la-alarm.lo libnative_la-buffer.lo \
 	libnative_la-cond.lo libnative_la-event.lo \
 	libnative_la-heap.lo libnative_la-init.lo libnative_la-intr.lo \
@@ -249,6 +249,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libnative.la
 libnative_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 3:0:0 -lpthread
+libnative_la_LIBADD = ../common/libxenomai.la
 libnative_la_SOURCES = \
 	alarm.c \
 	buffer.c \

I am not sure it will not break the parallel build though it does not
seem to break on a core i7 (make -j 8).

Or you explicitly dlopen libxenomai.so with RTLD_GLOBAL before dlopening
libnative.so. The drawback being that you pollute the process namespace
with libxenomai symbols.

-- 
                                                                Gilles.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] dlopen of libnative fails
  2011-04-29 11:03 ` Gilles Chanteperdrix
@ 2011-04-29 12:30   ` martin mangard
  0 siblings, 0 replies; 3+ messages in thread
From: martin mangard @ 2011-04-29 12:30 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Wow
That was fast! Thanks a lot!
The patch works for me.

On Fri, Apr 29, 2011 at 1:03 PM, Gilles Chanteperdrix
<gilles.chanteperdrix@xenomai.org> wrote:
> martin mangard wrote:
>> Hello,
>>
>> I installed xenomai Version 2.5.6 on a x86 machine. I use dlopen in
>> order to use the xenomai libraries.
>>
>>
>>     hXenomai=dlopen("/usr/lib/libxenocalls-2.5.6.so",RTLD_NOW);
>>     if(!hXenomai)
>>       {
>>         fprintf (stderr, "%s\n", dlerror());
>>         fflush(stderr);
>>       }
>>
>>
>> dlopen aborts with the error: "/usr/lib/libnative.so.3: undefined
>> symbol: xeno_current_mode_key"
>>
>> I configured xenomai with the option " --enable-dlopen-skins "
>>
>> What do I have to change in order be able to dlopen the libnative.so.3 library?
>
> xeno_current_mod_key is defined in the libxenomai.so library. So, we
> have two solutions:
>
> either we make explicit the dependence between libnative.so and
> libxenomai.so, as in the following patch:
>
> index 3497f90..23beb50 100644
> --- a/src/skins/native/Makefile.am
> +++ b/src/skins/native/Makefile.am
> @@ -2,6 +2,8 @@ lib_LTLIBRARIES = libnative.la
>
>  libnative_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 3:0:0 -lpthread
>
> +libnative_la_LIBADD = ../common/libxenomai.la
> +
>  libnative_la_SOURCES = \
>        alarm.c \
>        buffer.c \
> diff --git a/src/skins/native/Makefile.in b/src/skins/native/Makefile.in
> index 2775661..011f380 100644
> --- a/src/skins/native/Makefile.in
> +++ b/src/skins/native/Makefile.in
> @@ -58,7 +58,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
>  am__installdirs = "$(DESTDIR)$(libdir)"
>  libLTLIBRARIES_INSTALL = $(INSTALL)
>  LTLIBRARIES = $(lib_LTLIBRARIES)
> -libnative_la_LIBADD =
> +libnative_la_DEPENDENCIES = ../common/libxenomai.la
>  am_libnative_la_OBJECTS = libnative_la-alarm.lo libnative_la-buffer.lo \
>        libnative_la-cond.lo libnative_la-event.lo \
>        libnative_la-heap.lo libnative_la-init.lo libnative_la-intr.lo \
> @@ -249,6 +249,7 @@ top_builddir = @top_builddir@
>  top_srcdir = @top_srcdir@
>  lib_LTLIBRARIES = libnative.la
>  libnative_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 3:0:0 -lpthread
> +libnative_la_LIBADD = ../common/libxenomai.la
>  libnative_la_SOURCES = \
>        alarm.c \
>        buffer.c \
>
> I am not sure it will not break the parallel build though it does not
> seem to break on a core i7 (make -j 8).
>
> Or you explicitly dlopen libxenomai.so with RTLD_GLOBAL before dlopening
> libnative.so. The drawback being that you pollute the process namespace
> with libxenomai symbols.
>
> --
>                                                                Gilles.
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-29 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29  9:24 [Xenomai-help] dlopen of libnative fails martin mangard
2011-04-29 11:03 ` Gilles Chanteperdrix
2011-04-29 12:30   ` martin mangard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.