All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Christian Volk <linux.kernel@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Errors while static linking of Xenomai
Date: Wed, 23 Jul 2008 19:15:36 +0200	[thread overview]
Message-ID: <48876738.2020403@domain.hid> (raw)
In-Reply-To: <200807230917.m6N9H0tZ028205@domain.hid>

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.



  reply	other threads:[~2008-07-23 17:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  9:17 [Xenomai-help] Errors while static linking of Xenomai Christian Volk
2008-07-23 17:15 ` Philippe Gerum [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48876738.2020403@domain.hid \
    --to=rpm@xenomai.org \
    --cc=linux.kernel@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.