Reputation: 167
I am embedding V8 in a C++ project. The build completes successfully, but when running the executable, it crashes with a segmentation fault before reaching main()
.
Running the executable under gdb
gives the following backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff782a304 in call_init (env=<optimized out>, argv=0x7fffffffdaa8, argc=1) at ../csu/libc-start.c:145
#2 __libc_start_main_impl (main=0x55555579f0e9 <main>, argc=1, argv=0x7fffffffdaa8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffda98) at ../csu/libc-start.c:347
#3 0x000055555579f025 in _start ()
The crash happens at address 0x0000000000000000
, suggesting a null pointer dereference.
As directed as the v8_documentaaion
compile command i used,
g++ v8/v8/samples/hello-world.cc -o app -Iv8/v8 -Iv8/v8/include -pthread -std=c++20 -fno-rtti -fuse-ld=lld -L v8/v8/out.gn/x64.release.sample/obj/ -lv8_monolith -lv8_libbase -lv8_libplatform -ldl -g
I have tried all known tools to find the issue. but i cant solve it.
The doc also says
Note: as of November 2024, it might also segfault early during process startup. Investigation is pending. If you run into this and can figure out what's wrong, please comment on issue 377222400, or submit a patch.
call_init
in libc
).main()
, so it could be related to static/global initialization.The application should initialize V8 correctly and execute main()
without segmentation faults.
Let me know if you need any modifications!
Upvotes: -3
Views: 61