* [Xenomai-core] Undefined reference to ___wrap_pthread_mutex_lock and friends on Blackfin
@ 2006-11-13 0:13 Terry Laurenzo
2006-11-13 8:58 ` Gilles Chanteperdrix
0 siblings, 1 reply; 4+ messages in thread
From: Terry Laurenzo @ 2006-11-13 0:13 UTC (permalink / raw)
To: xenomai
[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]
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
--disable-shared
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.
Thanks!
--
Regards,
Terry Laurenzo
Redcode Technologies
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xenomai-2.2.3.patch --]
[-- Type: text/x-patch; name="xenomai-2.2.3.patch", Size: 1814 bytes --]
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)
+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_POSIX_WRAPPERS) \
- $(XENO_USER_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)
+switchtest_LDFLAGS = $(XENO_POSIX_WRAPPERS) $(XENO_USER_LDFLAGS) -Wl,--start-group
switchtest_LDADD = \
../../skins/posix/.libs/libpthread_rt.a -lpthread -lrt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-core] Undefined reference to ___wrap_pthread_mutex_lock and friends on Blackfin
2006-11-13 0:13 [Xenomai-core] Undefined reference to ___wrap_pthread_mutex_lock and friends on Blackfin Terry Laurenzo
@ 2006-11-13 8:58 ` Gilles Chanteperdrix
2006-11-13 9:40 ` Philippe Gerum
2006-11-13 16:39 ` Terry Laurenzo
0 siblings, 2 replies; 4+ messages in thread
From: Gilles Chanteperdrix @ 2006-11-13 8:58 UTC (permalink / raw)
To: Terry Laurenzo; +Cc: xenomai
Terry Laurenzo wrote:
> 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.
The problem is that pthread_key_create and pthread_key_delete should use
the libpthread.a versions of pthread_mutex_lock and pthread_mutex_unlock
not xenomai versions. In order to avoid this, you have to do the
link-edit in two stages: first do a partial link with libpthread_rt.a
with the --wrap options, second a final link with libpthread.a without
the --wrap options.
>
> 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
Maybe pthread_atfork is not working at all on uclibc ?
>
> 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
> --disable-shared
>
> 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.
What macros ?
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-core] Undefined reference to ___wrap_pthread_mutex_lock and friends on Blackfin
2006-11-13 8:58 ` Gilles Chanteperdrix
@ 2006-11-13 9:40 ` Philippe Gerum
2006-11-13 16:39 ` Terry Laurenzo
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2006-11-13 9:40 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
On Mon, 2006-11-13 at 09:58 +0100, Gilles Chanteperdrix wrote:
[...]
> > 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.
>
> What macros ?
>
Not related to the POSIX skin, but rather to the HAL/SAL Xenomai layers.
These are MMIO register accessors which were not defined in earlier
Blackfin kernel versions, including the official R06R1-RC2 release.
Since I'm tracking the Blackfin CVS, I've updated the Xenomai codebase
to use them, but this prevents to compile Xenomai against earlier
kernels.
--
Philippe.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [Xenomai-core] Undefined reference to ___wrap_pthread_mutex_lock and friends on Blackfin
2006-11-13 8:58 ` Gilles Chanteperdrix
2006-11-13 9:40 ` Philippe Gerum
@ 2006-11-13 16:39 ` Terry Laurenzo
1 sibling, 0 replies; 4+ messages in thread
From: Terry Laurenzo @ 2006-11-13 16:39 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
On 11/13/06, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
> Terry Laurenzo wrote:
> > 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.
>
> The problem is that pthread_key_create and pthread_key_delete should use
> the libpthread.a versions of pthread_mutex_lock and pthread_mutex_unlock
> not xenomai versions. In order to avoid this, you have to do the
> link-edit in two stages: first do a partial link with libpthread_rt.a
> with the --wrap options, second a final link with libpthread.a without
> the --wrap options.
Since this is an issue in the main build of xenomai, any suggestions
on what the proper fix is? Should libpthread be linked with
libpthread_rt during the main library build or just for the individual
(testsuite) programs that use it? Does anyone have an example of some
additions to the Automake rules to carry out this two step process?
> > 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
>
> Maybe pthread_atfork is not working at all on uclibc ?
uclibc does not have a working fork, so I can't imagine that this
behavior is required. I think that the problem, however, is in the
way that I "solved" the build problem. Now, since libpthread is
linking against the libpthread_rt wrapped version of mutex_lock and
mutex_unlock, it is potentially causing problems since the internals
of libpthread were supposed to link against the unwrapped versions.
This will probably fix itself if the link-edit step is inserted
correctly.
Thanks for the replies.
Terry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-13 16:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-13 0:13 [Xenomai-core] Undefined reference to ___wrap_pthread_mutex_lock and friends on Blackfin Terry Laurenzo
2006-11-13 8:58 ` Gilles Chanteperdrix
2006-11-13 9:40 ` Philippe Gerum
2006-11-13 16:39 ` Terry Laurenzo
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.