On Mon, Feb 5, 2024 at 11:42 PM 'Elliott Brossard' via v8-dev <
v8-dev@googlegroups.com> wrote:

> https://github.com/v8/v8/blob/main/bazel/defs.bzl sets `linkstatic` to
> `True` for all of the library targets, and there is no option to create
> shared objects for the libraries instead (as far as I can tell). If I
> naively patch `defs.bzl` to have `linkstatic = False`, I get the following
> link errors:
>
> ```
> ld.lld: error: undefined reference due to --no-allow-shlib-undefined:
> v8_Default_embedded_blob_code_
> >>> referenced by
> bazel-out/k8-fastbuild/bin/_solib_k8/libexternal_Sv8_Slibv8_Ulibshared_Uicu.so
>
> ld.lld: error: undefined reference due to --no-allow-shlib-undefined:
> v8_Default_embedded_blob_code_size_
> >>> referenced by
> bazel-out/k8-fastbuild/bin/_solib_k8/libexternal_Sv8_Slibv8_Ulibshared_Uicu.so
>
> ld.lld: error: undefined reference due to --no-allow-shlib-undefined:
> v8_Default_embedded_blob_data_
> >>> referenced by
> bazel-out/k8-fastbuild/bin/_solib_k8/libexternal_Sv8_Slibv8_Ulibshared_Uicu.so
>
> ld.lld: error: undefined reference due to --no-allow-shlib-undefined:
> v8_Default_embedded_blob_data_size_
> >>> referenced by
> bazel-out/k8-fastbuild/bin/_solib_k8/libexternal_Sv8_Slibv8_Ulibshared_Uicu.so
> collect2: error: ld returned 1 exit status
> ```
>
> I think (please correct me if I'm wrong) that the gn-based build does
> support generating shared objects for the various V8 libraries instead, and
> I see references e.g. to defines like `BUILDING_V8_SHARED` in
> https://github.com/v8/v8/blob/main/BUILD.gn. I'm not interested in
> cross-version stability, just the ability to link dynamically in order to
> have smaller test binaries involving V8, but I'm wondering:
> * Is it true that the gn build supports dynamic linking? I'm having
> trouble deciphering this from the docs/sources.
>

Yes, definitely. I use it all the time.
The GN build supports everything. The Bazel build is known to support only
a subset of configuration options.


> * Is dynamic linking with the Bazel build on the roadmap? I don't see any
> related mentions on the issue tracker
> <https://issues.chromium.org/issues?q=is:open>.
>

I don't know.

If you have time/interest to figure out how to support dynamic-linking (aka
shared-library aka component) builds with the Bazel build, we would
probably accept patches (as long as they're not too intrusive or add too
much maintenance burden going forward).

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAKSzg3QPEzjX0sLmguPG%3DXNYby61%3Dp6w%2B4f4LR3Y1zcNDgUhDA%40mail.gmail.com.

Reply via email to