Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] core: add option to force compiling C++ as C++11
Date: Sat, 28 Nov 2015 01:24:30 +0100	[thread overview]
Message-ID: <5658F43E.70103@mind.be> (raw)
In-Reply-To: <20151126214314.278f4531.agalakhov@gmail.com>

On 26-11-15 21:43, Alexey Galakhov wrote:
> Dear Thomas,
> 
>> I am not familiar with C++ issues, can you give some more details and
>> specific examples here ?
> 
> This is more or less a toolchain issue. Consider we're building a C++
> library with a class declaration in *.h and its implementation in
> *.cpp. Compilation with a C++03 compiler results in the generation of
> several functions corresponding to class methods. Compilation with a
> C++11 compiler gives two additional functions, corresponding to the
> move constructor and the move assignment operator (new features of
> C++11).
> 
> If a C++ library is compiled with an C++03 compiler (that is the
> default when using g++), its object files won't contain the
> implementations of these new methods. The library is then unusable for
> C++11 compiler. In the worst case we have to recompile all the
> libraries in the system with a C++11 compiler.
> 
> Example linker error is:
> 
> In function log4cplus::detail::macros_get_logger(log4cplus::Logger&&)':
> /usr/include/log4cplus/loggingmacros.h:106: undefined reference
> tolog4cplus::Logger::Logger(log4cplus::Logger&&)'
> 
> This function is only generated when compiling in C++11 mode. It does
> not exist in C++03 mode.
> 
> To clarify: This is NOT an error inside buildroot! This only happens if
> compiling some 3rd-party or proprietary code against previously
> compiled buildroot system. If I want to compile my program with
> --std=c++11, I have to compile buildroot with --std=c++11 as well.

 Well, we _have_ packages that build with --std=c++11 or similar, and that use
boost. For example pulseview. So I would think we would see build failures there
as well.

 Point is: if this is a problem for external code, it will also be a problem for
buildroot packages. So we have to find a way to solve it fundamentally.

> 
> 
>> I don't think it is appropriate for Buildroot to have an option to be
>> enabled "if you encounter <foo> errors". If there is a problem, it
>> should be fixed properly, without having to rely on the user enabling
>> (or not enabling) a given option.
> 
> Unfortunately, there is no "proper" solution. An alternative solution
> could be compiling most of the C++ libraries twice and thus providing
> two versions of each *.so file, one for C++03 and C++11. We could also
> try to make this option on per-package basis, but this should be then
> done in every library package using C++ and would be confusing.

 We're definitely not going to build everything twice. We might make packages
like glibmm that add the --std=c++11 option select the BR2_ENABLE_CPP11 option,
for example.


 Regards,
 Arnout

> 
> The proper help text would probably be something like this:
> """
>   Enable this option if you need the move-semantics implementation in  
>   the shared C++ libraries of buildroot. I.e., if you want to link your
>   own C++11 applications against them and the linker complains about
>   non-existing move constructor.
> """
> 
> Regards,
> Alexey
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

  reply	other threads:[~2015-11-28  0:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 14:50 [Buildroot] [PATCH 1/1] core: add option to force compiling C++ as C++11 Alexey Galakhov
2015-11-26 16:51 ` Thomas Petazzoni
2015-11-26 20:43   ` Alexey Galakhov
2015-11-28  0:24     ` Arnout Vandecappelle [this message]
2015-11-28 11:06       ` Alexey Galakhov
2015-11-28  0:33 ` Arnout Vandecappelle

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=5658F43E.70103@mind.be \
    --to=arnout@mind.be \
    --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