#28612

V fails to build with GC enabled on 32-bit powerpc: `v2(48980,0xf0403000) malloc: *** mmap(size=16777216) failed (error code=12)`

Openbarracuda156opened 1mo ago

Describe the bug

V fails to build with GC on 32-bit, and if built without GC, fails to build anything big, same mmap error.

Reproduction Steps

Run the build of V with GC enabled (either generally or for the last stage), or build V without GC and then try compiling lilly (or perhaps something else big enough).

Expected Behavior

V should compile on 32-bit and be able to compile dependents.

Current Behavior

:info:build ------------------------------------------
:info:build ------ imported modules: ------
:info:build ['strings', 'builtin.closure', 'math.bits', 'strconv', 'builtin', 'hash', 'strings.textscanner', 'term.termios', 'time', 'os.cmdline', 'v.token', 'v.dotgraph', 'hash.fnv1a', 'sync.stdatomic', 'sync.threads', 'encoding.utf8.validate', 'rand.buffer', 'semver', 'math.internal', 'os', 'v.errors', 'os.filelock', 'v.depgraph', 'math', 'rand.seed', 'term', 'v.help', 'v.util.version', 'v.vcache', 'v.vmod', 'v.util.recompilation', 'v.util.vflags', 'runtime', 'v.cflag', 'rand.config', 'rand.wyrand', 'rand', 'v.pref', 'sync', 'v.util', 'sync.pool', 'v.ast', 'v.scanner', 'v.ast.walker', 'v.transformer', 'v.comptime', 'v.generics', 'v.markused', 'v.type_resolver', 'flag', 'v.callgraph', 'v.gen.c', 'v.pkgconfig', 'v.checker', 'v.parser', 'v.builder', 'v.builder.cbuilder', 'main']
:info:build -------------------------------
:info:build 18.200   ms Builder.resolve_deps
:info:build 2372.687 ms Builder.parse_imports
:info:build 293.250  ms SCAN
:info:build 1892.941 ms PARSE
:info:build 2527.663 ms ALL_FRONT_STAGES
:info:build 0.187    ms Checker.generic_insts_to_concrete
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.min[int]`
:info:build inferred `math.min[int]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `math.abs[f64]`
:info:build inferred `flag.flag_default_value[bool]`
:info:build inferred `flag.flag_default_value[int]`
:info:build inferred `flag.flag_default_value[f64]`
:info:build inferred `flag.flag_default_value[string]`
:info:build inferred `work_on_items[&ast.File]`
:info:build inferred `work_on_items[string]`
:info:build 0.068    ms Checker.generic_insts_to_concrete.after_check
:info:build 2341.579 ms CHECK
:info:build 108.893  ms COMPTIME
:info:build 275.685  ms TRANSFORM
:info:build 3.930    ms Table.complete_interface_check
:info:build 51.870   ms all_global_decl
:info:build 794.060  ms MARKUSED
:info:build 0.173    ms Gen.write_sorted_fn_typesymbol_declaration
:info:build 23.033   ms Gen.sort_structs
:info:build 41.917   ms cgen init
:info:build v2(48980,0xf0403000) malloc: *** mmap(size=16777216) failed (error code=12)
:info:build *** error: can't allocate region
:info:build *** set a breakpoint in malloc_error_break to debug
:info:build malloc_noscan(0x100b7)
:info:build ================ V panic ================
:info:build    module: builtin
:info:build  function: _memory_panic()
:info:build   message: memory allocation failure
:info:build      file: /opt/local/var/macports/build/vlang-f756e305/work/v-0.5.2/vlib/builtin/allocation.c.v:27
:info:build    v hash: 
:info:build       pid: 0xbf54
:info:build       tid: 0xf0403000
:info:build =========================================
:info:build 0   v2                                  0x003be610 v__gen__c__stable_type_symbol_method_key + 0
:info:build 1   v2                                  0x003be090 v__gen__c__Gen_stable_type_symbol_key + 4664
:info:build 2   v2                                  0x003bda0c v__gen__c__Gen_stable_type_symbol_key + 2996
:info:build 3   v2                                  0x003bd774 v__gen__c__Gen_stable_type_symbol_key + 2332
:info:build 4   v2                                  0x003be470 v__gen__c__stable_type_symbol_field_key + 308
:info:build 5   v2                                  0x003be090 v__gen__c__Gen_stable_type_symbol_key + 4664
:info:build 6   v2                                  0x003be470 v__gen__c__stable_type_symbol_field_key + 308
:info:build 7   v2                                  0x003be090 v__gen__c__Gen_stable_type_symbol_key + 4664
:info:build 8   v2                                  0x003be470 v__gen__c__stable_type_symbol_field_key + 308
:info:build 9   v2                                  0x003be090 v__gen__c__Gen_stable_type_symbol_key + 4664
:info:build 10  v2                                  0x003be298 v__gen__c__Gen_stable_type_symbol_hash + 268
:info:build 11  v2                                  0x00264d28 v__gen__c__Gen_boehm_collect_keep_alive_helper_name + 944
:info:build 12  v2                                  0x005cbdf0 v__gen__c__Gen_scope_gc_pin_pregen.part.0 + 1316
:info:build 13  v2                                  0x0025c384 v__gen__c__Gen_scope_gc_pin_pregen + 104
:info:build 14  v2                                  0x0023e950 v__gen__c__Gen_stmt + 8128
:info:build 15  v2                                  0x002410f0 v__gen__c__Gen_stmts_with_tmp_var.constprop.0.isra.0 + 268
:info:build 16  v2                                  0x002e01d8 v__gen__c__Gen_gen_fn_decl + 10268
:info:build 17  v2                                  0x002e2970 v__gen__c__Gen_fn_decl + 872
:info:build 18  v2                                  0x0023e71c v__gen__c__Gen_stmt + 7564
:info:build 19  v2                                  0x002410f0 v__gen__c__Gen_stmts_with_tmp_var.constprop.0.isra.0 + 268
:info:build 20  v2                                  0x00217994 v__gen__c__Gen_gen_file + 424
:info:build 21  v2                                  0x00219300 v__gen__c__cgen_process_one_file_cb + 5320
:info:build 22  v2                                  0x000e6744 sync__pool__process_in_thread + 132
:info:build 23  v2                                  0x00037518 sync__pool__process_in_thread_thread_wrapper.lto_priv.0 + 52
:info:build 24  libSystem.B.dylib                   0x90e36ec4 _pthread_start + 324
:info:build make: *** [all] Error 1

