Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörg Krause" <joerg.krause@embedded.rocks>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/3] package/multicat: fix build with external Blackfin uClibc toolchain
Date: Sun, 20 Mar 2016 18:09:47 +0100	[thread overview]
Message-ID: <1458493787.1998.14.camel@embedded.rocks> (raw)
In-Reply-To: <20160320152212.54caaaa6@free-electrons.com>

On So, 2016-03-20 at 15:22 +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Sun, 20 Mar 2016 00:41:46 +0100, J?rg Krause wrote:
> > 
> > multicat uses clock_nanosleep() conditionally if HAVE_NANOSLEEP is
> > defined. The
> > bad is that multicat does not check for clock_nanosleep(), but
> > defines
> "bad .." ?

Oops, bad English.

> > 
> > HAVE_NANOSLEEP if __APPLE__ is not defined.
> > 
> > uClibc has clock_nanosleep() only if built with
> > UCLIBC_HAS_ADVANCED_REALTIME.
> > and the external Blackfin toolchain has no support for
> > clock_nanosleep().
> Are you sure? Here the Blackfin toolchain does have
> UCLIBC_HAS_ADVANCED_REALTIME:
> 
> $ grep ADVANCED_REALTIME
> output/staging/usr/include/bits/uClibc_config.h?
> #define __UCLIBC_HAS_ADVANCED_REALTIME__ 1
> 
> But indeed it doesn't have clock_nanosleep().

You're right! It has?__UCLIBC_HAS_ADVANCED_REALTIME__, but it does not
define?__UCLIBC_HAS_THREADS_NATIVE__ and clock_nanosleep() is only
defined if both are set in <time.h>:

#??ifdef __UCLIBC_HAS_THREADS_NATIVE__
#???if defined __USE_XOPEN2K && defined
__UCLIBC_HAS_ADVANCED_REALTIME__

extern int clock_nanosleep (clockid_t __clock_id, int __flags,
			????__const struct timespec *__req,
			????struct timespec *__rem);

However the Blackfin toolchain has __LINUXTHREADS_OLD__:
#define __LINUXTHREADS_OLD__ 1

Sorry, my bad!

> 
> When I saw your patch, I was hoping to be able to replace it with a
> patch that tests __UCLIBC__ and __UCLIBC_HAS_ADVANCED_REALTIME__ to
> determine whether we have clock_nanosleep() or not. But it seems like
> some other things on Blackfin has the consequence that we don't have
> clock_nanosleep(). I looked at uClibc 0.9.33.2 (which is used in the
> Blackfin toolchain, as far as I can see), and I couldn't see why
> clock_nanosleep() was not provided.
> 

I'll prepare a v2 with something like that testing for __UCLIBC__,
__UCLIBC_HAS_THREADS_NATIVE__ and __UCLIBC_HAS_ADVANCED_REALTIME__.

> > 
> > +# multicat does not test for HAVE_CLOCK_NANOSLEEP, but sets it if
> > __APPLE__ is
> > +# not defined. The external Blackfin toolchain is uClibc which has
> > +# clock_nanosleep() only if built with
> > UCLIBC_HAS_ADVANCED_REALTIME.
> > +# Use a hool to overwrite the definition of HAVE_CLOCK_NANOSLEEP
> > for this
> hool -> hook
> 
> > 
> > +# toolchain.
> > +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX),y)
> > +define MULTICAT_FIXUP_HAVE_CLOCK_NANOSLEEP
> > +$(SED) 's#define HAVE_CLOCK_NANOSLEEP#undef
> > HAVE_CLOCK_NANOSLEEP#g' $(@D)/util.h
> > +endef
> > +MULTICAT_POST_PATCH_HOOKS += MULTICAT_FIXUP_HAVE_CLOCK_NANOSLEEP
> > +endif
> I'll be OK to fix this with a hook, but I'd like to understand why we
> don't have clock_nanosleep() on Blackfin. It might affect a
> significant
> number of other packages I believe.

My guess is that uClibc was build with __LINUXTHREADS_OLD__ enabled,
but the toolchain ships libpthread instead. However, I am not a
toolchain expert.

Best regards
J?rg Krause

  reply	other threads:[~2016-03-20 17:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-19 23:41 [Buildroot] [PATCH 1/3] package/multicat: add patch to fix static build Jörg Krause
2016-03-19 23:41 ` [Buildroot] [PATCH 2/3] package/multicat: add patch to fix musl build Jörg Krause
2016-03-20 14:11   ` Thomas Petazzoni
2016-03-19 23:41 ` [Buildroot] [PATCH 3/3] package/multicat: fix build with external Blackfin uClibc toolchain Jörg Krause
2016-03-20 14:22   ` Thomas Petazzoni
2016-03-20 17:09     ` Jörg Krause [this message]
2016-03-20 17:13       ` Thomas Petazzoni
2016-03-20 14:09 ` [Buildroot] [PATCH 1/3] package/multicat: add patch to fix static build Thomas Petazzoni

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=1458493787.1998.14.camel@embedded.rocks \
    --to=joerg.krause@embedded.rocks \
    --cc=buildroot@busybox.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox