Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv2] core: alternate solution to disable C++
Date: Tue, 27 Mar 2018 14:43:39 +0200	[thread overview]
Message-ID: <20180327144339.23542eb9@windsurf.home> (raw)
In-Reply-To: <20180327111234.kf2qvwnyo5svpfpu@sapphire.tkos.co.il>

Hello,

On Tue, 27 Mar 2018 15:04:32 +0300, Baruch Siach wrote:
> Hi Yann,
> 
> On Tue, Mar 27, 2018 at 01:00:22PM +0200, Yann E. MORIN wrote:
> > Some packages that use libtool really need some love to be able to
> > disable C++ support.
> > 
> > This is because libtool will want to call AC_PROG_CXXCPP as soon as CXX
> > is set non-empty to something different from 'no'. Then, AC_PROG_CXXCPP
> > will want a C++ preprocessor that works on valid input *and* fail on
> > invalid input.
> > 
> > So, providing 'false' as the C++ compiler will then require that we do
> > have a working C++ preprocessor. Which is totally counter-productive
> > since we do not have a C++ compiler to start with...
> > 
> > bd39d11d2e (core/infra: fix build on toolchain without C++) was a
> > previous attempt at fixing this, by using the host's C++ preprocessor.
> > 
> > However, that is very incorrect (that's my code, I can say so!) because
> > the set of defines will most probably be different for the host and the
> > target, thus causign all sorts of trouble. For example, on ARM we'd have
> > to include different headers for soft-float vs hard-float, which is
> > decided based on a macro, which is not defined for x86, and thus may
> > redirect to the wrong (and missing) header.
> > 
> > Instead, we notice that libtool uses the magic value 'no' to decide that
> > a C++ compiler is not available, in which case it skeips the call to

skeips -> skips


> > +# We need anything that is invalid. Traditionally, we'd have used 'false' (and
> > +# we did so in the past). However, that breaks libtool for packages that have
> > +# optional C++ support (e.g. gnutls), because libtool will *require* a *valid*
> > +# C++ preprocessor as long as CXX is not 'no'.
> > +# Now, whether we use 'no' or 'false' for CXX as the same side effect: it is an
> > +# invalid C++ compiler, and thus will cause detection of C++ to fail (which is
> > +# expected and what we want), while at the same time taming libtool into
> > +# silence.
> >  ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
> > -TARGET_CONFIGURE_OPTS += CXX=false CXXCPP=cpp
> > +TARGET_CONFIGURE_OPTS += CXX=no  
> 
> What about CXXCPP? Your v1 patch set it to 'no'.

I think Yann's commit log explains it: if you specify CXX=no, then
libtool will not try to search for a C++ pre-processor, hence it is no
longer necessary to pass CXXCPP. At least that's my understanding of
Yann's commit log.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-03-27 12:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 11:00 [Buildroot] [PATCHv2] core: alternate solution to disable C++ Yann E. MORIN
2018-03-27 12:04 ` Baruch Siach
2018-03-27 12:43   ` Thomas Petazzoni [this message]
2018-03-27 17:49     ` Yann E. MORIN
2018-03-27 19:40 ` Peter Seiderer
2018-03-28 22:08   ` Arnout Vandecappelle
2018-03-29 16:25     ` Peter Seiderer
2018-03-30 12:25 ` Peter Korsgaard
2018-03-31  6:25 ` Peter Korsgaard
2018-04-07 15:41 ` Peter Korsgaard

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=20180327144339.23542eb9@windsurf.home \
    --to=thomas.petazzoni@bootlin.com \
    --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