Possible Solution

No response

Additional Information/Context

V builds fine without GC and can build minimal dependents, but fails to compile something huge, for example lilly:

:debug:build VTMP='/opt/local/var/macports/build/lilly-fff380c1/work/.vtmp'
:info:build Executing:  cd "/opt/local/var/macports/build/lilly-fff380c1/work/lilly-2538ee87a173aeda35c70fc922b16784d2abfdc7" && /opt/local/bin/v -prod -show-c-output -cc /opt/local/bin/gcc-mp-16 -cflags -x\ objective-c\ -isystem/opt/local/include/LegacySupport\ -I/opt/local/include\ -Os\ -w -ldflags -Wl\,-headerpad_max_install_names\ -L/opt/local/lib\ -lMacportsLegacySupport\ -latomic -o /opt/local/var/macports/build/lilly-fff380c1/work/lilly /opt/local/var/macports/build/lilly-fff380c1/work/lilly-2538ee87a173aeda35c70fc922b16784d2abfdc7 
:debug:build system:  cd "/opt/local/var/macports/build/lilly-fff380c1/work/lilly-2538ee87a173aeda35c70fc922b16784d2abfdc7" && /opt/local/bin/v -prod -show-c-output -cc /opt/local/bin/gcc-mp-16 -cflags -x\ objective-c\ -isystem/opt/local/include/LegacySupport\ -I/opt/local/include\ -Os\ -w -ldflags -Wl\,-headerpad_max_install_names\ -L/opt/local/lib\ -lMacportsLegacySupport\ -latomic -o /opt/local/var/macports/build/lilly-fff380c1/work/lilly /opt/local/var/macports/build/lilly-fff380c1/work/lilly-2538ee87a173aeda35c70fc922b16784d2abfdc7 
:info:build /opt/local/var/macports/build/lilly-fff380c1/work/.vmodules/bobatea/key.v:131:6: notice: variable `event` shadows a function declaration
:info:build   129 |     ch := buf[0]
:info:build   130 | 
:info:build   131 |     mut event := &tui.Event{
:info:build       |         ~~~~~
:info:build   132 |         typ:   .key_down
:info:build   133 |         ascii: ch
:info:build /opt/local/var/macports/build/lilly-fff380c1/work/.vmodules/bobatea/key.v:172:6: notice: variable `event` shadows a function declaration
:info:build   170 |     ch := buf[0]
:info:build   171 | 
:info:build   172 |     mut event := &tui.Event{
:info:build       |         ~~~~~
:info:build   173 |         typ:   .key_down
:info:build   174 |         ascii: ch
:info:build lib/syntax/syntax.v:77:2: notice: variable `v_syntax` shadows a function declaration
:info:build    75 | 
:info:build    76 | pub fn load_builtin_syntaxes() []Syntax {
:info:build    77 |     v_syntax := json2.decode[Syntax](builtin_v_syntax) or {
:info:build       |     ~~~~~~~~
:info:build    78 |         panic('builtin V syntax file failed to decode: ${err}')
:info:build    79 |     }
:info:build editor_workspace2.v:777:4: notice: unused function: `emit_focused`
:info:build   775 | }
:info:build   776 | 
:info:build   777 | fn emit_focused() tea.Msg {
:info:build       |    ~~~~~~~~~~~~
:info:build   778 |     return tea.FocusedMsg{}
:info:build   779 | }
:info:build v(36671,0xa0260620) malloc: *** mmap(size=16777216) failed (error code=12)
:info:build *** error: can't allocate region
:info:build *** set a breakpoint in malloc_error_break to debug
:info:build malloc_noscan(0x1001)
:info:build ================ V panic ================
:info:build    module: builtin
:info:build  function: _memory_panic()
:info:build   message: memory allocation failure
:info:build      file: /opt/local/var/macports/build/vlang-f756e305/work/v-0.5.2/vlib/builtin/allocation.c.v:27
:info:build    v hash: 
:info:build       pid: 0x8f3f
:info:build       tid: 0xa0260620
:info:build =========================================
:info:build 0   v                                   0x00089f60 v__dotgraph__DotGraph_finish + 0
:info:build 1   v                                   0x00098808 os__execute + 396
:info:build 2   v                                   0x00594220 v__builder__Builder_cc + 3508
:info:build 3   v                                   0x005ae524 v__builder__Builder_rebuild + 100
:info:build 4   v                                   0x005a4a10 v__builder__compile + 512
:info:build 5   v                                   0x005e60bc main + 72
:info:build 6   v                                   0x000023f4 start + 68
:info:build Command failed:  cd "/opt/local/var/macports/build/lilly-fff380c1/work/lilly-2538ee87a173aeda35c70fc922b16784d2abfdc7" && /opt/local/bin/v -prod -show-c-output -cc /opt/local/bin/gcc-mp-16 -cflags -x\ objective-c\ -isystem/opt/local/include/LegacySupport\ -I/opt/local/include\ -Os\ -w -ldflags -Wl\,-headerpad_max_install_names\ -L/opt/local/lib\ -lMacportsLegacySupport\ -latomic -o /opt/local/var/macports/build/lilly-fff380c1/work/lilly /opt/local/var/macports/build/lilly-fff380c1/work/lilly-2538ee87a173aeda35c70fc922b16784d2abfdc7 
:info:build Exit code: 1

V version

0.5.2

Environment details (OS name and version, etc.)

macOS 10.6.8 / powerpc gcc 16.1.0

Activity

0

No activity yet.