Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Peter A. Bigot" <pab@pabigot.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: Yocto development with C++11 threads and gcc
Date: Wed, 13 Aug 2014 16:36:53 -0500	[thread overview]
Message-ID: <53EBDA75.4040101@pabigot.com> (raw)
In-Reply-To: <53EBD76A.3010401@pabigot.com>

On 08/13/2014 04:23 PM, Peter A. Bigot wrote:
> On 08/13/2014 04:18 PM, Khem Raj wrote:
>> On Mon, Aug 11, 2014 at 12:02 PM, Peter A. Bigot <pab@pabigot.com> 
>> wrote:
>>> The program below built on the target with the MACHINE=beaglebone 
>>> gcc-4.9.1
>>> compiler from Yocto/OpenEmbedded poky master produces this error:
>>>
>>> beaglebone[52]$ g++ -std=c++1y -pthread test.cc && ./a.out
>>> starting
>>> joining
>>> pure virtual method called
>>> terminate called without an active exception
>>> Aborted (core dumped)
>>>
>>> When the program is recompiled with the defines for
>>> __GCC_HAVE_SYNC_COMPARE_AND_SWAP_X enabled as suggested at
>>> https://groups.google.com/d/msg/automatak-dnp3/Jisp_zGhd5I/ck_Cj6nO8joJ 
>>> it
>>> works:
>>>
>>> beaglebone[53]$ g++ -std=c++1y -pthread test.cc && ./a.out
>>> starting
>>> joining
>>> doit
>>> done
>>>
>>> Preliminary analysis confirms that the built-ins for those defines 
>>> are not
>>> being added by the compiler because it thinks the target doesn't 
>>> support
>>> those operations.  Nonetheless, it doesn't use the substitutes that are
>>> obviously available.
>>>
>>> Can anybody recall anything about the way GCC is built under OE that 
>>> would
>>> explain this?
>> Can you add -mcpu=cortex-a8 to your cmdline and see if it solves the 
>> problem ?
>
> Yes, it does.  That's a good clue.

More specifically, the build logs say gcc-runtime was built with:

arm-poky-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork 
-mfloat-abi=hard -mfpu=neon -mtune=cortex-a8

and using those flags instead of -mcpu=cortex-a8 also solves the problem.

So either gcc-runtime needs to stop using those flags, or gcc itself 
needs to default to them.  Or some other solution.

In any case, Khem can you run with this?  It'd be fixed a lot better 
that way....

Peter

>
> Peter
>
>>> Peter
>>>
>>> /* g++ -std=c++1y -pthread test.cc && ./a.out */
>>> #if 0
>>> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
>>> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
>>> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
>>> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
>>> #endif
>>>
>>> #include <iostream>
>>> #include <thread>
>>>
>>> void
>>> doit ()
>>> {
>>>    std::cerr << "doit\n";
>>> }
>>>
>>> int main (int argc,
>>>            char * argv [])
>>> {
>>>    std::cerr << "starting\n";
>>>    std::thread thr{doit};
>>>    std::cerr << "joining\n";
>>>    thr.join();
>>>    std::cerr << "done\n";
>>>    return 0;
>>> }
>>>
>>> -- 
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>



  reply	other threads:[~2014-08-13 21:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 19:02 Yocto development with C++11 threads and gcc Peter A. Bigot
2014-08-12  0:12 ` Peter A. Bigot
2014-08-13 21:07   ` Peter A. Bigot
2014-08-13 21:18 ` Khem Raj
2014-08-13 21:23   ` Peter A. Bigot
2014-08-13 21:36     ` Peter A. Bigot [this message]
2014-08-13 22:05       ` Khem Raj
2014-08-13 23:23         ` Peter A. Bigot
2014-08-14  0:49           ` Khem Raj
2014-08-14  1:55             ` Peter A. Bigot
2014-08-14  5:32               ` Khem Raj
2014-08-14  9:15                 ` Peter A. Bigot
2014-08-14 21:40                   ` Richard Purdie
2014-08-14 22:00                     ` Peter A. Bigot
2014-08-14 22:11                       ` Khem Raj
2014-08-14 22:07                   ` Khem Raj

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=53EBDA75.4040101@pabigot.com \
    --to=pab@pabigot.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /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