public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yyc1992 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65255] New: std::thread does not work for cross compiling on ARM
Date: Sat, 28 Feb 2015 22:54:00 -0000	[thread overview]
Message-ID: <bug-65255-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65255

            Bug ID: 65255
           Summary: std::thread does not work for cross compiling on ARM
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com

Created attachment 34903
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34903&action=edit
PKGBUILD used to compile the cross compiling version of gcc

Duplicate of the problem reported in the comment of #42734. However, IMHO, that
bug was tracking a different issue and it should be better to open a new bug
for this one although the error message produced at runtime are very similar.

See attached file for the script used to compile the cross-compiler
(CHOST=x86_64-unknown-linux-gnu).

Minimum source that produces the problem
```
#include <thread>

int
main()
{
    std::thread([] {}).join();
    return 0;
}
```

When compiling with `arm-linux-gnueabihf-g++` on x86_64 and run on arm, it
throws an runtime error

```
pure virtual method called
terminate called without an active exception
Aborted (core dumped)
```

However, the error disappeared if run with gdb....

The same source works on the host machine (x86_64), with clang cross compiling
on ARM and with both clang and gcc natively compiled on ARM. Adding `-latomic`
as suggested in #42734 does not help either and is also not needed using the
native compiler on arm.

Command line option used to compile:
gcc cross compile:
    arm-linux-gnueabihf-g++ -pthread -std=c++14 -Os -Wall -Wextra thread.cpp -o
thread-arm
clang cross compile:
    clang++ --target=arm-linux-gnueabihf -pthread -std=c++14 -Os -Wall -Wextra
thread.cpp -o thread-arm_clang -I
/usr/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf
gcc native compile (on ARM):
    g++ -pthread -std=c++14 -Os -Wall -Wextra thread.cpp -o thread-arm_native
clang native compile (on ARM):
    clang++ -pthread -std=c++14 -Os -Wall -Wextra thread.cpp -o
thread-arm_native_clang

I'll try to upload the binaries (if they are allowed) or the output of `objdump
-S` (if I cannot upload binaries).


             reply	other threads:[~2015-02-28 21:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28 22:54 yyc1992 at gmail dot com [this message]
2015-02-28 23:49 ` [Bug c++/65255] " yyc1992 at gmail dot com
2015-08-11  7:13 ` pinskia at gcc dot gnu.org
2015-08-11 12:11 ` yyc1992 at gmail dot com
2015-08-11 17:56 ` redi at gcc dot gnu.org
2015-08-11 18:00 ` redi at gcc dot gnu.org
2015-08-11 18:04 ` yyc1992 at gmail dot com

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=bug-65255-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).