rusty_v8 icon indicating copy to clipboard operation
rusty_v8 copied to clipboard

Document how to build from source with full debuginfo

Open lrowe opened this issue 8 months ago • 2 comments

The debug build includes only partial debuginfo to save space but this makes gdb info args and info locals error with No symbol table info available.

There is probably a better way of doing this using $GN_ARGS but I am not familiar with GN and was not able to make it work so took the following approach.

  • Clone rusty_v8 and comment out three lines in .gn.
  # Minimize size of debuginfo in distributed static library.
  #line_tables_only = true
  #no_inline_line_tables = true
  #symbol_level = 1
  use_debug_fission = false. # Always want this one
  • Build librusty_v8.a with V8_FROM_SOURCE=1 cargo build -vv.

  • Build own project with RUSTY_V8_ARCHIVE=/path/to/rusty_v8/target/debug/gn_out/obj/librusty_v8.a V8_FORCE_DEBUG=1 cargo build

The static lib with full debuginfo is 3.6GB so it wouldn't make sense to change the default here, but it would be great if it could be made a one liner.

lrowe avatar Mar 26 '25 21:03 lrowe

passing V8_FROM_SOURCE=1 GN_ARGS="line_tables_only=false no_inline_line_tables=false symbol_level=2 use_debug_fission=false" should work i think.

devsnek avatar Mar 26 '25 22:03 devsnek

Thanks! That works but it is necessary to remove the target directory for the change to show up. You can see this by running the following which seems to show that target/debug/gn_out/args.gn is not invalidated when the env var changes.

$ V8_FROM_SOURCE=1 PRINT_GN_ARGS=1 GN_ARGS="line_tables_only=false no_inline_line_tables=false symbol_level=2" cargo build -vv
...
[v8 135.1.0] symbol_level
[v8 135.1.0]     Current value = 2
[v8 135.1.0]       From //target/debug/gn_out/args.gn:8
[v8 135.1.0]     Overridden from the default = -1
[v8 135.1.0]       From //build/config/compiler/compiler.gni:56
...
$ V8_FROM_SOURCE=1 PRINT_GN_ARGS=1 GN_ARGS="line_tables_only=false no_inline_line_tables=false symbol_level=1" cargo build -vv
...
[v8 135.1.0] symbol_level
[v8 135.1.0]     Current value = 2
[v8 135.1.0]       From //target/debug/gn_out/args.gn:8
[v8 135.1.0]     Overridden from the default = -1
[v8 135.1.0]       From //build/config/compiler/compiler.gni:56
...
$ rm -rf target
$ V8_FROM_SOURCE=1 PRINT_GN_ARGS=1 GN_ARGS="line_tables_only=false no_inline_line_tables=false symbol_level=1" cargo build -vv
[v8 135.1.0] v8_symbol_level
[v8 135.1.0]     Current value (from the default) = 1
[v8 135.1.0]       From //v8/gni/v8.gni:68

lrowe avatar Mar 26 '25 23:03 lrowe