Giter Club home page Giter Club logo

Comments (7)

yhirose avatar yhirose commented on June 13, 2024 1

I installed Ubuntu 16.04 on VirtualBox on my MacBook. I am now able to reproduce the problem.

I googled and found some helpful information:
http://stackoverflow.com/questions/15311469/throwing-an-exception-from-stdcall-once
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60662
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58929

According to the suggestion on the above, I tried the following and it worked!

g++ -I .. -std=c++11 calc.cc -pthread

Could you please try it again with -pthread?

from cpp-peglib.

mattulbrich avatar mattulbrich commented on June 13, 2024 1

It works!

The resulting executable now links against libpthread.so.0.
Astonishingly, no linker error was produced due to a missing function pointer in __gthread_once, this seems to be deferred to runtime.

Thank you very much for finding this out!

from cpp-peglib.

yhirose avatar yhirose commented on June 13, 2024

@mattulbrich, thanks for the report.

I have tried 'g++ -I .. -std=c++11 calc.cc' and 'clang++ -I .. -std=c++11 calc.cc' on my MacBook. But both worked fine, gave me '14' as a result.

Which OS or environment are you working on?

Thank you!

from cpp-peglib.

mattulbrich avatar mattulbrich commented on June 13, 2024

Thanks for looking into it!
I was running (x)Ubuntu 14.04 at the time, but have now updated to Ubuntu 16.04. I still receive the same problem

$ ./a.out 2+3*4
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
Aborted (core dumped)
$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Also on another (opensuse) machine with g++ (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064] I get the same error message.

from cpp-peglib.

mattulbrich avatar mattulbrich commented on June 13, 2024

And I can provide a stacktrace for you. Perhaps it helps a little ...

(gdb) bt
#0  0x00007ffff72400a7 in raise () from /lib64/libc.so.6
#1  0x00007ffff7241458 in abort () from /lib64/libc.so.6
#2  0x00007ffff7b32975 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#3  0x00007ffff7b309f6 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x00007ffff7b30a41 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x00007ffff7b30c58 in __cxa_throw () from /usr/lib64/libstdc++.so.6
#6  0x00007ffff7b86dbf in std::__throw_system_error(int) () from /usr/lib64/libstdc++.so.6
#7  0x000000000041590a in std::call_once<peg::DefinitionReference::get_rule() const::{lambda()#1}>(std::once_flag&, peg::DefinitionReference::get_rule() const::{lambda()#1}&&) (__once=..., __f=<unknown type in /amd.home/home/i57/mulbrich/tmp/cpp-peglib-master/example/a.out, CU 0x15b, DIE 0x5f779>)
    at /usr/include/c++/4.8/mutex:794
#8  0x0000000000408684 in peg::DefinitionReference::get_rule (this=0x66fba8) at ../peglib.h:1485
#9  0x0000000000409df0 in peg::ParserGenerator::DetectLeftRecursion::visit (this=0x7fffffffd8d0, ope=...) at ../peglib.h:1744
#10 0x0000000000408a00 in peg::DefinitionReference::accept (this=0x66fba8, v=...) at ../peglib.h:1507

from cpp-peglib.

yhirose avatar yhirose commented on June 13, 2024

Thanks for the good report!

from cpp-peglib.

aixi avatar aixi commented on June 13, 2024

very helpful, I encounter a bug in protobuf::Message::DebugString(), this function will call std::call_once and throw std::system_error

from cpp-peglib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.