* [Xenomai-help] Errors while static linking of Xenomai
@ 2008-07-23 9:17 Christian Volk
2008-07-23 17:15 ` Philippe Gerum
0 siblings, 1 reply; 5+ messages in thread
From: Christian Volk @ 2008-07-23 9:17 UTC (permalink / raw)
To: xenomai
Hi,
when I try to compile Xenomai and link it satically i get some 'undefined reference' errors while compiling the cyclictest programm from the testsuite.
I'm using Xenomai 2.4.4 with uclibc and try to compile for a ppc-arch board (Freescale MPC8343 processor).
Heres the line which I use to configure Xenomai:
./configure --host=powerpc-generic-linux-uclibc CC=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-gcc CXX=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-g++ LD=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-ld --enable-shared=no LDFLAGS=--static
And thats the output I get when compiling cyclictest:
Making install in cyclic
make[3]: Entering directory `/home/develop/Download/xenomai-2.4.4/src/testsuite/cyclic'
/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I../../../src/include -I../../../include/posix -O2 -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -D__IN_XENO__ -Wstrict-prototypes -DIPIPE_TRACE=1 -I../../../include -MT cyclictest-cyclictest.o -MD -MP -MF .deps/cyclictest-cyclictest.Tpo -c -o cyclictest-cyclictest.o `test -f 'cyclictest.c' || echo './'`cyclictest.c
mv -f .deps/cyclictest-cyclictest.Tpo .deps/cyclictest-cyclictest.Po
/bin/sh ../../../libtool --tag=CC --mode=link /opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-gcc -Wl,@/home/develop/Download/xenomai-2.4.4/src/skins/posix/posix.wrappers --static -o cyclictest cyclictest-cyclictest.o ../../skins/posix/libpthread_rt.la -lpthread -lrt
mkdir .libs
/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-gcc -Wl,@/home/develop/Download/xenomai-2.4.4/src/skins/posix/posix.wrappers --static -o cyclictest cyclictest-cyclictest.o ../../skins/posix/.libs/libpthread_rt.a -lpthread -lrt
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x3f4): undefined reference to `__wrap_pthread_condattr_destroy'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x3f8): undefined reference to `__wrap_pthread_condattr_init'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x3fc): undefined reference to `__wrap_pthread_cond_broadcast'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x400): undefined reference to `__wrap_pthread_cond_destroy'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x404): undefined reference to `__wrap_pthread_cond_init'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x408): undefined reference to `__wrap_pthread_cond_signal'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x40c): undefined reference to `__wrap_pthread_cond_wait'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(pthread.os):(.data.rel+0x464): undefined reference to `__wrap_pthread_cond_timedwait'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(mutex.os): In function `__pthread_once_fork_child':
mutex.c:(.text+0x1fc): undefined reference to `__wrap_pthread_cond_init'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(mutex.os): In function `pthread_once':
mutex.c:(.text+0x490): undefined reference to `__wrap_pthread_cond_wait'
mutex.c:(.text+0x534): undefined reference to `__wrap_pthread_cond_broadcast'
/opt/powerpc-linux-uclibc/powerpc-generic-linux-uclibc/sys-root/usr/lib/libpthread.a(mutex.os): In function `pthread_once_cancelhandler':
mutex.c:(.text+0x58c): undefined reference to `__wrap_pthread_cond_broadcast'
collect2: ld returned 1 exit status
make[3]: *** [cyclictest] Fehler 1
Any hints and/or help to solve this problem is appreciated.
Thanks in advance.
regards,
Christian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Errors while static linking of Xenomai
2008-07-23 9:17 [Xenomai-help] Errors while static linking of Xenomai Christian Volk
@ 2008-07-23 17:15 ` Philippe Gerum
2008-07-23 17:40 ` Christian Volk
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2008-07-23 17:15 UTC (permalink / raw)
To: Christian Volk; +Cc: xenomai
Christian Volk wrote:
> Hi,
>
> when I try to compile Xenomai and link it satically i get some 'undefined reference' errors while compiling the cyclictest programm from the testsuite.
> I'm using Xenomai 2.4.4 with uclibc and try to compile for a ppc-arch board (Freescale MPC8343 processor).
>
> Heres the line which I use to configure Xenomai:
> ./configure --host=powerpc-generic-linux-uclibc CC=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-gcc CXX=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-g++ LD=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-ld --enable-shared=no LDFLAGS=--static
>
Fully static builds will likely not work with the current Makefiles, I'm afraid.
To achieve that, one would have to follow a two-stage linking approach, partial
linking with the application and wrappers first, then final linking of the
previous object with the standard libs - like libpthread - without wrapping.
This has already be done for certain applications and is known to work.
Due to static linking, what happens here is that the linker sees therefore binds
pthread_* calls issued from the standard pthread library to Xenomai symbols...
which are wrappers shadowing the standard pthread_* calls... Bad idea. The point
is that the -Wl,<wrappers> directive should not appear on the link command line
for static builds when standard glibc/libpthread are listed here as well.
This said, those errors compiling the Xenomai stack should only happen with
POSIX apps from the testsuite because the Makefiles there do not account for
fully static builds and wrapping woes, but you can safely ignore them, provided
you do two-stage linking for your own apps. This is one of the rare cases where
make -k may help...
--
Philippe.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Errors while static linking of Xenomai
2008-07-23 17:15 ` Philippe Gerum
@ 2008-07-23 17:40 ` Christian Volk
2008-07-28 9:56 ` Gilles Chanteperdrix
0 siblings, 1 reply; 5+ messages in thread
From: Christian Volk @ 2008-07-23 17:40 UTC (permalink / raw)
To: rpm; +Cc: xenomai
During the day we found a "workaround" or maybe a fix.
I will post details tomorrow from work.
We used -Wl,"-(" archives -Wl,"-)" so we built a start-group - end-group
Construct which fixed all issues.
Thanks for your answer Philippe, this will help me while creating my own
apps.
Christian
-----Ursprüngliche Nachricht-----
Von: Philippe Gerum [mailto:rpm@xenomai.org
Gesendet: Mittwoch, 23. Juli 2008 19:16
An: Christian Volk
Cc: xenomai@xenomai.org
Betreff: Re: [Xenomai-help] Errors while static linking of Xenomai
Christian Volk wrote:
> Hi,
>
> when I try to compile Xenomai and link it satically i get some 'undefined
reference' errors while compiling the cyclictest programm from the
testsuite.
> I'm using Xenomai 2.4.4 with uclibc and try to compile for a ppc-arch
board (Freescale MPC8343 processor).
>
> Heres the line which I use to configure Xenomai:
> ./configure --host=powerpc-generic-linux-uclibc
CC=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-gcc
CXX=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-g++
LD=/opt/powerpc-linux-uclibc/bin/powerpc-generic-linux-uclibc-ld
--enable-shared=no LDFLAGS=--static
>
Fully static builds will likely not work with the current Makefiles, I'm
afraid.
To achieve that, one would have to follow a two-stage linking approach,
partial
linking with the application and wrappers first, then final linking of the
previous object with the standard libs - like libpthread - without wrapping.
This has already be done for certain applications and is known to work.
Due to static linking, what happens here is that the linker sees therefore
binds
pthread_* calls issued from the standard pthread library to Xenomai
symbols...
which are wrappers shadowing the standard pthread_* calls... Bad idea. The
point
is that the -Wl,<wrappers> directive should not appear on the link command
line
for static builds when standard glibc/libpthread are listed here as well.
This said, those errors compiling the Xenomai stack should only happen with
POSIX apps from the testsuite because the Makefiles there do not account for
fully static builds and wrapping woes, but you can safely ignore them,
provided
you do two-stage linking for your own apps. This is one of the rare cases
where
make -k may help...
--
Philippe.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] Errors while static linking of Xenomai
2008-07-23 17:40 ` Christian Volk
@ 2008-07-28 9:56 ` Gilles Chanteperdrix
0 siblings, 0 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2008-07-28 9:56 UTC (permalink / raw)
To: Christian Volk; +Cc: xenomai
Christian Volk wrote:
> During the day we found a "workaround" or maybe a fix.
> I will post details tomorrow from work.
> We used -Wl,"-(" archives -Wl,"-)" so we built a start-group - end-group
> Construct which fixed all issues.
>
> Thanks for your answer Philippe, this will help me while creating my own
> apps.
It would be interesting if we could apply your fix to Xenomai makefiles.
Could you give us a little bit more details ?
--
Gilles.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Errors while static linking of Xenomai
@ 2008-07-28 14:39 Christian Volk
0 siblings, 0 replies; 5+ messages in thread
From: Christian Volk @ 2008-07-28 14:39 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
Hi all,
sry for my delayed answer.
So what We've actually done was to rewrite the gcc commands for compiling the posix stuff in the testsuite:
Original:
powerpc-generic-linux-uclibc-gcc -Wl,@/home/develop/Download/xenomai-2.4.4/src/skins/posix/posix.wrappers --static -o switchtest switchtest-switchtest.o ../../skins/posix/.libs/libpthread_rt.a -lpthread -lrt
Our fix:
powerpc-generic-linux-uclibc-gcc -Wl,@/home/develop/Download/xenomai-2.4.4/src/skins/posix/posix.wrappers --static -o switchtest -Wl,"-(" switchtest-switchtest.o ../../skins/posix/.libs/libpthread_rt.a -lpthread -lrt -Wl,"-)"
We inserted the -Wl,"-(" ... -Wl,"-)" construct around the linker stuff, so it trys to solve all dependencies in all directions.
The errors only occur while compiling the testsuite.
regards,
Christian
----- original Nachricht --------
Betreff: Re: [Xenomai-help] Errors while static linking of Xenomai
Gesendet: Mo, 28. Jul 2008
Von: Gilles Chanteperdrix<gilles.chanteperdrix@xenomai.org>
> Christian Volk wrote:
> > During the day we found a "workaround" or maybe a fix.
> > I will post details tomorrow from work.
> > We used -Wl,"-(" archives -Wl,"-)" so we built a start-group - end-group
> > Construct which fixed all issues.
> >
> > Thanks for your answer Philippe, this will help me while creating my own
> > apps.
>
> It would be interesting if we could apply your fix to Xenomai makefiles.
> Could you give us a little bit more details ?
>
> --
> Gilles.
>
--- original Nachricht Ende ----
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-28 14:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 9:17 [Xenomai-help] Errors while static linking of Xenomai Christian Volk
2008-07-23 17:15 ` Philippe Gerum
2008-07-23 17:40 ` Christian Volk
2008-07-28 9:56 ` Gilles Chanteperdrix
-- strict thread matches above, loose matches on Subject: below --
2008-07-28 14:39 Christian Volk
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.