From 019ce5131d1edae52307b9e05d8c4c4c5119f5c6 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 28 Aug 2026 23:04:31 +0200 Subject: [PATCH 1/3] build: add `--shared-abseil` configure flag Signed-off-by: Antoine du Hamel --- .github/workflows/test-shared.yml | 2 + Makefile | 1 + configure.py | 332 ++++++++++++++++++++++++++++++ node.gyp | 5 +- shell.nix | 3 + tools/nix/sharedLibDeps.nix | 1 + tools/nix/v8.nix | 26 ++- tools/v8_gypfiles/d8.gyp | 4 +- tools/v8_gypfiles/v8.gyp | 57 +++-- tools/v8_gypfiles/v8windbg.gyp | 13 +- 10 files changed, 415 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 8a04fe4d74fc..9aada0a148c4 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -33,6 +33,7 @@ on: - deps/sqlite/** - deps/uv/** - deps/uvwasi/** + - deps/v8/third_party/abseil-cpp/** - deps/zlib/** - deps/zstd/** - doc/** @@ -86,6 +87,7 @@ on: - deps/sqlite/** - deps/uv/** - deps/uvwasi/** + - deps/v8/third_party/abseil-cpp/** - deps/zlib/** - deps/zstd/** - doc/** diff --git a/Makefile b/Makefile index ed049893a243..4c285daa4387 100644 --- a/Makefile +++ b/Makefile @@ -1316,6 +1316,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1) $(RM) -r $(TARNAME)/deps/sqlite $(RM) -r $(TARNAME)/deps/uv $(RM) -r $(TARNAME)/deps/uvwasi + $(RM) -r $(TARNAME)/deps/v8/third_party/abseil-cpp $(RM) -r $(TARNAME)/deps/zlib $(RM) -r $(TARNAME)/deps/zstd else diff --git a/configure.py b/configure.py index b11c4e3284d0..3aa3f66e5962 100755 --- a/configure.py +++ b/configure.py @@ -282,6 +282,122 @@ help='Use the specified path to system CA (PEM format) in addition to ' 'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.') +shared_optgroup.add_argument('--shared-abseil', + action='store_true', + dest='shared_abseil', + default=None, + help='link to a shared googletest DLL instead of static linking') + +shared_optgroup.add_argument('--shared-abseil-includes', + action='store', + dest='shared_abseil_includes', + help='directory containing googletest header files') + +shared_optgroup.add_argument('--shared-abseil-libname', + action='store', + dest='shared_abseil_libname', + default=','.join([ + 'absl_base', + 'absl_borrowed_fixup_buffer', + 'absl_city', + 'absl_civil_time', + 'absl_cord_internal', + 'absl_cord', + 'absl_cordz_functions', + 'absl_cordz_handle', + 'absl_cordz_info', + 'absl_cordz_sample_token', + 'absl_crc_cord_state', + 'absl_crc_cpu_detect', + 'absl_crc_internal', + 'absl_crc32c', + 'absl_debugging_internal', + 'absl_decode_rust_punycode', + 'absl_demangle_internal', + 'absl_demangle_rust', + 'absl_die_if_null', + 'absl_examine_stack', + 'absl_exponential_biased', + 'absl_failure_signal_handler', + 'absl_flags_commandlineflag_internal', + 'absl_flags_commandlineflag', + 'absl_flags_config', + 'absl_flags_internal', + 'absl_flags_marshalling', + 'absl_flags_parse', + 'absl_flags_private_handle_accessor', + 'absl_flags_program_name', + 'absl_flags_reflection', + 'absl_flags_usage_internal', + 'absl_flags_usage', + 'absl_generic_printer_internal', + 'absl_graphcycles_internal', + 'absl_hash', + 'absl_hashtable_profiler', + 'absl_hashtablez_sampler', + 'absl_int128', + 'absl_kernel_timeout_internal', + 'absl_leak_check', + 'absl_log_entry', + 'absl_log_flags', + 'absl_log_globals', + 'absl_log_initialize', + 'absl_log_internal_check_op', + 'absl_log_internal_conditions', + 'absl_log_internal_fnmatch', + 'absl_log_internal_format', + 'absl_log_internal_globals', + 'absl_log_internal_log_sink_set', + 'absl_log_internal_message', + 'absl_log_internal_nullguard', + 'absl_log_internal_proto', + 'absl_log_internal_structured_proto', + 'absl_log_severity', + 'absl_log_sink', + 'absl_malloc_internal', + 'absl_periodic_sampler', + 'absl_poison', + 'absl_profile_builder', + 'absl_random_distributions', + 'absl_random_internal_distribution_test_util', + 'absl_random_internal_entropy_pool', + 'absl_random_internal_platform', + 'absl_random_internal_randen_hwaes_impl', + 'absl_random_internal_randen_hwaes', + 'absl_random_internal_randen_slow', + 'absl_random_internal_randen', + 'absl_random_internal_seed_material', + 'absl_random_seed_gen_exception', + 'absl_random_seed_sequences', + 'absl_raw_hash_set', + 'absl_raw_logging_internal', + 'absl_scoped_mock_log', + 'absl_scoped_set_env', + 'absl_spinlock_wait', + 'absl_stacktrace', + 'absl_status_matchers', + 'absl_status', + 'absl_statusor', + 'absl_str_format_internal', + 'absl_strerror', + 'absl_strings_internal', + 'absl_strings', + 'absl_symbolize', + 'absl_synchronization', + 'absl_throw_delegate', + 'absl_time_zone', + 'absl_time', + 'absl_tracing_internal', + 'absl_utf8_for_code_point', + 'absl_vlog_config_internal', + ]), + help='alternative lib name to link to [default: %(default)s]') + +shared_optgroup.add_argument('--shared-abseil-libpath', + action='store', + dest='shared_abseil_libpath', + help='a directory to search for the shared googletest DLL') + shared_optgroup.add_argument('--shared-gtest', action='store_true', dest='shared_gtest', @@ -2814,6 +2930,222 @@ def make_bin_override(): configure_library('zlib', output) configure_library('http_parser', output, pkgname='libllhttp') configure_library('libuv', output) +configure_library('abseil', output, pkgname=[ + 'absl_absl_check', + 'absl_absl_log', + 'absl_absl_vlog_is_on', + 'absl_algorithm_container', + 'absl_algorithm', + 'absl_any_invocable', + 'absl_any', + 'absl_atomic_hook', + 'absl_bad_any_cast', + 'absl_bad_optional_access', + 'absl_bad_variant_access', + 'absl_base_internal', + 'absl_base', + 'absl_bind_front', + 'absl_bits', + 'absl_borrowed_fixup_buffer', + 'absl_bounded_utf8_length_sequence', + 'absl_btree', + 'absl_charset', + 'absl_check', + 'absl_chunked_queue', + 'absl_city', + 'absl_civil_time', + 'absl_cleanup_internal', + 'absl_cleanup', + 'absl_common_policy_traits', + 'absl_compare', + 'absl_compressed_tuple', + 'absl_config', + 'absl_constexpr_testing_internal', + 'absl_container_common', + 'absl_container_memory', + 'absl_cord_internal', + 'absl_cord_test_helpers', + 'absl_cord', + 'absl_cordz_functions', + 'absl_cordz_handle', + 'absl_cordz_info', + 'absl_cordz_sample_token', + 'absl_cordz_statistics', + 'absl_cordz_update_scope', + 'absl_cordz_update_tracker', + 'absl_core_headers', + 'absl_crc_cord_state', + 'absl_crc_cpu_detect', + 'absl_crc_internal', + 'absl_crc32c', + 'absl_debugging_internal', + 'absl_debugging', + 'absl_decode_rust_punycode', + 'absl_demangle_internal', + 'absl_demangle_rust', + 'absl_die_if_null', + 'absl_dynamic_annotations', + 'absl_endian', + 'absl_errno_saver', + 'absl_examine_stack', + 'absl_exponential_biased', + 'absl_failure_signal_handler', + 'absl_fast_type_id', + 'absl_fixed_array', + 'absl_flags_commandlineflag_internal', + 'absl_flags_commandlineflag', + 'absl_flags_config', + 'absl_flags_internal', + 'absl_flags_marshalling', + 'absl_flags_parse', + 'absl_flags_path_util', + 'absl_flags_private_handle_accessor', + 'absl_flags_program_name', + 'absl_flags_reflection', + 'absl_flags_usage_internal', + 'absl_flags_usage', + 'absl_flags', + 'absl_flat_hash_map', + 'absl_flat_hash_set', + 'absl_function_ref', + 'absl_generic_printer_internal', + 'absl_graphcycles_internal', + 'absl_has_ostream_operator', + 'absl_hash_container_defaults', + 'absl_hash_function_defaults', + 'absl_hash_policy_traits', + 'absl_hash_testing', + 'absl_hash', + 'absl_hashtable_control_bytes', + 'absl_hashtable_debug_hooks', + 'absl_hashtable_debug', + 'absl_hashtable_profiler', + 'absl_hashtablez_sampler', + 'absl_heterogeneous_lookup_testing', + 'absl_inlined_vector_internal', + 'absl_inlined_vector', + 'absl_int128', + 'absl_iterator_traits_internal', + 'absl_iterator_traits_test_helper_internal', + 'absl_kernel_timeout_internal', + 'absl_layout', + 'absl_leak_check', + 'absl_linked_hash_map', + 'absl_linked_hash_set', + 'absl_log_entry', + 'absl_log_flags', + 'absl_log_globals', + 'absl_log_initialize', + 'absl_log_internal_append_truncated', + 'absl_log_internal_check_impl', + 'absl_log_internal_check_op', + 'absl_log_internal_conditions', + 'absl_log_internal_config', + 'absl_log_internal_container', + 'absl_log_internal_flags', + 'absl_log_internal_fnmatch', + 'absl_log_internal_format', + 'absl_log_internal_globals', + 'absl_log_internal_log_impl', + 'absl_log_internal_log_sink_set', + 'absl_log_internal_message', + 'absl_log_internal_nullguard', + 'absl_log_internal_nullstream', + 'absl_log_internal_proto', + 'absl_log_internal_strip', + 'absl_log_internal_structured_proto', + 'absl_log_internal_structured', + 'absl_log_internal_voidify', + 'absl_log_severity', + 'absl_log_sink_registry', + 'absl_log_sink', + 'absl_log_streamer', + 'absl_log_structured', + 'absl_log', + 'absl_malloc_internal', + 'absl_memory', + 'absl_meta', + 'absl_no_destructor', + 'absl_node_hash_map', + 'absl_node_hash_set', + 'absl_node_slot_policy', + 'absl_non_temporal_arm_intrinsics', + 'absl_non_temporal_memcpy', + 'absl_nullability_traits_internal', + 'absl_nullability', + 'absl_numeric_representation' + 'absl_numeric' + 'absl_optional', + 'absl_overload', + 'absl_periodic_sampler', + 'absl_poison', + 'absl_prefetch', + 'absl_pretty_function', + 'absl_profile_builder', + 'absl_random_bit_gen_ref', + 'absl_random_distributions', + 'absl_random_internal_distribution_caller', + 'absl_random_internal_distribution_test_util', + 'absl_random_internal_entropy_pool', + 'absl_random_internal_fast_uniform_bits', + 'absl_random_internal_fastmath', + 'absl_random_internal_generate_real', + 'absl_random_internal_iostream_state_saver', + 'absl_random_internal_mock_helpers', + 'absl_random_internal_nonsecure_base', + 'absl_random_internal_pcg_engine', + 'absl_random_internal_platform', + 'absl_random_internal_randen_engine', + 'absl_random_internal_randen_hwaes_impl', + 'absl_random_internal_randen_hwaes', + 'absl_random_internal_randen_slow', + 'absl_random_internal_randen', + 'absl_random_internal_salted_seed_seq', + 'absl_random_internal_seed_material', + 'absl_random_internal_traits', + 'absl_random_internal_uniform_helper', + 'absl_random_internal_wide_multiply', + 'absl_random_mocking_bit_gen', + 'absl_random_random', + 'absl_random_seed_gen_exception', + 'absl_random_seed_sequences', + 'absl_raw_hash_map', + 'absl_raw_hash_set_resize_impl', + 'absl_raw_hash_set', + 'absl_raw_logging_internal', + 'absl_requires_internal', + 'absl_sample_recorder', + 'absl_scoped_mock_log', + 'absl_scoped_set_env', + 'absl_span', + 'absl_spinlock_wait', + 'absl_spy_hash_state', + 'absl_stacktrace', + 'absl_status_matchers', + 'absl_status', + 'absl_statusor', + 'absl_str_format_internal', + 'absl_str_format', + 'absl_strerror', + 'absl_string_view', + 'absl_strings_append_and_overwrite', + 'absl_strings_internal', + 'absl_strings_resize_and_overwrite', + 'absl_strings', + 'absl_symbolize', + 'absl_synchronization', + 'absl_throw_delegate', + 'absl_time_zone', + 'absl_time', + 'absl_tracing_internal', + 'absl_type_traits', + 'absl_utf8_for_code_point', + 'absl_utility', + 'absl_variant', + 'absl_vlog_config_internal', + 'absl_vlog_is_on', + 'absl_weakly_mixed_integer', +]) configure_library('ada', output) configure_library('simdjson', output) configure_library('simdutf', output) diff --git a/node.gyp b/node.gyp index 8cf405215249..22db3804d417 100644 --- a/node.gyp +++ b/node.gyp @@ -15,6 +15,7 @@ 'node_lib_target_name%': 'libnode', 'node_module_version%': '', 'node_no_browser_globals%': 'false', + 'node_shared_abseil%': 'false', 'node_shared_brotli%': 'false', 'node_shared_cares%': 'false', 'node_shared_gtest%': 'false', @@ -899,7 +900,7 @@ [ 'node_builtin_modules_path!=""', { 'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ], }], - [ 'node_use_bundled_v8!="false"', { + [ 'node_use_bundled_v8!="false" and node_shared_abseil=="false"', { 'dependencies': [ 'tools/v8_gypfiles/abseil.gyp:abseil' ], }], [ 'node_shared_gtest=="false"', { @@ -1367,7 +1368,7 @@ [ 'node_shared_gtest=="true"', { 'libraries': [ '-lgtest_main' ], }], - [ 'node_use_bundled_v8!="false"', { + [ 'node_use_bundled_v8!="false" and node_shared_abseil=="false"', { 'dependencies': [ 'tools/v8_gypfiles/abseil.gyp:abseil' ], }], [ 'node_shared_hdr_histogram=="false"', { diff --git a/shell.nix b/shell.nix index 96fcccbc1914..b92f860431ac 100644 --- a/shell.nix +++ b/shell.nix @@ -63,6 +63,7 @@ let ]; buildInputs = pkgs.lib.optional useSharedICU icu + ++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) sharedLibDeps.abseil ++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi; # Put here only the configure flags that affect the V8 build @@ -75,6 +76,7 @@ let ) "--v8-${if withTemporal then "enable" else "disable"}-temporal-support" ] + ++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil" ++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi" ++ pkgs.lib.optional withPerfetto "--with-perfetto"; in @@ -132,6 +134,7 @@ pkgs.mkShell { builtins.attrNames ( if (useSeparateDerivationForV8 != false) then builtins.removeAttrs sharedLibDeps [ + "abseil" "simdutf" "temporal_capi" ] diff --git a/tools/nix/sharedLibDeps.nix b/tools/nix/sharedLibDeps.nix index 788e9efedeb8..1d5d14c285a8 100644 --- a/tools/nix/sharedLibDeps.nix +++ b/tools/nix/sharedLibDeps.nix @@ -21,6 +21,7 @@ zlib zstd ; + abseil = pkgs.abseil-cpp; cares = pkgs.c-ares; hdr-histogram = pkgs.hdrhistogram_c; http-parser = pkgs.llhttp; diff --git a/tools/nix/v8.nix b/tools/nix/v8.nix index 90dadd336c8d..0338bff5ddb5 100644 --- a/tools/nix/v8.nix +++ b/tools/nix/v8.nix @@ -23,6 +23,7 @@ }: let + useSharedAbseil = builtins.elem "--shared-abseil" configureFlags; src = let inherit (lib) fileset; @@ -35,7 +36,6 @@ let ../../node.gypi ../../tools/gyp/pylib ../../tools/gyp_node.py - ../../tools/v8_gypfiles/abseil.gyp ../../tools/v8_gypfiles/features.gypi ../../tools/v8_gypfiles/ForEachFormat.py ../../tools/v8_gypfiles/ForEachReplace.py @@ -44,6 +44,7 @@ let ../../tools/v8_gypfiles/toolchain.gypi ../../tools/v8_gypfiles/v8.gyp ] + ++ lib.optional (!useSharedAbseil) ../../tools/v8_gypfiles/abseil.gyp ++ lib.optionals (builtins.elem "--with-perfetto" configureFlags) [ ../../deps/perfetto ] @@ -63,12 +64,15 @@ let potentiallyAlreadyRemovedFiles = # Files that are removed in the release tarball (see Makefile $(TARBALL) target) [ (fileset.difference ../../deps/v8/test ../../deps/v8/test/torque) ] - ++ (builtins.filter builtins.pathExists [ - ../../deps/v8/samples - ../../deps/v8/tools/profviz - ../../deps/v8/tools/run-tests.py - ../../deps/v8/third_party/ittapi - ]); + ++ (builtins.filter builtins.pathExists ( + [ + ../../deps/v8/samples + ../../deps/v8/tools/profviz + ../../deps/v8/tools/run-tests.py + ../../deps/v8/third_party/ittapi + ] + ++ lib.optional useSharedAbseil ../../deps/v8/third_party/abseil-cpp + )); trackedFiles = ({ # This line is being modified by Makefile $(TARBALL) target, any change to it should be sync @@ -197,9 +201,11 @@ stdenv.mkDerivation (finalAttrs: { find deps/v8/include -name '*.h' -print0 | while read -r -d "" file; do install -Dm644 "$file" -T "$out/include/''${file#deps/v8/include/}" done - find deps/v8/third_party/abseil-cpp/absl -name '*.h' -print0 | while read -r -d "" file; do - install -Dm644 "$file" -T "$out/include/''${file#deps/v8/third_party/abseil-cpp/}" - done + ${lib.optionalString (!useSharedAbseil) '' + find deps/v8/third_party/abseil-cpp/absl -name '*.h' -print0 | while read -r -d "" file; do + install -Dm644 "$file" -T "$out/include/''${file#deps/v8/third_party/abseil-cpp/}" + done + ''} mkdir -p $out/lib/pkgconfig cat -> $out/lib/pkgconfig/v8.pc << EOF diff --git a/tools/v8_gypfiles/d8.gyp b/tools/v8_gypfiles/d8.gyp index 5b47ebf180dd..f59a155b169c 100644 --- a/tools/v8_gypfiles/d8.gyp +++ b/tools/v8_gypfiles/d8.gyp @@ -16,7 +16,6 @@ 'target_name': 'd8', 'type': 'executable', 'dependencies': [ - 'abseil.gyp:abseil', 'v8.gyp:v8', 'v8.gyp:v8_libbase', 'v8.gyp:v8_libplatform', @@ -77,6 +76,9 @@ }, }, }], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, ], diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 32fc99e2af9f..c9caaec7523c 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -288,7 +288,6 @@ 'v8_base_without_compiler', 'v8_initializers', 'v8_maybe_icu', - 'abseil.gyp:abseil', ], 'sources': [ '<(V8_ROOT)/src/init/setup-isolate-full.cc', @@ -299,6 +298,9 @@ '<(perfetto_gyp_file):perfetto_sdk', ], }], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, # v8_init { @@ -310,7 +312,6 @@ 'v8_base_without_compiler', 'v8_shared_internal_headers', 'v8_pch', - 'abseil.gyp:abseil', ], 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)', @@ -390,6 +391,9 @@ '<(V8_ROOT)/src/builtins/builtins-intl-gen.cc', ], }], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, # v8_initializers { @@ -508,7 +512,6 @@ 'v8_compiler_for_mksnapshot', 'v8_initializers', 'v8_libplatform', - 'abseil.gyp:abseil', ] }, { 'dependencies': [ @@ -521,9 +524,11 @@ 'v8_compiler_for_mksnapshot', 'v8_initializers', 'v8_libplatform', - 'abseil.gyp:abseil', ] }], + ['want_separate_host_toolset and node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ['OS=="win" and clang==1', { 'actions': [ { @@ -637,7 +642,6 @@ 'v8_libbase', 'fp16', 'highway', - 'abseil.gyp:abseil', ], 'direct_dependent_settings': { 'sources': [ @@ -882,6 +886,11 @@ }], ], }, + 'conditions': [ + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], + ], }, # v8_internal_headers { 'target_name': 'v8_compiler_sources', @@ -983,7 +992,6 @@ 'v8_libbase', 'v8_shared_internal_headers', 'v8_pch', - 'abseil.gyp:abseil', ], 'conditions': [ ['v8_use_perfetto==1', { @@ -1001,6 +1009,9 @@ }, { 'sources': ['<(V8_ROOT)/src/compiler/turbofan-disabled.cc'], }], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, # v8_compiler { @@ -1104,7 +1115,6 @@ 'v8_zlib', 'v8_pch', 'simdutf', - 'abseil.gyp:abseil', ], 'includes': ['inspector.gypi'], 'direct_dependent_settings': { @@ -1391,6 +1401,9 @@ 'libraries': ['-latomic', ], }, }], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, # v8_base_without_compiler { @@ -1412,7 +1425,6 @@ 'dependencies': [ 'v8_shared_internal_headers', 'v8_libbase', - 'abseil.gyp:abseil', ], 'defines!': [ '_HAS_EXCEPTIONS=0', @@ -1438,6 +1450,9 @@ 'cflags!': ['-O3'], 'sources': ['<(V8_ROOT)/src/torque/implementation-visitor.cc'], }], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, # torque_base { @@ -1477,7 +1492,6 @@ 'dependencies': [ 'v8_headers', - 'abseil.gyp:abseil', ], 'conditions': [ @@ -1718,6 +1732,9 @@ ], } ], + ['node_shared_abseil=="false"', { + 'dependencies': ['abseil.gyp:abseil'], + }], ], }, # v8_libbase { @@ -1726,7 +1743,6 @@ 'toolsets': ['host', 'target'], 'dependencies': [ 'v8_libbase', - 'abseil.gyp:abseil', ], 'sources': [ ' Date: Mon, 31 Aug 2026 17:37:10 +0200 Subject: [PATCH 2/3] fixup! build: add `--shared-abseil` configure flag --- configure.py | 253 +-------------------------------------- tools/v8_gypfiles/v8.gyp | 2 +- 2 files changed, 5 insertions(+), 250 deletions(-) diff --git a/configure.py b/configure.py index 3aa3f66e5962..5c2a398989af 100755 --- a/configure.py +++ b/configure.py @@ -286,117 +286,23 @@ action='store_true', dest='shared_abseil', default=None, - help='link to a shared googletest DLL instead of static linking') + help='link to a shared Abseil DLL instead of static linking') shared_optgroup.add_argument('--shared-abseil-includes', action='store', dest='shared_abseil_includes', - help='directory containing googletest header files') + help='directory containing Abseil header files') shared_optgroup.add_argument('--shared-abseil-libname', action='store', dest='shared_abseil_libname', - default=','.join([ - 'absl_base', - 'absl_borrowed_fixup_buffer', - 'absl_city', - 'absl_civil_time', - 'absl_cord_internal', - 'absl_cord', - 'absl_cordz_functions', - 'absl_cordz_handle', - 'absl_cordz_info', - 'absl_cordz_sample_token', - 'absl_crc_cord_state', - 'absl_crc_cpu_detect', - 'absl_crc_internal', - 'absl_crc32c', - 'absl_debugging_internal', - 'absl_decode_rust_punycode', - 'absl_demangle_internal', - 'absl_demangle_rust', - 'absl_die_if_null', - 'absl_examine_stack', - 'absl_exponential_biased', - 'absl_failure_signal_handler', - 'absl_flags_commandlineflag_internal', - 'absl_flags_commandlineflag', - 'absl_flags_config', - 'absl_flags_internal', - 'absl_flags_marshalling', - 'absl_flags_parse', - 'absl_flags_private_handle_accessor', - 'absl_flags_program_name', - 'absl_flags_reflection', - 'absl_flags_usage_internal', - 'absl_flags_usage', - 'absl_generic_printer_internal', - 'absl_graphcycles_internal', - 'absl_hash', - 'absl_hashtable_profiler', - 'absl_hashtablez_sampler', - 'absl_int128', - 'absl_kernel_timeout_internal', - 'absl_leak_check', - 'absl_log_entry', - 'absl_log_flags', - 'absl_log_globals', - 'absl_log_initialize', - 'absl_log_internal_check_op', - 'absl_log_internal_conditions', - 'absl_log_internal_fnmatch', - 'absl_log_internal_format', - 'absl_log_internal_globals', - 'absl_log_internal_log_sink_set', - 'absl_log_internal_message', - 'absl_log_internal_nullguard', - 'absl_log_internal_proto', - 'absl_log_internal_structured_proto', - 'absl_log_severity', - 'absl_log_sink', - 'absl_malloc_internal', - 'absl_periodic_sampler', - 'absl_poison', - 'absl_profile_builder', - 'absl_random_distributions', - 'absl_random_internal_distribution_test_util', - 'absl_random_internal_entropy_pool', - 'absl_random_internal_platform', - 'absl_random_internal_randen_hwaes_impl', - 'absl_random_internal_randen_hwaes', - 'absl_random_internal_randen_slow', - 'absl_random_internal_randen', - 'absl_random_internal_seed_material', - 'absl_random_seed_gen_exception', - 'absl_random_seed_sequences', - 'absl_raw_hash_set', - 'absl_raw_logging_internal', - 'absl_scoped_mock_log', - 'absl_scoped_set_env', - 'absl_spinlock_wait', - 'absl_stacktrace', - 'absl_status_matchers', - 'absl_status', - 'absl_statusor', - 'absl_str_format_internal', - 'absl_strerror', - 'absl_strings_internal', - 'absl_strings', - 'absl_symbolize', - 'absl_synchronization', - 'absl_throw_delegate', - 'absl_time_zone', - 'absl_time', - 'absl_tracing_internal', - 'absl_utf8_for_code_point', - 'absl_vlog_config_internal', - ]), + default=None, help='alternative lib name to link to [default: %(default)s]') shared_optgroup.add_argument('--shared-abseil-libpath', action='store', dest='shared_abseil_libpath', - help='a directory to search for the shared googletest DLL') + help='a directory to search for the shared Abseil DLL') shared_optgroup.add_argument('--shared-gtest', action='store_true', @@ -2937,214 +2843,63 @@ def make_bin_override(): 'absl_algorithm_container', 'absl_algorithm', 'absl_any_invocable', - 'absl_any', - 'absl_atomic_hook', - 'absl_bad_any_cast', - 'absl_bad_optional_access', - 'absl_bad_variant_access', - 'absl_base_internal', 'absl_base', 'absl_bind_front', 'absl_bits', - 'absl_borrowed_fixup_buffer', - 'absl_bounded_utf8_length_sequence', 'absl_btree', 'absl_charset', - 'absl_check', - 'absl_chunked_queue', - 'absl_city', - 'absl_civil_time', - 'absl_cleanup_internal', 'absl_cleanup', - 'absl_common_policy_traits', - 'absl_compare', - 'absl_compressed_tuple', 'absl_config', - 'absl_constexpr_testing_internal', - 'absl_container_common', - 'absl_container_memory', - 'absl_cord_internal', - 'absl_cord_test_helpers', 'absl_cord', - 'absl_cordz_functions', - 'absl_cordz_handle', - 'absl_cordz_info', - 'absl_cordz_sample_token', - 'absl_cordz_statistics', - 'absl_cordz_update_scope', - 'absl_cordz_update_tracker', 'absl_core_headers', - 'absl_crc_cord_state', - 'absl_crc_cpu_detect', - 'absl_crc_internal', - 'absl_crc32c', - 'absl_debugging_internal', - 'absl_debugging', - 'absl_decode_rust_punycode', - 'absl_demangle_internal', - 'absl_demangle_rust', 'absl_die_if_null', 'absl_dynamic_annotations', - 'absl_endian', - 'absl_errno_saver', - 'absl_examine_stack', - 'absl_exponential_biased', 'absl_failure_signal_handler', 'absl_fast_type_id', 'absl_fixed_array', - 'absl_flags_commandlineflag_internal', - 'absl_flags_commandlineflag', - 'absl_flags_config', - 'absl_flags_internal', - 'absl_flags_marshalling', - 'absl_flags_parse', - 'absl_flags_path_util', - 'absl_flags_private_handle_accessor', - 'absl_flags_program_name', - 'absl_flags_reflection', - 'absl_flags_usage_internal', - 'absl_flags_usage', - 'absl_flags', 'absl_flat_hash_map', 'absl_flat_hash_set', 'absl_function_ref', - 'absl_generic_printer_internal', - 'absl_graphcycles_internal', 'absl_has_ostream_operator', 'absl_hash_container_defaults', - 'absl_hash_function_defaults', - 'absl_hash_policy_traits', - 'absl_hash_testing', 'absl_hash', - 'absl_hashtable_control_bytes', - 'absl_hashtable_debug_hooks', - 'absl_hashtable_debug', - 'absl_hashtable_profiler', - 'absl_hashtablez_sampler', - 'absl_heterogeneous_lookup_testing', - 'absl_inlined_vector_internal', 'absl_inlined_vector', 'absl_int128', - 'absl_iterator_traits_internal', - 'absl_iterator_traits_test_helper_internal', - 'absl_kernel_timeout_internal', 'absl_layout', 'absl_leak_check', 'absl_linked_hash_map', 'absl_linked_hash_set', 'absl_log_entry', - 'absl_log_flags', 'absl_log_globals', 'absl_log_initialize', - 'absl_log_internal_append_truncated', - 'absl_log_internal_check_impl', - 'absl_log_internal_check_op', - 'absl_log_internal_conditions', - 'absl_log_internal_config', - 'absl_log_internal_container', - 'absl_log_internal_flags', - 'absl_log_internal_fnmatch', - 'absl_log_internal_format', - 'absl_log_internal_globals', - 'absl_log_internal_log_impl', - 'absl_log_internal_log_sink_set', - 'absl_log_internal_message', - 'absl_log_internal_nullguard', - 'absl_log_internal_nullstream', - 'absl_log_internal_proto', - 'absl_log_internal_strip', - 'absl_log_internal_structured_proto', - 'absl_log_internal_structured', - 'absl_log_internal_voidify', 'absl_log_severity', 'absl_log_sink_registry', 'absl_log_sink', - 'absl_log_streamer', - 'absl_log_structured', - 'absl_log', - 'absl_malloc_internal', 'absl_memory', - 'absl_meta', 'absl_no_destructor', 'absl_node_hash_map', 'absl_node_hash_set', - 'absl_node_slot_policy', - 'absl_non_temporal_arm_intrinsics', - 'absl_non_temporal_memcpy', - 'absl_nullability_traits_internal', 'absl_nullability', - 'absl_numeric_representation' - 'absl_numeric' 'absl_optional', 'absl_overload', - 'absl_periodic_sampler', - 'absl_poison', 'absl_prefetch', - 'absl_pretty_function', - 'absl_profile_builder', 'absl_random_bit_gen_ref', 'absl_random_distributions', - 'absl_random_internal_distribution_caller', - 'absl_random_internal_distribution_test_util', - 'absl_random_internal_entropy_pool', - 'absl_random_internal_fast_uniform_bits', - 'absl_random_internal_fastmath', - 'absl_random_internal_generate_real', - 'absl_random_internal_iostream_state_saver', - 'absl_random_internal_mock_helpers', - 'absl_random_internal_nonsecure_base', - 'absl_random_internal_pcg_engine', - 'absl_random_internal_platform', - 'absl_random_internal_randen_engine', - 'absl_random_internal_randen_hwaes_impl', - 'absl_random_internal_randen_hwaes', - 'absl_random_internal_randen_slow', - 'absl_random_internal_randen', - 'absl_random_internal_salted_seed_seq', - 'absl_random_internal_seed_material', - 'absl_random_internal_traits', - 'absl_random_internal_uniform_helper', - 'absl_random_internal_wide_multiply', - 'absl_random_mocking_bit_gen', 'absl_random_random', - 'absl_random_seed_gen_exception', - 'absl_random_seed_sequences', - 'absl_raw_hash_map', - 'absl_raw_hash_set_resize_impl', - 'absl_raw_hash_set', 'absl_raw_logging_internal', - 'absl_requires_internal', - 'absl_sample_recorder', - 'absl_scoped_mock_log', - 'absl_scoped_set_env', 'absl_span', - 'absl_spinlock_wait', - 'absl_spy_hash_state', 'absl_stacktrace', - 'absl_status_matchers', 'absl_status', 'absl_statusor', - 'absl_str_format_internal', 'absl_str_format', - 'absl_strerror', 'absl_string_view', - 'absl_strings_append_and_overwrite', - 'absl_strings_internal', - 'absl_strings_resize_and_overwrite', 'absl_strings', 'absl_symbolize', 'absl_synchronization', - 'absl_throw_delegate', - 'absl_time_zone', 'absl_time', - 'absl_tracing_internal', 'absl_type_traits', - 'absl_utf8_for_code_point', 'absl_utility', 'absl_variant', - 'absl_vlog_config_internal', - 'absl_vlog_is_on', - 'absl_weakly_mixed_integer', ]) configure_library('ada', output) configure_library('simdjson', output) diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index c9caaec7523c..d46dfed3c8c4 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -526,7 +526,7 @@ 'v8_libplatform', ] }], - ['want_separate_host_toolset and node_shared_abseil=="false"', { + ['node_shared_abseil=="false"', { 'dependencies': ['abseil.gyp:abseil'], }], ['OS=="win" and clang==1', { From a040aae5cd9c043a896c2b66d94763c8280296fc Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 18 Aug 2026 15:16:36 +0200 Subject: [PATCH 3/3] build: add `--shared-perfetto` flag Signed-off-by: Antoine du Hamel --- .github/workflows/test-shared.yml | 2 ++ Makefile | 1 + configure.py | 33 +++++++++++++++++++++++++++++++ deps/perfetto/perfetto.gyp | 25 +++++++++++++++-------- node.gyp | 13 ++++++++---- shell.nix | 4 ++++ tools/nix/sharedLibDeps.nix | 4 ++++ tools/nix/v8.nix | 7 ++++--- tools/v8_gypfiles/v8.gyp | 26 +++++++++++++++--------- 9 files changed, 91 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 9aada0a148c4..5269bd8a546f 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -29,6 +29,7 @@ on: - deps/nghttp2/** - deps/ngtcp2/** - deps/openssl/*/** + - deps/perfetto/** - deps/simdjson/** - deps/sqlite/** - deps/uv/** @@ -83,6 +84,7 @@ on: - deps/nghttp2/** - deps/ngtcp2/** - deps/openssl/*/** + - deps/perfetto/** - deps/simdjson/** - deps/sqlite/** - deps/uv/** diff --git a/Makefile b/Makefile index 4c285daa4387..b9c79d198774 100644 --- a/Makefile +++ b/Makefile @@ -1312,6 +1312,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1) $(RM) -r $(TARNAME)/deps/ngtcp2 find $(TARNAME)/deps/openssl -maxdepth 1 -type f ! -name 'nodejs-openssl.cnf' -exec $(RM) {} + find $(TARNAME)/deps/openssl -mindepth 1 -maxdepth 1 -type d -exec $(RM) -r {} + + $(RM) -r $(TARNAME)/deps/perfetto $(RM) -r $(TARNAME)/deps/simdjson $(RM) -r $(TARNAME)/deps/sqlite $(RM) -r $(TARNAME)/deps/uv diff --git a/configure.py b/configure.py index 5c2a398989af..fd6dcdacd616 100755 --- a/configure.py +++ b/configure.py @@ -524,6 +524,29 @@ dest='shared_openssl_libpath', help='a directory to search for the shared OpenSSL DLLs') +shared_optgroup.add_argument('--shared-perfetto', + action='store_true', + dest='shared_perfetto', + default=None, + help='link to a shared perfetto SDK instead of the one in deps/perfetto ' + '(requires --with-perfetto)') + +shared_optgroup.add_argument('--shared-perfetto-includes', + action='store', + dest='shared_perfetto_includes', + help='directory containing perfetto header files') + +shared_optgroup.add_argument('--shared-perfetto-libname', + action='store', + dest='shared_perfetto_libname', + default='perfetto', + help='alternative lib name to link to [default: %(default)s]') + +shared_optgroup.add_argument('--shared-perfetto-libpath', + action='store', + dest='shared_perfetto_libpath', + help='a directory to search for the shared perfetto DLL') + shared_optgroup.add_argument('--shared-uvwasi', action='store_true', dest='shared_uvwasi', @@ -2340,6 +2363,15 @@ def configure_lief(o): configure_library('lief', o, pkgname='LIEF') +def configure_perfetto(o): + if not options.with_perfetto: + if options.shared_perfetto: + error('--shared-perfetto requires --with-perfetto') + o['variables']['node_shared_perfetto'] = b(False) + return + + configure_library('perfetto', o) + def configure_sqlite(o): o['variables']['node_use_sqlite'] = b(not options.without_sqlite) if options.without_sqlite: @@ -2914,6 +2946,7 @@ def make_bin_override(): configure_library('nghttp3', output, pkgname='libnghttp3') configure_library('ngtcp2', output, pkgname='libngtcp2') configure_lief(output); +configure_perfetto(output); configure_sqlite(output); configure_ffi(output); configure_library('temporal_capi', output) diff --git a/deps/perfetto/perfetto.gyp b/deps/perfetto/perfetto.gyp index 083d0b386dd2..8dbccabd4b75 100644 --- a/deps/perfetto/perfetto.gyp +++ b/deps/perfetto/perfetto.gyp @@ -1,5 +1,6 @@ { 'variables': { + 'node_shared_perfetto%': 'false', 'perfetto_sdk_sources': [ 'sdk/perfetto.cc', 'sdk/perfetto.h', @@ -8,15 +9,23 @@ 'targets': [ { 'target_name': 'perfetto_sdk', - 'type': 'static_library', 'toolsets': ['host', 'target'], - 'include_dirs': [ 'sdk' ], - 'direct_dependent_settings': { - # Use like `#include "perfetto.h"` - 'include_dirs': [ 'sdk' ], - }, - 'sources': [ - '<@(perfetto_sdk_sources)', + 'conditions': [ + ['node_shared_perfetto=="true"', { + # The SDK comes from the system, `include_dirs` and `libraries` are + # provided by the configure script. + 'type': 'none', + }, { + 'type': 'static_library', + 'include_dirs': [ 'sdk' ], + 'direct_dependent_settings': { + # Use like `#include "perfetto.h"` + 'include_dirs': [ 'sdk' ], + }, + 'sources': [ + '<@(perfetto_sdk_sources)', + ], + }], ], }, ] diff --git a/node.gyp b/node.gyp index 22db3804d417..7b2208cf8c05 100644 --- a/node.gyp +++ b/node.gyp @@ -27,6 +27,7 @@ 'node_shared_nbytes%': 'false', 'node_shared_nghttp2%': 'false', 'node_shared_openssl%': 'false', + 'node_shared_perfetto%': 'false', 'node_shared_sqlite%': 'false', 'node_shared_ffi%': 'false', 'node_shared_temporal_capi%': 'false', @@ -939,8 +940,12 @@ 'sources': [ '<@(node_tracing_perfetto_sources)', ], - 'dependencies': [ - 'deps/perfetto/perfetto.gyp:perfetto_sdk', + 'conditions': [ + ['node_shared_perfetto=="false"', { + 'dependencies': [ + 'deps/perfetto/perfetto.gyp:perfetto_sdk', + ], + }], ], }, { 'sources': [ @@ -1398,7 +1403,7 @@ }, { 'sources!': [ '<@(node_cctest_quic_sources)' ], }], - [ 'v8_use_perfetto==1', { + [ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', { 'dependencies': [ 'deps/perfetto/perfetto.gyp:perfetto_sdk', ], @@ -1728,7 +1733,7 @@ 'NODE_USE_NODE_CODE_CACHE=1', ], }], - [ 'v8_use_perfetto==1', { + [ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', { 'dependencies': [ 'deps/perfetto/perfetto.gyp:perfetto_sdk', ], diff --git a/shell.nix b/shell.nix index b92f860431ac..33ed3e800d04 100644 --- a/shell.nix +++ b/shell.nix @@ -29,6 +29,7 @@ withSQLite withFFI withSSL + withPerfetto withTemporal ; } @@ -52,6 +53,7 @@ let useSharedAda = builtins.hasAttr "ada" sharedLibDeps; useSharedOpenSSL = builtins.hasAttr "openssl" sharedLibDeps; + useSharedPerfetto = builtins.hasAttr "perfetto" sharedLibDeps; useSharedTemporal = builtins.hasAttr "temporal_capi" sharedLibDeps; needsRustCompiler = withTemporal && !useSharedTemporal; @@ -64,6 +66,7 @@ let buildInputs = pkgs.lib.optional useSharedICU icu ++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) sharedLibDeps.abseil + ++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) sharedLibDeps.perfetto ++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi; # Put here only the configure flags that affect the V8 build @@ -77,6 +80,7 @@ let "--v8-${if withTemporal then "enable" else "disable"}-temporal-support" ] ++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil" + ++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) "--shared-perfetto" ++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi" ++ pkgs.lib.optional withPerfetto "--with-perfetto"; in diff --git a/tools/nix/sharedLibDeps.nix b/tools/nix/sharedLibDeps.nix index 1d5d14c285a8..59dec2cd7d19 100644 --- a/tools/nix/sharedLibDeps.nix +++ b/tools/nix/sharedLibDeps.nix @@ -5,6 +5,7 @@ withSQLite ? true, withSSL ? true, withFFI ? true, + withPerfetto ? false, withTemporal ? false, }: { @@ -51,6 +52,9 @@ // (pkgs.lib.optionalAttrs withSSL ({ inherit (import ./openssl-matrix.nix { inherit pkgs; }) openssl; })) +// (pkgs.lib.optionalAttrs withPerfetto { + perfetto = pkgs.perfetto.sdk; +}) // (pkgs.lib.optionalAttrs withTemporal { inherit (pkgs) temporal_capi; }) diff --git a/tools/nix/v8.nix b/tools/nix/v8.nix index 0338bff5ddb5..4099d06fa55a 100644 --- a/tools/nix/v8.nix +++ b/tools/nix/v8.nix @@ -45,9 +45,10 @@ let ../../tools/v8_gypfiles/v8.gyp ] ++ lib.optional (!useSharedAbseil) ../../tools/v8_gypfiles/abseil.gyp - ++ lib.optionals (builtins.elem "--with-perfetto" configureFlags) [ - ../../deps/perfetto - ] + ++ lib.optional ( + builtins.elem "--with-perfetto" configureFlags + && !(builtins.elem "--shared-perfetto" configureFlags) + ) ../../deps/perfetto ++ lib.optionals (icu != null) [ ../../tools/icu/icu_versions.json ../../tools/icu/icu-system.gyp diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index d46dfed3c8c4..6c225c93e706 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -293,7 +293,7 @@ '<(V8_ROOT)/src/init/setup-isolate-full.cc', ], 'conditions': [ - ['v8_use_perfetto==1', { + ['v8_use_perfetto==1 and node_shared_perfetto=="false"', { 'dependencies': [ '<(perfetto_gyp_file):perfetto_sdk', ], @@ -321,7 +321,7 @@ '