gm.py is working but v8gen.py is not (std::bit_cast not found)

27 views
Skip to first unread message

Juan dos Santos

unread,
Aug 25, 2025, 7:03:43 AM (13 days ago) Aug 25
to v8-dev
Hi everyone

When I run: 

tools/dev/gm.py x64.release 

Everything works fine but no libv8_monolith.a is created
So, I changed gm.py and add "v8_monolithic = true v8_use_external_startup_data = false" and run again.

RELEASE_ARGS_TEMPLATE = f"""\
is_component_build = false
is_debug = false
%s{BUILD_DISTRIBUTION_LINE}
v8_enable_backtrace = true
v8_enable_disassembler = true
v8_enable_object_print = true
v8_enable_verify_heap = true
dcheck_always_on = false
v8_monolithic = true
v8_use_external_startup_data = false
"""
 
and then run: 

autoninja -C out/x64.release

finally I have libv8_monolith.a

BUT....

if I run this command to make the configuration: 

tools/dev/v8gen.py x64.release.sample 

and then:

autoninja -C out.gn/x64.release.sample/ v8_monolith

the result is this error (basically std::bit_cast not found): 

offline mode
ninja: Entering directory `out.gn/x64.release.sample/'
2.01s load siso config
[1621/3672] 2m10.11s F CXX obj/torque_base/utils.o
FAILED: 8b1561ec-f17b-4ae5-b401-647b0752f4f7 "./obj/torque_base/utils.o" CXX obj/torque_base/utils.o
err: exit=1
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/torque_base/utils.o.d -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"llvmorg-21-init-16348-gbd809ffb-17\" -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -D_GLIBCXX_ASSERTIONS=1 -DCR_SYSROOT_KEY=20250129T203412Z-1 -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DENABLE_GDB_JIT_INTERFACE -DV8_INTL_SUPPORT -DV8_TEMPORAL_SUPPORT -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_ENABLE_FUZZTEST -DV8_SHORT_BUILTIN_CALLS -DV8_EXTERNAL_CODE_SPACE -DV8_ENABLE_SPARKPLUG -DV8_ENABLE_MAGLEV -DV8_ENABLE_TURBOFAN -DV8_ENABLE_WEBASSEMBLY -DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_STATIC_ROOTS -DV8_USE_ZLIB -DV8_USE_LIBM_TRIG_FUNCTIONS -DV8_ENABLE_WASM_SIMD256_REVEC -DV8_ENABLE_MAGLEV_GRAPH_PRINTER -DV8_ENABLE_BUILTIN_JUMP_TABLE_SWITCH -DV8_ENABLE_EXTENSIBLE_RO_SNAPSHOT -DV8_ENABLE_BLACK_ALLOCATED_PAGES -DV8_ENABLE_LEAPTIERING -DV8_WASM_RANDOM_FUZZERS -DV8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT=0 -DV8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT=0 -DV8_PROMISE_INTERNAL_FIELD_COUNT=0 -DV8_USE_DEFAULT_HASHER_SECRET=true -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DCPPGC_POINTER_COMPRESSION -DCPPGC_ENABLE_LARGER_CAGE -DCPPGC_SLIM_WRITE_BARRIER -DV8_TARGET_ARCH_X64 -DV8_RUNTIME_CALL_STATS -DABSL_ALLOCATOR_NOTHROW=1 -I../.. -Igen -I../../include -Igen/include -I../../third_party/abseil-cpp -Wall -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wgnu -Wno-gnu-anonymous-struct -Wno-gnu-conditional-omitted-operand -Wno-gnu-include-next -Wno-gnu-label-as-value -Wno-gnu-redeclared-enum -Wno-gnu-statement-expression -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-length-array -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-cast-function-type -Wno-thread-safety-reference-return -Wno-nontrivial-memcall -Wshadow -Werror -fno-delete-null-pointer-checks -fno-strict-overflow -fno-ident -fno-math-errno -fno-strict-aliasing -fstack-protector -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fno-sized-deallocation -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 -ffp-contract=off -Wa,--crel,--allow-experimental-crel --target=x86_64-unknown-linux-gnu -msse3 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -Xclang -fmodule-file-home-is-cwd -fno-omit-frame-pointer -g0 -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wunreachable-code -Wctad-maybe-unsupported -Xclang -add-plugin -Xclang blink-gc-plugin -Wno-invalid-offsetof -Wshorten-64-to-32 -Wmissing-field-initializers -Wunnecessary-virtual-specifier -O3 -fdata-sections -ffunction-sections -fno-unique-section-names -fvisibility=default -Wexit-time-destructors -Wno-invalid-offsetof -Wenum-compare-conditional -Wno-nullability-completeness -std=c++20 -Wno-trigraphs -gsimple-template-names --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fexceptions -frtti -c ../../src/torque/utils.cc -o obj/torque_base/utils.o
build step: cxx "./obj/torque_base/utils.o"
siso_rule: clang/cxx
stderr:
In file included from ../../src/torque/utils.cc:15:
In file included from ../../src/torque/ast.h:17:
In file included from ../../src/numbers/integer-literal.h:10:
In file included from ../../src/common/globals.h:22:
../../src/base/numbers/double.h:18:10: error: no template named 'bit_cast' in namespace 'std'; did you mean simply 'bit_cast'?
18 | return std::bit_cast<uint64_t>(d);
| ^~~~~~~~~~~~~
| bit_cast
../../src/base/macros.h:137:16: note: 'bit_cast' declared here
137 | V8_INLINE Dest bit_cast(Source const& source) {
| ^
In file included from ../../src/torque/utils.cc:15:
In file included from ../../src/torque/ast.h:17:
In file included from ../../src/numbers/integer-literal.h:10:
In file included from ../../src/common/globals.h:22:
../../src/base/numbers/double.h:18:10: error: no template named 'bit_cast' in namespace 'std'; did you mean simply 'bit_cast'?
18 | return std::bit_cast<uint64_t>(d);
| ^~~~~~~~~~~~~
| bit_cast
../../src/base/macros.h:137:16: note: 'bit_cast' declared here
137 | V8_INLINE Dest bit_cast(Source const& source) {
| ^
In file included from ../../src/torque/utils.cc:15:
In file included from ../../src/torque/ast.h:17:
In file included from ../../src/numbers/integer-literal.h:10:
In file included from ../../src/common/globals.h:22:
../../src/base/numbers/double.h:17:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
17 | inline constexpr uint64_t double_to_uint64(double d) {
| ^~~~~~~~~~~~~~~~
../../src/base/numbers/double.h:18:10: note: non-constexpr function 'bit_cast<unsigned long, double>' cannot be used in a constant expression
18 | return std::bit_cast<uint64_t>(d);
| ^
../../src/base/macros.h:137:16: note: declared here
137 | V8_INLINE Dest bit_cast(Source const& source) {
| ^
In file included from ../../src/torque/utils.cc:15:
In file included from ../../src/torque/ast.h:17:
In file included from ../../src/numbers/integer-literal.h:10:
In file included from ../../src/common/globals.h:22:
../../src/base/numbers/double.h:21:10: error: no template named 'bit_cast' in namespace 'std'; did you mean simply 'bit_cast'?
21 | return std::bit_cast<double>(d64);
| ^~~~~~~~~~~~~
| bit_cast
../../src/base/macros.h:137:16: note: 'bit_cast' declared here
137 | V8_INLINE Dest bit_cast(Source const& source) {
| ^
In file included from ../../src/torque/utils.cc:15:
In file included from ../../src/torque/ast.h:17:
In file included from ../../src/numbers/integer-literal.h:10:
In file included from ../../src/common/globals.h:22:
../../src/base/numbers/double.h:21:10: error: no template named 'bit_cast' in namespace 'std'; did you mean simply 'bit_cast'?
21 | return std::bit_cast<double>(d64);
| ^~~~~~~~~~~~~
| bit_cast
../../src/base/macros.h:137:16: note: 'bit_cast' declared here
137 | V8_INLINE Dest bit_cast(Source const& source) {
| ^
In file included from ../../src/torque/utils.cc:15:
In file included from ../../src/torque/ast.h:17:
In file included from ../../src/numbers/integer-literal.h:10:
In file included from ../../src/common/globals.h:22:
../../src/base/numbers/double.h:20:25: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
20 | inline constexpr double uint64_to_double(uint64_t d64) {
| ^~~~~~~~~~~~~~~~
../../src/base/numbers/double.h:21:10: note: non-constexpr function 'bit_cast<double, unsigned long>' cannot be used in a constant expression
21 | return std::bit_cast<double>(d64);
| ^
../../src/base/macros.h:137:16: note: declared here
137 | V8_INLINE Dest bit_cast(Source const& source) {
| ^
6 errors generated.

build failed
local:1622 remote:0 cache:0 cache-write:0(err:0) fallback:0 retry:0 skip:228
fs: ops: 79691(err:9091) / r:6974(err:0) 458.69MiB / w:1134(err:0) 124.94MiB
resource/capa used(err) wait-avg | s m | serv-avg | s m |
localexec/8 468(1) 1m04.64s |▂ ▂▂▆█ | 2.09s | ▂▂█ ▂ |

2m10.34s Build Failure: 1622 done 1 failed 2050 remaining - 12.44/s
1 steps failed: exit=1
see ./out.gn/x64.release.sample/siso_output for full command line and output
or ./out.gn/x64.release.sample/siso.INFO

use ./out.gn/x64.release.sample/siso_failed_commands.sh to re-run failed commands


Juan dos Santos

unread,
Aug 25, 2025, 10:50:01 AM (13 days ago) Aug 25
to v8-dev
Hi everyone again!

I found some problem with "use_custom_libcxx=false" this is the problem with v8gen.py . 

v8gen.py makes the configuration with  "use_custom_libcxx=false" so, with this, the problem found is "std::bit_cast" not found. 
I know I need the las clang with c++20, this is my version "clang version 18.1.3 (1ubuntu1) Target: x86_64-pc-linux-gnu"
I think I have the right libc with this clang version (or I don't ?? ) 

My disto is Ubuntu 24.04 (docker image: mcr.microsoft.com/vscode/devcontainers/cpp:1-ubuntu24.04)  

Then, I tried to complie with g++ but other errors appears (g++-14 gcc-14): 

is_component_build = false
is_debug = false
target_cpu = "x64"
v8_enable_sandbox = true

v8_enable_backtrace = true
v8_enable_disassembler = true
v8_enable_object_print = true
v8_enable_verify_heap = true
dcheck_always_on = false
v8_monolithic = true
v8_use_external_startup_data = false
is_clang=false
use_sysroot=false
 
Errors:

In file included from ../../third_party/libc++/src/include/__exception/exception_ptr.h:17,
                 from ../../third_party/libc++/src/include/exception:84,
                 from ../../third_party/libc++abi/src/src/cxa_vector.cpp:16:
../../third_party/libc++/src/include/__type_traits/decay.h:22:32: error: expected type-specifier before ‘__decay’
   22 |   using type _LIBCPP_NODEBUG = __decay(_Tp);
      |                                ^~~~~~~
In file included from ../../third_party/libc++/src/include/__exception/exception_ptr.h:18:
../../third_party/libc++/src/include/__type_traits/is_pointer.h:22:62: error: there are no arguments to ‘__is_pointer’ that depend on a template parameter, so a declaration of ‘__is_pointer’ must be available [-fpermissive]
   22 | struct _LIBCPP_NO_SPECIALIZATIONS is_pointer : _BoolConstant<__is_pointer(_Tp)> {};
      |                                                              ^~~~~~~~~~~~
../../third_party/libc++/src/include/__type_traits/is_pointer.h:22:62: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../third_party/libc++/src/include/__type_traits/is_pointer.h:22:79: error: template argument 1 is invalid
   22 | struct _LIBCPP_NO_SPECIALIZATIONS is_pointer : _BoolConstant<__is_pointer(_Tp)> {};

...
....(more errors)


So, v8_monolith.a was not created, and I didn't find any way to do it. 

Please help 
Juan dos Santos 


Leszek Swirski

unread,
Aug 25, 2025, 11:14:35 AM (13 days ago) Aug 25
to v8-...@googlegroups.com
Hi Juan,

Unfortunately we don't support configurations other than the bundled clang and libc++. Are you trying to use the system clang with the bundled libc++? A version mismatch there is likely to cause issues.

- Leszek

--
--
v8-dev mailing list
v8-...@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+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/v8-dev/460f6235-4181-410c-a3e6-e783d32906ben%40googlegroups.com.

Juan dos Santos

unread,
Aug 25, 2025, 11:23:58 AM (13 days ago) Aug 25
to v8-...@googlegroups.com
The problem is I have a project with g++ with v8 13.1 compiled and running with v8_monolith but when I try this new version I can’t compile v8_monolith. 

How can I embed this new v8 version ? 
Can I compile v8 for shared library, please tell me how? Or how is the right way to compile v8_monolith again ? With 
use_custom_libcxx=false I have errors, but v8gen.py ask for it to compile v8 monolith. 

Give the way and I will follow it :-) 

Thanks
Juan dos Santos 

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/CrekZPfbslw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-dev+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/v8-dev/CAGxd1t9PLbK57j1WXzZQGHbgYR5zf3ug8CCsLZSYmwGc1K8etQ%40mail.gmail.com.

Juan dos Santos

unread,
Aug 26, 2025, 5:05:03 PM (11 days ago) Aug 26
to v8-dev
I found a solution, de args.gn parameters for x64 compatible with g++ o gcc are:

target_os="linux"
target_cpu="x64"
v8_target_cpu="x64"
is_debug=false
dcheck_always_on=false
is_clang=false
is_component_build=false
strip_debug_info=true
symbol_level=0
treat_warnings_as_errors=false
use_custom_libcxx=false
v8_enable_gdbjit=false
v8_enable_i18n_support=false
v8_enable_pointer_compression=false
v8_enable_test_features=false
v8_monolithic=true
v8_use_external_startup_data=false
clang_use_chrome_plugins=false
enable_rust=false
target_sysroot_dir=""
use_rtti=false
use_sysroot=false
v8_deprecation_warnings=false
v8_enable_builtins_optimization=true
v8_enable_sandbox=false
v8_enable_snapshot_compression=false
v8_enable_temporal_support=false
v8_imminent_deprecation_warnings=false

I think these parameters make the magic "is_clang=false enable_rust=false use_sysroot=false target_sysroot_dir="" "  but use all of them.

I found this great page with the solution here: https://github.com/just-js/v8/blob/main/args.linux.x64.gn

There are all the "args.gn" configuration for different platforms. 

When I did the compilation only found one warning, nothing important.

Juan dos Santos 


Reply all
Reply to author
Forward
0 new messages