Bug: Apple Silicon compiliation error

Hello,

I am trying to build ArmorPaint from source and I am getting an error. Steps to re-produce,

Device: Apple Silicon Mac (tested with Mac Mini M1, Apple MacBook M3 Pro)

1.Compile amake

cd base/tools/amake
../../make --compile
cp build/build/Release/amake ../bin/macos/amake

2.Compile Armorpaint

../base/make
Using Iron from /Users/tarik/External/work/armorpaint/base
Creating macos project files.
Exporting asset 1 of 7 (color_wheel_gradient.png).
Exporting asset 2 of 7 (bnoise256.png).
Exporting asset 3 of 7 (font.ttf).
Exporting asset 4 of 7 (noise256.png).
Exporting asset 5 of 7 (text_coloring.json).
Exporting asset 6 of 7 (color_wheel.png).
Exporting asset 7 of 7 (font_mono.ttf).
Exporting asset 1 of 9 (license_lz4-wasm.md).
Exporting asset 2 of 9 (license.md).
Exporting asset 3 of 9 (license_sdcpp.md).
Exporting asset 4 of 9 (license_nfd.md).
Exporting asset 5 of 9 (license_kore.md).
Exporting asset 6 of 9 (license_icons.md).
Exporting asset 7 of 9 (license_llamacpp.md).
Exporting asset 8 of 9 (license_kongruent.md).
Exporting asset 9 of 9 (license_fonts.md).
Exporting asset 1 of 3 (black.json).
Exporting asset 2 of 3 (light.json).
Exporting asset 3 of 3 (darker.json).
Exporting asset 1 of 1 (font_cjk.ttc).
Exporting asset 1 of 3 (bnoise_sobol.png).
Exporting asset 2 of 3 (bnoise_scramble.png).
Exporting asset 3 of 3 (bnoise_rank.png).
Exporting asset 1 of 6 (raytrace_bake_light.metal).
Exporting asset 2 of 6 (raytrace_bake_bent.metal).
Exporting asset 3 of 6 (raytrace_brute_full.metal).
Exporting asset 4 of 6 (raytrace_bake_thick.metal).
Exporting asset 5 of 6 (raytrace_bake_ao.metal).
Exporting asset 6 of 6 (raytrace_brute_core.metal).
Exporting asset 1 of 1 (version.json).
Exporting asset 1 of 17 (cursor.png).
Exporting asset 2 of 17 (default_brush.arm).
Exporting asset 3 of 17 (icons2x.png).
Exporting asset 4 of 17 (default_material.arm).
Exporting asset 5 of 17 (api.h).
Exporting asset 6 of 17 (World_radiance.hdr).
Exporting asset 7 of 17 (icons.png).
Exporting asset 8 of 17 (cursor4x.png).
Exporting asset 9 of 17 (icons05x.png).
Exporting asset 10 of 17 (World_radiance_4.hdr).
Exporting asset 11 of 17 (badge_bw.png).
Exporting asset 12 of 17 (World_radiance_3.hdr).
Exporting asset 13 of 17 (badge.png).
Exporting asset 14 of 17 (World_radiance_2.hdr).
Exporting asset 15 of 17 (World_irradiance.arm).
Exporting asset 16 of 17 (World_radiance_0.hdr).
Exporting asset 17 of 17 (World_radiance_1.hdr).
Exporting asset 1 of 8 (unity.json).
Exporting asset 2 of 8 (unigine.json).
Exporting asset 3 of 8 (minecraft_mer.json).
Exporting asset 4 of 8 (generic.json).
Exporting asset 5 of 8 (unreal.json).
Exporting asset 6 of 8 (base_color.json).
Exporting asset 7 of 8 (xplane.json).
Exporting asset 8 of 8 (specular.json).
Exporting asset 1 of 2 (touch.json).
Exporting asset 2 of 2 (blender.json).
Exporting asset 1 of 5 (license.md).
Exporting asset 2 of 5 (license_cycles_nodes.md).
Exporting asset 3 of 5 (license_ufbx.md).
Exporting asset 4 of 5 (license_cgltf.md).
Exporting asset 5 of 5 (license_nanosvg.md).
Exporting asset 1 of 9 (import_stl.c).
Exporting asset 2 of 9 (hello_world.c).
Exporting asset 3 of 9 (make_tilesheet.c).
Exporting asset 4 of 9 (hello_node_brush.c).
Exporting asset 5 of 9 (autosave.c).
Exporting asset 6 of 9 (import_txt.c).
Exporting asset 7 of 9 (hello_node.c).
Exporting asset 8 of 9 (viewport_celshade.c).
Exporting asset 9 of 9 (converter.c).
Exporting asset 1 of 6 (box_bevel_shared_uvs.arm).
Exporting asset 2 of 6 (box.arm).
Exporting asset 3 of 6 (box_shared_uvs.arm).
Exporting asset 4 of 6 (cylinder.arm).
Exporting asset 5 of 6 (torus.arm).
Exporting asset 6 of 6 (cone.arm).
Exporting asset 1 of 1 (box_bevel.arm).
Exporting asset 1 of 12 (zh_cn.json).
Exporting asset 2 of 12 (ja.json).
Exporting asset 3 of 12 (de.json).
Exporting asset 4 of 12 (ru.json).
Exporting asset 5 of 12 (pl.json).
Exporting asset 6 of 12 (pt.json).
Exporting asset 7 of 12 (fr.json).
Exporting asset 8 of 12 (el.json).
Exporting asset 9 of 12 (ko.json).
Exporting asset 10 of 12 (cs.json).
Exporting asset 11 of 12 (id.json).
Exporting asset 12 of 12 (es.json).
Exporting asset 1 of 1 (readme.txt).
Compiling shader 1 of 6 (draw_image.kong).
Compiling shader 2 of 6 (draw_rect.kong).
Compiling shader 3 of 6 (draw_text.kong).
Compiling shader 4 of 6 (draw_tris.kong).
Compiling shader 5 of 6 (line_overlay.kong).
Compiling shader 6 of 6 (line.kong).
Compiling shader 1 of 30 (layer_tween.kong).
Compiling shader 2 of 30 (layer_merge.kong).
[1]    29081 segmentation fault  ../base/make

LLDB output

Compiling shader 2 of 30 (layer_merge.kong).
Process 29150 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x81101325648)
    frame #0: 0x00000001000949c8 amake`write_functions(code=<unavailable>, offset=0x000000016fdfab38) at kong_metal.c:344:54 [opt]
   341
   342                          size_t argument_buffer_index = 0;
   343
-> 344                          for (size_t set_index = 0; set_index < set_group->size; ++set_index) {
   345                                  descriptor_set *set = set_group->values[set_index];
   346
   347                                  if (set->name == add_name("root_constants")) {
Target 0: (amake) stopped.
warning: amake was compiled with optimization - stepping may behave oddly; variables may not be available.

Hello and apologizes for the delay,

1.Compile amake

Hm, something is wrong with kong shader compiler included in the amake binary. Do you get the same issue running pre-built amake included in the repo?

Hello,

The pre-compiled amake binary is able to compile the application and run, haven’t seen any issues on the latest main branch.

Edit: If I compile amake by myself, and then compile app, I am still getting the same error.