Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception throw fails on macOS with cmake -DV8PP_HEADER_ONLY=0 -DBUILD_SHARED_LIBS=1 #176

Closed
pmed opened this issue Nov 2, 2021 · 1 comment

Comments

@pmed
Copy link
Owner

pmed commented Nov 2, 2021

Causes terminate after __cxxabiv1::failed_throw(). See frame 7 in stack trace:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff2034e92e libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff2037d5bd libsystem_pthread.dylib`pthread_kill + 263
    frame #2: 0x00007fff202d2406 libsystem_c.dylib`abort + 125
    frame #3: 0x00007fff20340ef2 libc++abi.dylib`abort_message + 241
    frame #4: 0x00007fff203325fd libc++abi.dylib`demangling_terminate_handler() + 266
    frame #5: 0x00007fff2022b595 libobjc.A.dylib`_objc_terminate() + 104
    frame #6: 0x00007fff20340307 libc++abi.dylib`std::__terminate(void (*)()) + 8
    frame #7: 0x00007fff20342beb libc++abi.dylib`__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 27
    frame #8: 0x00007fff20342bb2 libc++abi.dylib`__cxa_throw + 116
    frame #9: 0x00000001007eaf32 libv8pp.dylib`v8pp::detail::object_registry<v8pp::raw_ptr_traits>& v8pp::detail::classes::add<v8pp::raw_ptr_traits>(isolate=0x0000000102c25000, type=0x00007ffeefbfe310, dtor=0x00007ffeefbfe360) at class.ipp:284:3
    frame #10: 0x0000000100022942 v8pp_test`v8pp::class_<X, v8pp::raw_ptr_traits>::class_(this=0x00007ffeefbfe3f0, isolate=0x0000000102c25000, destroy= Function = v8pp::factory<X, v8pp::raw_ptr_traits>::destroy(v8::Isolate*, X* const&) )>) at class.hpp:183:17
    frame #11: 0x000000010001ab2d v8pp_test`v8pp::class_<X, v8pp::raw_ptr_traits>::class_(this=0x00007ffeefbfe3f0, isolate=0x0000000102c25000, destroy=<unavailable>)>) at class.hpp:188:2
    frame #12: 0x00000001000444ba v8pp_test`void test_class_<v8pp::raw_ptr_traits>(this=0x00007ffeefbfef00)::'lambda'()::operator()() const at test_class.cpp:184:27
    frame #13: 0x000000010001e783 v8pp_test`void check_ex<std::runtime_error, void test_class_<v8pp::raw_ptr_traits>()::'lambda'()>(msg=(data_ = "already wrapped class X", size_ = 23), f=0x00007ffeefbfef00)::'lambda'()&&) at test.hpp:193:3
    frame #14: 0x000000010001376a v8pp_test`void test_class_<v8pp::raw_ptr_traits>() at test_class.cpp:182:2
    frame #15: 0x0000000100012d39 v8pp_test`test_class() at test_class.cpp:445:2
    frame #16: 0x0000000100005b81 v8pp_test`run_tests() at main.cpp:54:4
    frame #17: 0x000000010000629a v8pp_test`main(argc=1, argv=0x00007ffeefbffa08) at main.cpp:119:3
    frame #18: 0x00007fff20398f3d libdyld.dylib`start + 1
    frame #19: 0x00007fff20398f3d libdyld.dylib`start + 1
pmed added a commit that referenced this issue Nov 2, 2021
it seems that throwing exceptions doesn't work with disabled RTTI.

See issue #176
pmed added a commit that referenced this issue Nov 2, 2021
it seems that throwing exceptions doesn't work with disabled RTTI.

See issue #176
pmed added a commit that referenced this issue Nov 2, 2021
Set alos explicit `-fexceptions` flag for `v8pp` target.

See issue #176
@pmed
Copy link
Owner Author

pmed commented Nov 2, 2021

Fixed in 6611145

@pmed pmed closed this as completed Nov 2, 2021
pmed added a commit that referenced this issue Nov 2, 2021
Set alos explicit `-fexceptions` flag for `v8pp` target.

See issue #176

(cherry picked from commit 6611145)
pmed added a commit that referenced this issue Nov 5, 2021
to keep warning options only specific for v8pp, and
do not affect other porjects linked against v8pp.

See issue #176
@pmed pmed reopened this Nov 5, 2021
pmed added a commit that referenced this issue Nov 5, 2021
to keep warning options only specific for v8pp, and
do not affect other porjects linked against v8pp.

See issue #176
pmed added a commit that referenced this issue Jan 3, 2023
and turn it off only for v8pp/context.cpp on macOS, because exceptions there
can't be catched if they were thrown from dylib with disabled RTTI
More details in Stackoverflow quiestion ["Problems throwing and catching exceptions on OS X with -fno-rtti"](https://stackoverflow.com/questions/21737201/problems-throwing-and-catching-exceptions-on-os-x-with-fno-rtti)

See issue #176
pmed added a commit that referenced this issue Jan 3, 2023
and turn it off only for v8pp/context.cpp on macOS, because exceptions there
can't be catched if they were thrown from dylib with disabled RTTI
More details in Stackoverflow quiestion ["Problems throwing and catching exceptions on OS X with -fno-rtti"](https://stackoverflow.com/questions/21737201/problems-throwing-and-catching-exceptions-on-os-x-with-fno-rtti)

See issue #176
@pmed pmed closed this as completed Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant