I doubt this is the right approach, by the way, but I was able to link
successfully by commenting out
https://github.com/v8/v8/blob/ebd3e99c85fb93e7ddea207233e35f53742c2e05/src/snapshot/embedded/platform-embedded-file-writer-generic.cc#L60
so that the symbols aren't declared as hidden. I'm guessing that in the GN
build, there's some other configuration difference that allows linking to
succeed even with the hidden symbols.

On Tue, Feb 6, 2024 at 9:12 AM Elliott Brossard <
elliott.bross...@snowflake.com> wrote:

> Thanks! That's helpful. If I do figure out a way to make this work, what
> is the best way to add tests for Bazel build configurations? If you have a
> sample commit, that would be great.
>
> On Tue, Feb 6, 2024 at 4:09 AM 'Victor Gomes' via v8-dev <
> v8-dev@googlegroups.com> wrote:
>
>>
>>
>> On Tue, Feb 6, 2024 at 1:02 PM Jakob Kummerow <jkumme...@chromium.org>
>> wrote:
>>
>>> 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.
>>>
>> No, we don't have dynamic linking on the roadmap.
>>
>>>
>>> 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).
>>>
>> +1 to that.
>>
>>>
>>> --
>>> --
>>> 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
>>> <https://groups.google.com/d/msgid/v8-dev/CAKSzg3QPEzjX0sLmguPG%3DXNYby61%3Dp6w%2B4f4LR3Y1zcNDgUhDA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Victor
>>
>> --
>> --
>> v8-dev mailing list
>> v8-dev@googlegroups.com
>> http://groups.google.com/group/v8-dev
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "v8-dev" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/v8-dev/BccObkPEGm4/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/CAGFuzY1w1Gu4hzvORTq6c%3D5ZvJMkpZ4h1UYHrGhK071BngYcTw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/v8-dev/CAGFuzY1w1Gu4hzvORTq6c%3D5ZvJMkpZ4h1UYHrGhK071BngYcTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
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/CAG%2B85ipMLAJHTTwjrYDQtiLoeHT_9bvABxgyiP1kZ%2BGR_g%3DsPQ%40mail.gmail.com.

Reply via email to