Hello.  I'm new to this list and new to Xenomai.  I am getting the
following when trying to build Xenomai 2.2.3:

cyclictest.elf2flt(.text+0x4946): In function `_pthread_key_delete':
: undefined reference to `___wrap_pthread_mutex_lock'
cyclictest.elf2flt(.text+0x4970): In function `_pthread_key_delete':
: undefined reference to `___wrap_pthread_mutex_unlock'
cyclictest.elf2flt(.text+0x49c8): In function `_pthread_key_delete':
: undefined reference to `___wrap_pthread_mutex_unlock'
cyclictest.elf2flt(.text+0x49e8): In function `_pthread_key_create':
: undefined reference to `___wrap_pthread_mutex_lock'
cyclictest.elf2flt(.text+0x4a10): In function `_pthread_key_create':
: undefined reference to `___wrap_pthread_mutex_unlock'
cyclictest.elf2flt(.text+0x4a2e): In function `_pthread_key_create':
: undefined reference to `___wrap_pthread_mutex_unlock'
collect2: ld returned 1 exit status

The problem seems to be that the version of libpthread.a that I am
using makes reference to the pthread_mutex_lock and
pthread_mutex_unlock functions from a couple of places including
pthread_key_create and pthread_key_delete.

Since the Posix testsuite programs link libpthread after
libpthread_rt, these references (which are defined in libpthread_rt)
cannot be resolved.  I don't know if these calls are recent additions
or what, but the uClibc/libpthread and libpthread_rt libraries are
mutually dependent on each other.

I don't know enough about what is going on with the Xenomai Posix skin
to figure out the right way to fix this problem, but the attached
patch fixes the build failures by passing the --start-group linker
flag, forcing ld to resolve circular references for all subsequent
object files.    I know it's not great but it gets me going.  You have
to rerun automake to get the changes.

Applying the patch makes it build but the testsuites for the Posix
skin don't seem to work.  For example, here is what I get when trying
to run cyclictest:
 root:/usr/xenomai/testsuite/cyclic> ./cyclictest
 Xenomai Posix skin init: pthread_atfork: Unknown error -1

The native testsuites seem to function as expected.

Does anyone have any ideas what the issue is?

Here is my platform specs:
  - Blackfin BF537-STAMP
  - uClinux R06R1-RC2 with corresponding toolchain
  - gcc4.1.0

Xenomai configure was run per the README like so:
$XENOMAI_DIR/configure --build=i686-pc-linux-gnu
--host=bfinnommu-unknown-linux-gnu CC=bfin-uclinux-gcc
CXX=bfin-uclinux-gcc AR=bfin-uclinux-ar LD=bfin-uclinux-ld

Also, it would appear that Xenomai releases post 2.2.3 will not run on
an unpatched uClinux R06R1-RC2.  The problem seems to be that some
macros were added to the newer kernel for addressing various
peripherals.  Xenomai > 2.2.3 uses these macros which are not defined
in this official uClinux release.  It would be nice to note something
to this effect in the readme.



Terry Laurenzo
Redcode Technologies
diff -Naur xenomai-2.2.3.orig/src/testsuite/cyclic/Makefile.am xenomai-2.2.3/src/testsuite/cyclic/Makefile.am
--- xenomai-2.2.3.orig/src/testsuite/cyclic/Makefile.am	2006-09-15 08:18:08.000000000 -0600
+++ xenomai-2.2.3/src/testsuite/cyclic/Makefile.am	2006-11-12 16:59:59.000000000 -0700
@@ -6,7 +6,7 @@
 cyclictest_CPPFLAGS = -I$(top_srcdir)/include/posix $(XENO_USER_CFLAGS) -DIPIPE_TRACE=1 -I$(top_srcdir)/include
+cyclictest_LDFLAGS = $(XENO_POSIX_WRAPPERS) $(XENO_USER_LDFLAGS) -Wl,--start-group
 cyclictest_LDADD = \
 	../../skins/posix/.libs/libpthread_rt.a -lpthread -lrt
diff -Naur xenomai-2.2.3.orig/src/testsuite/irqbench/Makefile.am xenomai-2.2.3/src/testsuite/irqbench/Makefile.am
--- xenomai-2.2.3.orig/src/testsuite/irqbench/Makefile.am	2006-09-15 08:18:08.000000000 -0600
+++ xenomai-2.2.3/src/testsuite/irqbench/Makefile.am	2006-11-12 16:57:40.000000000 -0700
@@ -16,7 +16,7 @@
 irqloop_LDFLAGS = \
+	$(XENO_USER_LDFLAGS) -Wl,--start-group
 irqloop_LDADD = \
 	../../skins/posix/.libs/libpthread_rt.a -lpthread
diff -Naur xenomai-2.2.3.orig/src/testsuite/switchtest/Makefile.am xenomai-2.2.3/src/testsuite/switchtest/Makefile.am
--- xenomai-2.2.3.orig/src/testsuite/switchtest/Makefile.am	2006-09-17 08:59:29.000000000 -0600
+++ xenomai-2.2.3/src/testsuite/switchtest/Makefile.am	2006-11-12 16:57:40.000000000 -0700
@@ -6,7 +6,7 @@
 switchtest_CPPFLAGS = -I$(top_srcdir)/include/posix $(XENO_USER_CFLAGS) -g -I$(top_srcdir)/include
+switchtest_LDFLAGS =  $(XENO_POSIX_WRAPPERS) $(XENO_USER_LDFLAGS) -Wl,--start-group
 switchtest_LDADD = \
 	../../skins/posix/.libs/libpthread_rt.a	-lpthread -lrt

Xenomai-core mailing list

Reply via email to