Closed Beedeebee closed 3 years ago
I can't get cpp-peglib to work on my new system.
I'm using cpp-peglib/master (11ed83e46fb0268c22005a6b8a9f094f8ea7208c), G++ 10.2.0 and/or clang++ 10.0.1, glibc 2.32, on Linux x86_64.
I compiled this minimal piece of code:
#include "cpp-peglib/peglib.h" int main() { peg::parser parser(R"( ROOT <- _ TOKEN (',' _ TOKEN)* TOKEN <- < [a-z0-9]+ > _ _ <- [ \t\r\n]* )"); return 0; }
But it crashes when I run it:
terminate called after throwing an instance of 'std::system_error' what(): Unknown error -1 fish: “./test” terminated by signal SIGABRT (Abort)
Valgrind shows the following stack trace:
==228742== Process terminating with default action of signal 6 (SIGABRT): dumping core ==228742== at 0x4BFE615: raise (in /usr/lib/libc-2.32.so) ==228742== by 0x4BE7861: abort (in /usr/lib/libc-2.32.so) ==228742== by 0x491A869: __gnu_cxx::__verbose_terminate_handler() [clone .cold] (vterminate.cc:95) ==228742== by 0x4926D99: __cxxabiv1::__terminate(void (*)()) (eh_terminate.cc:48) ==228742== by 0x4926E06: std::terminate() (eh_terminate.cc:58) ==228742== by 0x49270AD: __cxa_throw (eh_throw.cc:95) ==228742== by 0x491D9BB: std::__throw_system_error(int) (system_error.cc:338) ==228742== by 0x183309: void std::call_once<peg::Definition::initialize_definition_ids() const::{lambda()#1}>(std::once_flag&, peg::Definition::initialize_definition_ids() const::{lambda()#1}&&) (mutex:743) ==228742== by 0x183156: peg::Definition::initialize_definition_ids() const (peglib.h:2324) ==228742== by 0x182D63: peg::Definition::parse_core(char const*, unsigned long, peg::SemanticValues&, std::any&, char const*) const (peglib.h:2335) ==228742== by 0x180BF2: peg::Definition::parse(char const*, unsigned long, std::any&, char const*) const (peglib.h:2225) ==228742== by 0x125A86: peg::ParserGenerator::perform_core(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (peglib.h:3394)
I can't figure out what's wrong. Any ideas?
Found the issue: I needed to pass -lpthread to the compiler on this system.
-lpthread
Sorry for re-opening a common issue.
I can't get cpp-peglib to work on my new system.
I'm using cpp-peglib/master (11ed83e46fb0268c22005a6b8a9f094f8ea7208c), G++ 10.2.0 and/or clang++ 10.0.1, glibc 2.32, on Linux x86_64.
I compiled this minimal piece of code:
But it crashes when I run it:
Valgrind shows the following stack trace:
I can't figure out what's wrong. Any ideas?