Search code examples
shared-librariesv8

Can't get V8 Monolith to genorate


I've been trying to use -v8_monolith in my make files but so far it's not working.

I gotten v8 code from google's depot-tools, then followed every tutorial on the web to try to compile the shared libs for v8. I'm assuming that the ninja compiler automatically puts the libs in to the arch lib folder, since no tutorial says to do anything with the files. As of rn, I get no errors from the ninja compiler.

Maybe I got to change something in the args.gn to push in to my libs folder. Possably it's trying to push to the wrong location. this is what it looks like:

is_debug = false
target_cpu = "x64"
use_custom_libcxx = false
v8_monolithic = true
v8_use_external_startup_data = false
is_component_build = false
v8_static_library = true

here is the entire processes from terminal:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=depot_tools:$PATH
mkdir v8
cd v8
fetch v8
gclient sync
tools/dev/v8gen.py x64.release
#then this is the point where I manually go to args.gn to edit it
ninja -C out.gn/x64.release

I've also tried getting the v8 package from AUR, but does not compile correctly


Solution

  • compile the shared libs for v8

    In that case, you need is_component_build = true. And then you'll have to drop v8_monolithic, because that forces a static (i.e. non-shared) library. I don't think v8_static_library matters, at least I've never used that.

    For the record, we (V8 team) tend to recommend static linking, mostly because of the rate of change to V8's API: any time you update the shared library, you'll have to recompile all programs using it anyway, so there's not a lot of benefit to be had from it being a shared library (but some room for accidental breakage, which a statically linked build avoids).

    puts the libs in to the arch lib folder

    I don't know what you mean by "the arch lib folder"; libv8.so will be in out.gn/x64.release/ (or whatever directory you pass to ninja -C <dir>). If you want it elsewhere, you'll have to put it elsewhere. Building V8 doesn't touch the rest of your system (there's no make install-like target).

    trying to use -v8_monolith in my make files

    Once everything else is correct, that'll be -lv8 -lv8_libbase -lv8_libplatform, and the corresponding library files will be called libv8.so, libv8_libbase.so, and libv8_libplatform.so.