public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65255] New: std::thread does not work for cross compiling on ARM
@ 2015-02-28 22:54 yyc1992 at gmail dot com
  2015-02-28 23:49 ` [Bug c++/65255] " yyc1992 at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: yyc1992 at gmail dot com @ 2015-02-28 22:54 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-08-11 18:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-28 22:54 [Bug c++/65255] New: std::thread does not work for cross compiling on ARM yyc1992 at gmail dot com
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

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).