Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [autobuild.buildroot.net] Daily results for 2020-09-10
Date: Fri, 11 Sep 2020 23:23:22 +0200	[thread overview]
Message-ID: <20200911212322.GC10548@scaer> (raw)
In-Reply-To: <5136b645-f8c9-36f5-5dbc-eeba060cba30@heine.tech>

Micheal, All,

On 2020-09-11 23:12 +0200, Michael Nosthoff spake thusly:
> >>>>>On 11.09.2020 09:08, Thomas Petazzoni wrote:
> >>>>>>   mips64el   |        host-grpc-1.31.0        | NOK | http://autobuild.buildroot.net/results/b554f6f2fb66892273f7520ad6e36923557b229e |
[--SNIP--]
> I did some further testing using a fresh docker container `ubuntu:trusty`.
> I derived a simple test which mirrors the failing code in [1].
> If you compile this code using `g++ --std=c++11 main.cpp -lpthread -o
> thread_test`
> 
> ```
> #include <thread>
> #include <cassert>
> 
> main() {
> ? ??? std::thread::id runner;
> ??? auto me = std::this_thread::get_id();
> 
> ??? assert(runner != me);
> }
> ```
> 
> running the resulting program will throw the assert. Doing the identical
> thing in a `debian:jessie` container with g++-4.8 will finish successfully.
> 
> What's happening in this code? When pthreads is not linked glibc's
> implementation of std::thread::id is used.
> But this has a bug that it can't differentiate between a default initialized
> id and the result of the get_id() call when you have no threading.
> This is addressed in [0] which lead to a fix in gcc-6.
> 
> But we are linking with -lpthread. So this bug should not affect us. So when
> I try to actually create a thread like
> 
> ```
> std::thread worker([](){});
> ```
> 
> I get a crash when running the program. Which proves that pthread is not
> actually linkend. Doing the same on debian yields a working program.
> Even when I compile the program on debian and copy it to ubuntu the program
> runs successfully. So it is not a runtime thing.
> 
> When I change the compiler flag to -pthread I suddenly get a working program
> on ubuntu.

Whoa! Great investigation! ?

> This brings me to two possible solutions:
> 
> - find out why in ubuntu:trusty -lpthread is not working

Is it a bug in gcc-4.8 that is not fixed in Ubuntu but is in Debian? Or
is it a patch that Ubuntu applies that Debian does not?

> - ensure that protobuf uses -pthread instead of -lpthread (i have to check
> what is cmake decides to use on other compilers).
> 
> I'll check this next week.

Thanks! This is really very much appreciated! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2020-09-11 21:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11  7:08 [Buildroot] [autobuild.buildroot.net] Daily results for 2020-09-10 Thomas Petazzoni
2020-09-11  7:29 ` Michael Nosthoff
2020-09-11  8:15   ` Thomas Petazzoni
2020-09-11 12:27     ` Yann E. MORIN
2020-09-11 13:18       ` Michael Nosthoff
2020-09-11 14:21         ` Yann E. MORIN
2020-09-11 21:12           ` Michael Nosthoff
2020-09-11 21:23             ` Yann E. MORIN [this message]
2020-09-15 14:15               ` Michael Nosthoff

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=20200911212322.GC10548@scaer \
    --to=yann.morin.1998@free.fr \
    --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