OpenBSD eg ++ 4.9.3:启用多线程以使用std :: thread:不允许操作

时间:2017-03-24 12:10:30

标签: multithreading c++11 g++ pthreads openbsd

当尝试使用来自ports树的g ++(例如++)在OpenBSD上编译ansvif(一个fuzzer)时,一切都配置好并编译好,直到我在需要线程的地方实际运行程序。

我尝试像这样编译:

AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.15 aclocal
AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.15 autoconf
AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.15 automake -a
CXX=/usr/ports/pobj/gcc-4.9.3/bin/eg++ ./configure
make

然后我得到:

terminate called after throwing an instance of 'std::system_error'
what():  Enable multithreading to use std::thread: Operation not permitted
Abort trap (core dumped)

这似乎只能在 OpenBSD 6.0 上使用g ++ 4.9.3从 ports 重现。您无法使用内置的g ++编译代码,因为代码需要C ++ 11。

回溯看起来像这样:

GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd6.0".
Core was generated by `ansvif'.
Program terminated with signal 6, Aborted.
#0  0x00000a5d2326029a in ?? ()
(gdb) bt
#0  0x00000a5d2326029a in ?? ()
#1  0x00000a5d23274039 in ?? ()
#2  0x00000a5d23280c0a in ?? ()
#3  0x00000a5a441cea80 in ?? ()
#4  0xffffffdf00000202 in ?? ()
#5  0xf296d56c8d2c4acf in ?? ()
#6  0x00000a5c54dc0198 in ?? ()
#7  0x00000a5a43d8b165 in ?? ()
#8  0x0000000000000000 in ?? ()

在Linux和Windows下使用相同的编译和工作(使用MinGW)。

我已经阅读了一些类似的问题,说它是一个编译器错误,但是他们在SO上为它提供的hacky'修复'似乎没有帮助(在这种情况下使用-Wl,--no-as-needed)。

1 个答案:

答案 0 :(得分:1)

您将代码与MediaType.APPLICAITON_XML相关联。您应该使用libstdc++代替。