macos build #1

Closed
opened 2 years ago by offbyn · 10 comments
offbyn commented 2 years ago
Owner

it builds with

diff --git a/build.zig b/build.zig
index f6ea0ed..e0ffe06 100644
--- a/build.zig
+++ b/build.zig
@@ -20,6 +20,8 @@ pub fn build(b: *std.build.Builder) void {
 
     ngui.addIncludePath("lib");
     ngui.addIncludePath("src/ui/c");
+    ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include");
+    ngui.addLibraryPath("/usr/local/Cellar/sdl2/2.24.0/lib");
     ngui.linkLibC();
 
     const lvgl_flags = &.{

with zig 0.10.0-dev

it builds with ```diff diff --git a/build.zig b/build.zig index f6ea0ed..e0ffe06 100644 --- a/build.zig +++ b/build.zig @@ -20,6 +20,8 @@ pub fn build(b: *std.build.Builder) void { ngui.addIncludePath("lib"); ngui.addIncludePath("src/ui/c"); + ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include"); + ngui.addLibraryPath("/usr/local/Cellar/sdl2/2.24.0/lib"); ngui.linkLibC(); const lvgl_flags = &.{ ``` with zig 0.10.0-dev
offbyn changed title from doesn't build on macos to macos build 2 years ago
x1ddos commented 2 years ago
Owner

in this repo here, they link sdl2 lower case:
https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312

i wonder if it makes any difference. need to try it out.

in this repo here, they link `sdl2` lower case: https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312 i wonder if it makes any difference. need to try it out.
offbyn commented 2 years ago
Poster
Owner

in this repo here, they link sdl2 lower case:
https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312

i wonder if it makes any difference. need to try it out.

+    // ngui.addLibraryPath("/usr/local/Cellar/sdl2/2.24.0/lib");
+    ngui.linkSystemLibrary("sdl2");

builds and runs 🎉 , but it still needs ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include");.

I also tried with ngui.addIncludePath("/usr/local/include/SDL2"); instead but that also errors

> in this repo here, they link `sdl2` lower case: > https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312 > > i wonder if it makes any difference. need to try it out. ```diff + // ngui.addLibraryPath("/usr/local/Cellar/sdl2/2.24.0/lib"); + ngui.linkSystemLibrary("sdl2"); ``` builds and runs 🎉 , but it still needs `ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include");`. I also tried with `ngui.addIncludePath("/usr/local/include/SDL2");` instead but that also errors
x1ddos commented 2 years ago
Owner

hey, a couple questions:

  • if you revert to how it all was before, without the extra addIncludePath and addLibraryPath, could you post the whole output here? i forgot what the actual error was.
  • what do brew --prefix sdl2 and ls $(brew --prefix sdl2) show?
  • is there anything in /usr/local/include or ls /usr/local/lib?
hey, a couple questions: - if you revert to how it all was before, without the extra `addIncludePath` and `addLibraryPath`, could you post the whole output here? i forgot what the actual error was. - what do `brew --prefix sdl2` and `ls $(brew --prefix sdl2)` show? - is there anything in `/usr/local/include` or `ls /usr/local/lib`?
x1ddos added the
dev
label 2 years ago
offbyn commented 2 years ago
Poster
Owner

with 7226c31dfb (replaced my /Users path so it is a bit shorter)

% zig build ngui

error(compilation): clang failed with stderr: In file included from ndg/src/ui/c/drv_sdl2.c:7:
In file included from ndg/lib/lv_drivers/sdl/sdl.h:26:
ndg/lib/lv_drivers/sdl/sdl_common.h:35:10: fatal error: 'SDL2/SDL.h' file not found
ndg/src/ui/c/lv_drv_conf.h:102:31: note: expanded from macro 'SDL_INCLUDE_PATH'
<scratch space>:376:1: note: expanded from here

error(compilation): clang failed with stderr: In file included from ndg/lib/lv_drivers/sdl/sdl_common.c:5:
ndg/lib/lv_drivers/sdl/sdl_common.h:35:10: fatal error: 'SDL2/SDL.h' file not found
ndg/src/ui/c/lv_drv_conf.h:102:31: note: expanded from macro 'SDL_INCLUDE_PATH'
<scratch space>:376:1: note: expanded from here

Compile C Objects [5/155] lv_font_courierprimecode_16.c... error(compilation): clang failed with stderr: In file included from ndg/lib/lv_drivers/sdl/sdl.c:9:
In file included from ndg/lib/lv_drivers/sdl/sdl.h:26:
ndg/lib/lv_drivers/sdl/sdl_common.h:35:10: fatal error: 'SDL2/SDL.h' file not found
ndg/src/ui/c/lv_drv_conf.h:102:31: note: expanded from macro 'SDL_INCLUDE_PATH'
<scratch space>:376:1: note: expanded from here

ndg/src/ui/c/drv_sdl2.c:1:1: error: unable to build C object: clang exited with code 1
ndg/lib/lv_drivers/sdl/sdl_common.c:1:1: error: unable to build C object: clang exited with code 1
ndg/lib/lv_drivers/sdl/sdl.c:1:1: error: unable to build C object: clang exited with code 1
error: ngui...
error: The following command exited with error code 1:
~/tools/zig/zig build-exe -fstage1 ndg/src/ngui.zig -lc -cflags -std=c11 -fstack-protector -Wall -Wextra -Wformat -Wformat-security -Wundef -- ndg/lib/lvgl/src/core/lv_disp.c ndg/lib/lvgl/src/core/lv_event.c ndg/lib/lvgl/src/core/lv_group.c ndg/lib/lvgl/src/core/lv_indev.c ndg/lib/lvgl/src/core/lv_indev_scroll.c ndg/lib/lvgl/src/core/lv_obj.c ndg/lib/lvgl/src/core/lv_obj_class.c ndg/lib/lvgl/src/core/lv_obj_draw.c ndg/lib/lvgl/src/core/lv_obj_pos.c ndg/lib/lvgl/src/core/lv_obj_scroll.c ndg/lib/lvgl/src/core/lv_obj_style.c ndg/lib/lvgl/src/core/lv_obj_style_gen.c ndg/lib/lvgl/src/core/lv_obj_tree.c ndg/lib/lvgl/src/core/lv_refr.c ndg/lib/lvgl/src/core/lv_theme.c ndg/lib/lvgl/src/draw/arm2d/lv_gpu_arm2d.c ndg/lib/lvgl/src/draw/lv_draw.c ndg/lib/lvgl/src/draw/lv_draw_arc.c ndg/lib/lvgl/src/draw/lv_draw_img.c ndg/lib/lvgl/src/draw/lv_draw_label.c ndg/lib/lvgl/src/draw/lv_draw_layer.c ndg/lib/lvgl/src/draw/lv_draw_line.c ndg/lib/lvgl/src/draw/lv_draw_mask.c ndg/lib/lvgl/src/draw/lv_draw_rect.c ndg/lib/lvgl/src/draw/lv_draw_transform.c ndg/lib/lvgl/src/draw/lv_draw_triangle.c ndg/lib/lvgl/src/draw/lv_img_buf.c ndg/lib/lvgl/src/draw/lv_img_cache.c ndg/lib/lvgl/src/draw/lv_img_decoder.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_arc.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_bg.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_composite.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_img.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_label.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_layer.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_line.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_mask.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_polygon.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_rect.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_stack_blur.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_texture_cache.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_utils.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_arc.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_blend.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_dither.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_gradient.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_img.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_layer.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_letter.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_line.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_polygon.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_rect.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_transform.c ndg/lib/lvgl/src/extra/layouts/flex/lv_flex.c ndg/lib/lvgl/src/extra/layouts/grid/lv_grid.c ndg/lib/lvgl/src/extra/libs/bmp/lv_bmp.c ndg/lib/lvgl/src/extra/libs/ffmpeg/lv_ffmpeg.c ndg/lib/lvgl/src/extra/libs/freetype/lv_freetype.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_fatfs.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_posix.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_stdio.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_win32.c ndg/lib/lvgl/src/extra/libs/gif/gifdec.c ndg/lib/lvgl/src/extra/libs/gif/lv_gif.c ndg/lib/lvgl/src/extra/libs/png/lodepng.c ndg/lib/lvgl/src/extra/libs/png/lv_png.c ndg/lib/lvgl/src/extra/libs/qrcode/lv_qrcode.c ndg/lib/lvgl/src/extra/libs/qrcode/qrcodegen.c ndg/lib/lvgl/src/extra/libs/rlottie/lv_rlottie.c ndg/lib/lvgl/src/extra/libs/sjpg/lv_sjpg.c ndg/lib/lvgl/src/extra/libs/sjpg/tjpgd.c ndg/lib/lvgl/src/extra/lv_extra.c ndg/lib/lvgl/src/extra/others/fragment/lv_fragment.c ndg/lib/lvgl/src/extra/others/fragment/lv_fragment_manager.c ndg/lib/lvgl/src/extra/others/gridnav/lv_gridnav.c ndg/lib/lvgl/src/extra/others/ime/lv_ime_pinyin.c ndg/lib/lvgl/src/extra/others/imgfont/lv_imgfont.c ndg/lib/lvgl/src/extra/others/monkey/lv_monkey.c ndg/lib/lvgl/src/extra/others/msg/lv_msg.c ndg/lib/lvgl/src/extra/others/snapshot/lv_snapshot.c ndg/lib/lvgl/src/extra/themes/basic/lv_theme_basic.c ndg/lib/lvgl/src/extra/themes/default/lv_theme_default.c ndg/lib/lvgl/src/extra/themes/mono/lv_theme_mono.c ndg/lib/lvgl/src/extra/widgets/animimg/lv_animimg.c ndg/lib/lvgl/src/extra/widgets/calendar/lv_calendar.c ndg/lib/lvgl/src/extra/widgets/calendar/lv_calendar_header_arrow.c ndg/lib/lvgl/src/extra/widgets/calendar/lv_calendar_header_dropdown.c ndg/lib/lvgl/src/extra/widgets/chart/lv_chart.c ndg/lib/lvgl/src/extra/widgets/colorwheel/lv_colorwheel.c ndg/lib/lvgl/src/extra/widgets/imgbtn/lv_imgbtn.c ndg/lib/lvgl/src/extra/widgets/keyboard/lv_keyboard.c ndg/lib/lvgl/src/extra/widgets/led/lv_led.c ndg/lib/lvgl/src/extra/widgets/list/lv_list.c ndg/lib/lvgl/src/extra/widgets/menu/lv_menu.c ndg/lib/lvgl/src/extra/widgets/meter/lv_meter.c ndg/lib/lvgl/src/extra/widgets/msgbox/lv_msgbox.c ndg/lib/lvgl/src/extra/widgets/span/lv_span.c ndg/lib/lvgl/src/extra/widgets/spinbox/lv_spinbox.c ndg/lib/lvgl/src/extra/widgets/spinner/lv_spinner.c ndg/lib/lvgl/src/extra/widgets/tabview/lv_tabview.c ndg/lib/lvgl/src/extra/widgets/tileview/lv_tileview.c ndg/lib/lvgl/src/extra/widgets/win/lv_win.c ndg/lib/lvgl/src/font/lv_font.c ndg/lib/lvgl/src/font/lv_font_fmt_txt.c ndg/lib/lvgl/src/font/lv_font_loader.c ndg/lib/lvgl/src/hal/lv_hal_disp.c ndg/lib/lvgl/src/hal/lv_hal_indev.c ndg/lib/lvgl/src/hal/lv_hal_tick.c ndg/lib/lvgl/src/misc/lv_anim.c ndg/lib/lvgl/src/misc/lv_anim_timeline.c ndg/lib/lvgl/src/misc/lv_area.c ndg/lib/lvgl/src/misc/lv_async.c ndg/lib/lvgl/src/misc/lv_bidi.c ndg/lib/lvgl/src/misc/lv_color.c ndg/lib/lvgl/src/misc/lv_fs.c ndg/lib/lvgl/src/misc/lv_gc.c ndg/lib/lvgl/src/misc/lv_ll.c ndg/lib/lvgl/src/misc/lv_log.c ndg/lib/lvgl/src/misc/lv_lru.c ndg/lib/lvgl/src/misc/lv_math.c ndg/lib/lvgl/src/misc/lv_mem.c ndg/lib/lvgl/src/misc/lv_printf.c ndg/lib/lvgl/src/misc/lv_style.c ndg/lib/lvgl/src/misc/lv_style_gen.c ndg/lib/lvgl/src/misc/lv_templ.c ndg/lib/lvgl/src/misc/lv_timer.c ndg/lib/lvgl/src/misc/lv_tlsf.c ndg/lib/lvgl/src/misc/lv_txt.c ndg/lib/lvgl/src/misc/lv_txt_ap.c ndg/lib/lvgl/src/misc/lv_utils.c ndg/lib/lvgl/src/widgets/lv_arc.c ndg/lib/lvgl/src/widgets/lv_bar.c ndg/lib/lvgl/src/widgets/lv_btn.c ndg/lib/lvgl/src/widgets/lv_btnmatrix.c ndg/lib/lvgl/src/widgets/lv_canvas.c ndg/lib/lvgl/src/widgets/lv_checkbox.c ndg/lib/lvgl/src/widgets/lv_dropdown.c ndg/lib/lvgl/src/widgets/lv_img.c ndg/lib/lvgl/src/widgets/lv_label.c ndg/lib/lvgl/src/widgets/lv_line.c ndg/lib/lvgl/src/widgets/lv_objx_templ.c ndg/lib/lvgl/src/widgets/lv_roller.c ndg/lib/lvgl/src/widgets/lv_slider.c ndg/lib/lvgl/src/widgets/lv_switch.c ndg/lib/lvgl/src/widgets/lv_table.c ndg/lib/lvgl/src/widgets/lv_textarea.c -cflags -std=c11 -Wall -Wextra -Wshadow -Wundef -Wunused-parameter -Werror -- ndg/src/ui/c/ui.c ndg/src/ui/c/lv_font_courierprimecode_14.c ndg/src/ui/c/lv_font_courierprimecode_16.c ndg/src/ui/c/lv_font_courierprimecode_24.c -cflags -std=c11 -fstack-protector -Wall -Wextra -Wformat -Wformat-security -Wundef -- ndg/lib/lv_drivers/sdl/sdl.c ndg/lib/lv_drivers/sdl/sdl_common.c -cflags -std=c11 -Wall -Wextra -Wshadow -Wundef -Wunused-parameter -Werror -- ndg/src/ui/c/drv_sdl2.c -lSDL2 --cache-dir ndg/zig-cache --global-cache-dir ~/.cache/zig --name ngui -I ndg/lib -I ndg/src/ui/c -D NM_DISP_HOR=800 -D NM_DISP_VER=480 -D LV_CONF_INCLUDE_SIMPLE -D LV_TICK_CUSTOM=1 -D LV_TICK_CUSTOM_INCLUDE="ui.h" -D LV_TICK_CUSTOM_SYS_TIME_EXPR=(nm_get_curr_tick()) -D NM_DRV_SDL2 -D USE_SDL -fPIE --enable-cache 
error: the following build command failed with exit code 1:
ndg/zig-cache/o/53cabcf5debd11fe2a7c49e20e95539c/build ~/tools/zig/zig ndg ndg/zig-cache ~/.cache/zig ngui
with 7226c31dfbbefd3f182b72ab1e4ab31f11ea0f83 (replaced my /Users path so it is a bit shorter) ```bash % zig build ngui error(compilation): clang failed with stderr: In file included from ndg/src/ui/c/drv_sdl2.c:7: In file included from ndg/lib/lv_drivers/sdl/sdl.h:26: ndg/lib/lv_drivers/sdl/sdl_common.h:35:10: fatal error: 'SDL2/SDL.h' file not found ndg/src/ui/c/lv_drv_conf.h:102:31: note: expanded from macro 'SDL_INCLUDE_PATH' <scratch space>:376:1: note: expanded from here error(compilation): clang failed with stderr: In file included from ndg/lib/lv_drivers/sdl/sdl_common.c:5: ndg/lib/lv_drivers/sdl/sdl_common.h:35:10: fatal error: 'SDL2/SDL.h' file not found ndg/src/ui/c/lv_drv_conf.h:102:31: note: expanded from macro 'SDL_INCLUDE_PATH' <scratch space>:376:1: note: expanded from here Compile C Objects [5/155] lv_font_courierprimecode_16.c... error(compilation): clang failed with stderr: In file included from ndg/lib/lv_drivers/sdl/sdl.c:9: In file included from ndg/lib/lv_drivers/sdl/sdl.h:26: ndg/lib/lv_drivers/sdl/sdl_common.h:35:10: fatal error: 'SDL2/SDL.h' file not found ndg/src/ui/c/lv_drv_conf.h:102:31: note: expanded from macro 'SDL_INCLUDE_PATH' <scratch space>:376:1: note: expanded from here ndg/src/ui/c/drv_sdl2.c:1:1: error: unable to build C object: clang exited with code 1 ndg/lib/lv_drivers/sdl/sdl_common.c:1:1: error: unable to build C object: clang exited with code 1 ndg/lib/lv_drivers/sdl/sdl.c:1:1: error: unable to build C object: clang exited with code 1 error: ngui... error: The following command exited with error code 1: ~/tools/zig/zig build-exe -fstage1 ndg/src/ngui.zig -lc -cflags -std=c11 -fstack-protector -Wall -Wextra -Wformat -Wformat-security -Wundef -- ndg/lib/lvgl/src/core/lv_disp.c ndg/lib/lvgl/src/core/lv_event.c ndg/lib/lvgl/src/core/lv_group.c ndg/lib/lvgl/src/core/lv_indev.c ndg/lib/lvgl/src/core/lv_indev_scroll.c ndg/lib/lvgl/src/core/lv_obj.c ndg/lib/lvgl/src/core/lv_obj_class.c ndg/lib/lvgl/src/core/lv_obj_draw.c ndg/lib/lvgl/src/core/lv_obj_pos.c ndg/lib/lvgl/src/core/lv_obj_scroll.c ndg/lib/lvgl/src/core/lv_obj_style.c ndg/lib/lvgl/src/core/lv_obj_style_gen.c ndg/lib/lvgl/src/core/lv_obj_tree.c ndg/lib/lvgl/src/core/lv_refr.c ndg/lib/lvgl/src/core/lv_theme.c ndg/lib/lvgl/src/draw/arm2d/lv_gpu_arm2d.c ndg/lib/lvgl/src/draw/lv_draw.c ndg/lib/lvgl/src/draw/lv_draw_arc.c ndg/lib/lvgl/src/draw/lv_draw_img.c ndg/lib/lvgl/src/draw/lv_draw_label.c ndg/lib/lvgl/src/draw/lv_draw_layer.c ndg/lib/lvgl/src/draw/lv_draw_line.c ndg/lib/lvgl/src/draw/lv_draw_mask.c ndg/lib/lvgl/src/draw/lv_draw_rect.c ndg/lib/lvgl/src/draw/lv_draw_transform.c ndg/lib/lvgl/src/draw/lv_draw_triangle.c ndg/lib/lvgl/src/draw/lv_img_buf.c ndg/lib/lvgl/src/draw/lv_img_cache.c ndg/lib/lvgl/src/draw/lv_img_decoder.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_arc.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_bg.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_composite.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_img.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_label.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_layer.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_line.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_mask.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_polygon.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_rect.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_stack_blur.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_texture_cache.c ndg/lib/lvgl/src/draw/sdl/lv_draw_sdl_utils.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_arc.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_blend.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_dither.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_gradient.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_img.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_layer.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_letter.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_line.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_polygon.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_rect.c ndg/lib/lvgl/src/draw/sw/lv_draw_sw_transform.c ndg/lib/lvgl/src/extra/layouts/flex/lv_flex.c ndg/lib/lvgl/src/extra/layouts/grid/lv_grid.c ndg/lib/lvgl/src/extra/libs/bmp/lv_bmp.c ndg/lib/lvgl/src/extra/libs/ffmpeg/lv_ffmpeg.c ndg/lib/lvgl/src/extra/libs/freetype/lv_freetype.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_fatfs.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_posix.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_stdio.c ndg/lib/lvgl/src/extra/libs/fsdrv/lv_fs_win32.c ndg/lib/lvgl/src/extra/libs/gif/gifdec.c ndg/lib/lvgl/src/extra/libs/gif/lv_gif.c ndg/lib/lvgl/src/extra/libs/png/lodepng.c ndg/lib/lvgl/src/extra/libs/png/lv_png.c ndg/lib/lvgl/src/extra/libs/qrcode/lv_qrcode.c ndg/lib/lvgl/src/extra/libs/qrcode/qrcodegen.c ndg/lib/lvgl/src/extra/libs/rlottie/lv_rlottie.c ndg/lib/lvgl/src/extra/libs/sjpg/lv_sjpg.c ndg/lib/lvgl/src/extra/libs/sjpg/tjpgd.c ndg/lib/lvgl/src/extra/lv_extra.c ndg/lib/lvgl/src/extra/others/fragment/lv_fragment.c ndg/lib/lvgl/src/extra/others/fragment/lv_fragment_manager.c ndg/lib/lvgl/src/extra/others/gridnav/lv_gridnav.c ndg/lib/lvgl/src/extra/others/ime/lv_ime_pinyin.c ndg/lib/lvgl/src/extra/others/imgfont/lv_imgfont.c ndg/lib/lvgl/src/extra/others/monkey/lv_monkey.c ndg/lib/lvgl/src/extra/others/msg/lv_msg.c ndg/lib/lvgl/src/extra/others/snapshot/lv_snapshot.c ndg/lib/lvgl/src/extra/themes/basic/lv_theme_basic.c ndg/lib/lvgl/src/extra/themes/default/lv_theme_default.c ndg/lib/lvgl/src/extra/themes/mono/lv_theme_mono.c ndg/lib/lvgl/src/extra/widgets/animimg/lv_animimg.c ndg/lib/lvgl/src/extra/widgets/calendar/lv_calendar.c ndg/lib/lvgl/src/extra/widgets/calendar/lv_calendar_header_arrow.c ndg/lib/lvgl/src/extra/widgets/calendar/lv_calendar_header_dropdown.c ndg/lib/lvgl/src/extra/widgets/chart/lv_chart.c ndg/lib/lvgl/src/extra/widgets/colorwheel/lv_colorwheel.c ndg/lib/lvgl/src/extra/widgets/imgbtn/lv_imgbtn.c ndg/lib/lvgl/src/extra/widgets/keyboard/lv_keyboard.c ndg/lib/lvgl/src/extra/widgets/led/lv_led.c ndg/lib/lvgl/src/extra/widgets/list/lv_list.c ndg/lib/lvgl/src/extra/widgets/menu/lv_menu.c ndg/lib/lvgl/src/extra/widgets/meter/lv_meter.c ndg/lib/lvgl/src/extra/widgets/msgbox/lv_msgbox.c ndg/lib/lvgl/src/extra/widgets/span/lv_span.c ndg/lib/lvgl/src/extra/widgets/spinbox/lv_spinbox.c ndg/lib/lvgl/src/extra/widgets/spinner/lv_spinner.c ndg/lib/lvgl/src/extra/widgets/tabview/lv_tabview.c ndg/lib/lvgl/src/extra/widgets/tileview/lv_tileview.c ndg/lib/lvgl/src/extra/widgets/win/lv_win.c ndg/lib/lvgl/src/font/lv_font.c ndg/lib/lvgl/src/font/lv_font_fmt_txt.c ndg/lib/lvgl/src/font/lv_font_loader.c ndg/lib/lvgl/src/hal/lv_hal_disp.c ndg/lib/lvgl/src/hal/lv_hal_indev.c ndg/lib/lvgl/src/hal/lv_hal_tick.c ndg/lib/lvgl/src/misc/lv_anim.c ndg/lib/lvgl/src/misc/lv_anim_timeline.c ndg/lib/lvgl/src/misc/lv_area.c ndg/lib/lvgl/src/misc/lv_async.c ndg/lib/lvgl/src/misc/lv_bidi.c ndg/lib/lvgl/src/misc/lv_color.c ndg/lib/lvgl/src/misc/lv_fs.c ndg/lib/lvgl/src/misc/lv_gc.c ndg/lib/lvgl/src/misc/lv_ll.c ndg/lib/lvgl/src/misc/lv_log.c ndg/lib/lvgl/src/misc/lv_lru.c ndg/lib/lvgl/src/misc/lv_math.c ndg/lib/lvgl/src/misc/lv_mem.c ndg/lib/lvgl/src/misc/lv_printf.c ndg/lib/lvgl/src/misc/lv_style.c ndg/lib/lvgl/src/misc/lv_style_gen.c ndg/lib/lvgl/src/misc/lv_templ.c ndg/lib/lvgl/src/misc/lv_timer.c ndg/lib/lvgl/src/misc/lv_tlsf.c ndg/lib/lvgl/src/misc/lv_txt.c ndg/lib/lvgl/src/misc/lv_txt_ap.c ndg/lib/lvgl/src/misc/lv_utils.c ndg/lib/lvgl/src/widgets/lv_arc.c ndg/lib/lvgl/src/widgets/lv_bar.c ndg/lib/lvgl/src/widgets/lv_btn.c ndg/lib/lvgl/src/widgets/lv_btnmatrix.c ndg/lib/lvgl/src/widgets/lv_canvas.c ndg/lib/lvgl/src/widgets/lv_checkbox.c ndg/lib/lvgl/src/widgets/lv_dropdown.c ndg/lib/lvgl/src/widgets/lv_img.c ndg/lib/lvgl/src/widgets/lv_label.c ndg/lib/lvgl/src/widgets/lv_line.c ndg/lib/lvgl/src/widgets/lv_objx_templ.c ndg/lib/lvgl/src/widgets/lv_roller.c ndg/lib/lvgl/src/widgets/lv_slider.c ndg/lib/lvgl/src/widgets/lv_switch.c ndg/lib/lvgl/src/widgets/lv_table.c ndg/lib/lvgl/src/widgets/lv_textarea.c -cflags -std=c11 -Wall -Wextra -Wshadow -Wundef -Wunused-parameter -Werror -- ndg/src/ui/c/ui.c ndg/src/ui/c/lv_font_courierprimecode_14.c ndg/src/ui/c/lv_font_courierprimecode_16.c ndg/src/ui/c/lv_font_courierprimecode_24.c -cflags -std=c11 -fstack-protector -Wall -Wextra -Wformat -Wformat-security -Wundef -- ndg/lib/lv_drivers/sdl/sdl.c ndg/lib/lv_drivers/sdl/sdl_common.c -cflags -std=c11 -Wall -Wextra -Wshadow -Wundef -Wunused-parameter -Werror -- ndg/src/ui/c/drv_sdl2.c -lSDL2 --cache-dir ndg/zig-cache --global-cache-dir ~/.cache/zig --name ngui -I ndg/lib -I ndg/src/ui/c -D NM_DISP_HOR=800 -D NM_DISP_VER=480 -D LV_CONF_INCLUDE_SIMPLE -D LV_TICK_CUSTOM=1 -D LV_TICK_CUSTOM_INCLUDE="ui.h" -D LV_TICK_CUSTOM_SYS_TIME_EXPR=(nm_get_curr_tick()) -D NM_DRV_SDL2 -D USE_SDL -fPIE --enable-cache error: the following build command failed with exit code 1: ndg/zig-cache/o/53cabcf5debd11fe2a7c49e20e95539c/build ~/tools/zig/zig ndg ndg/zig-cache ~/.cache/zig ngui ```
offbyn commented 2 years ago
Poster
Owner

that's probably it:

% brew --prefix sdl2
/usr/local/opt/sdl2
% ls $(brew --prefix sdl2)
INSTALL_RECEIPT.json	README.md		bin			lib
LICENSE.txt		TODO.txt		include			share
that's probably it: ```bash % brew --prefix sdl2 /usr/local/opt/sdl2 ``` ```bash % ls $(brew --prefix sdl2) INSTALL_RECEIPT.json README.md bin lib LICENSE.txt TODO.txt include share ```
offbyn commented 2 years ago
Poster
Owner

There is SDL2 in /usr/local/include

and ls /usr/local/lib

libSDL2-2.0.0.dylib
libSDL2.a
libSDL2.dylib
libSDL2_test.a	
libSDL2main.a
There is `SDL2` in `/usr/local/include` and `ls /usr/local/lib` ``` libSDL2-2.0.0.dylib libSDL2.a libSDL2.dylib libSDL2_test.a libSDL2main.a ```
x1ddos commented 2 years ago
Owner

yeah, brew --prefix sdl2 looks good. i suspect something's fishy going on in the homebrew install.

what do you see when which pkg-config? it should print /opt/homebrew/bin/pkg-config or similar, where homebrew is installed. if it's different, you should probably overwrite it, so that homebrew's pkg-config comes first in the path.

once you find where pkg-config from homebrew is, try pkg-config --list-all - the list must include sdl2. found a relevan discussion in https://github.com/Homebrew/discussions/discussions/2987.

when zig build with sdl2, it tries to execute something like pkg-config --libs --cflags sdl2 and i suspect this command fails. once the command works, there should be no need for the original patch with ngui.addIncludePath("/usr/local/Cellar/...").

yeah, `brew --prefix sdl2` looks good. i suspect something's fishy going on in the homebrew install. what do you see when `which pkg-config`? it should print `/opt/homebrew/bin/pkg-config` or similar, where homebrew is installed. if it's different, you should probably overwrite it, so that homebrew's pkg-config comes first in the path. once you find where `pkg-config` from homebrew is, try `pkg-config --list-all` - the list must include `sdl2`. found a relevan discussion in https://github.com/Homebrew/discussions/discussions/2987. when zig build with sdl2, it tries to execute something like `pkg-config --libs --cflags sdl2` and i suspect this command fails. once the command works, there should be no need for the original patch with `ngui.addIncludePath("/usr/local/Cellar/...")`.
offbyn commented 2 years ago
Poster
Owner
% which pkg-config
/usr/local/bin/pkg-config
% pkg-config --list-all
zsh: segmentation fault  pkg-config --list-all

also with bash

$ pkg-config --list-all
Segmentation fault: 11

but

% pkg-config --libs --cflags sdl2
-D_THREAD_SAFE -I/usr/local/include -I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2
``` % which pkg-config /usr/local/bin/pkg-config ``` ``` % pkg-config --list-all zsh: segmentation fault pkg-config --list-all ``` also with bash ``` $ pkg-config --list-all Segmentation fault: 11 ``` but ``` % pkg-config --libs --cflags sdl2 -D_THREAD_SAFE -I/usr/local/include -I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2 ```
x1ddos commented 2 years ago
Owner

zsh: segmentation fault pkg-config --list-all

aha, i think we found the problem. zig runs that command to find out whether a library is installed here: https://github.com/ziglang/zig/blob/295451df/lib/std/build.zig#L1286

and assumes it isn't if the command fails, which it does in your case.

the path /usr/local/bin/pkg-config doesn't look like it's from homebrew install, at least according to https://github.com/Homebrew/discussions/discussions/2987. and you might also have two different SDL2 libs installed, one from homebrew and the other possibly from macports?

i would suggest you do this:

  1. brew install pkg-config
  2. add /opt/homebrew/bin, or whichever is the path where homebrew installs binaries in your system, to the PATH
  3. try again pkg-config --list-all
  4. if the above all works, try zig build without any patch - it should work!
> zsh: segmentation fault pkg-config --list-all aha, i think we found the problem. zig runs that command to find out whether a library is installed here: https://github.com/ziglang/zig/blob/295451df/lib/std/build.zig#L1286 and assumes it isn't if the command fails, which it does in your case. the path `/usr/local/bin/pkg-config` doesn't look like it's from homebrew install, at least according to https://github.com/Homebrew/discussions/discussions/2987. and you might also have two different SDL2 libs installed, one from homebrew and the other possibly from macports? i would suggest you do this: 1. `brew install pkg-config` 2. add `/opt/homebrew/bin`, or whichever is the path where homebrew installs binaries in your system, to the `PATH` 3. try again `pkg-config --list-all` 4. if the above all works, try `zig build` without any patch - it should work!
offbyn commented 2 years ago
Poster
Owner

turned out that there was a conflict with highway (an ffmpeg dep), everything works after brew uninstall highway.

turned out that there was a conflict with highway (an ffmpeg dep), everything works after `brew uninstall highway`.
offbyn closed this issue 2 years ago
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nakamochi/ndg#1
Loading…
There is no content yet.