Re: [v8-users] cant embed v8 due to stb lib linker errors

57 views
Skip to first unread message

Jakob Kummerow

unread,
Dec 4, 2024, 6:50:12 AM12/4/24
to v8-u...@googlegroups.com
Let's keep the conversation focused in the other thread: https://groups.google.com/g/v8-users/c/bgcv6AqnrZs


On Wed, Dec 4, 2024 at 4:37 AM Grant Upson <grant...@gmail.com> wrote:
Hi everyone,

I'm trying to embed V8 into a C++ project currently and keep encountering issues when linking V8. Currently i'm following the instructions on https://v8.dev/docs/embed and doing this on Linux. After building V8 with these parameters


gn gen out.gn/library --args='is_debug=false is_component_build=false v8_enable_i18n_support=false is_clang=true v8_monolithic=true target_cpu="x64" v8_use_external_startup_data=false'


and attempting to link to the libv8_monolith.a static library it throws a bunch of undefined reference errors to the standard library e.g.,

undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init_copy_ctor_external(char const*, unsigned long)'

I've setup my default compiler to use clang with the LLVM standard library and using nm have determined that V8 is being built with clang and the LLVM std library since it outputs std::__1:: function symbols.

I've also forced libc++ to be used in the cmake project that is trying to link to the V8 library with cmake commands like so

set(CMAKE_CXX_STANDARD_LIBRARIES "-stdlib=libc++")
set(CMAKE_C_FLAGS "-stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")

I'm really at a loss at what could be causing this issue because both the library and my project should be using the same standard library. Any advice?

--
Reply all
Reply to author
Forward
0 new messages