From f31483a313da4a3fba666d30615014f57bd6d9a9 Mon Sep 17 00:00:00 2001 From: Jae B Date: Fri, 19 Sep 2025 11:07:25 +1000 Subject: [PATCH 1/6] fix Raylib example and add to CI --- .github/workflows/ci.yml | 12 ++++++++++++ examples/raylib/build.zig | 4 ++-- examples/raylib/build.zig.zon | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f3ee5a..038b521 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,10 @@ jobs: zig build -Dandroid=true --verbose zig build -Dandroid=true -Dcrash-on-exception --verbose working-directory: examples/sdl2 + + - name: Build Raylib Example (Zig Stable) + run: zig build -Dandroid=true --verbose + working-directory: examples/raylib # TODO(jae): 2025-03-30 # Need to figure out how to get 'adb shell monkey' to return an error code or be able to return an error code @@ -111,6 +115,10 @@ jobs: run: zig build -Dandroid=true --verbose working-directory: examples/sdl2 + - name: Build Raylib Example (Zig Stable) + run: zig build -Dandroid=true --verbose + working-directory: examples/raylib + # # Nightly Zig Builds # @@ -127,3 +135,7 @@ jobs: - name: Build SDL2 Example (Zig Nightly) run: zig build -Dandroid=true --verbose working-directory: examples/sdl2 + + - name: Build Raylib Example (Zig Stable) + run: zig build -Dandroid=true --verbose + working-directory: examples/raylib diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index 9f0e81c..4853cfa 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -57,7 +57,7 @@ pub fn build(b: *std.Build) void { b.dependency("raylib_zig", .{ .target = target, .optimize = optimize, - .shared = true, + .linkage = std.builtin.LinkMode.dynamic, }); const raylib_artifact = raylib_dep.artifact("raylib"); @@ -78,7 +78,7 @@ pub fn build(b: *std.Build) void { lib.root_module.addIncludePath(native_app_glue_dir); apk.addArtifact(lib); } else { - const exe = b.addExecutable(.{ .name = exe_name, .optimize = optimize, .root_module = lib_mod }); + const exe = b.addExecutable(.{ .name = exe_name, .root_module = lib_mod }); b.installArtifact(exe); const run_exe = b.addRunArtifact(exe); diff --git a/examples/raylib/build.zig.zon b/examples/raylib/build.zig.zon index 08b0cd2..3ae5c28 100644 --- a/examples/raylib/build.zig.zon +++ b/examples/raylib/build.zig.zon @@ -6,8 +6,8 @@ .dependencies = .{ .android = .{ .path = "../.." }, .raylib_zig = .{ - .url = "git+https://github.com/not-nik/raylib-zig#5013830647196ba938a3a25a36b8245606e9a9cd", - .hash = "raylib_zig-5.6.0-dev-KE8REM0tBQAHVn9Xjqlgu9l1qgfTmP8aJa1kLhD584bV", + .url = "git+https://github.com/raylib-zig/raylib-zig#d64fc43f38949231dc7d6f1c016db8fcae858b8c", + .hash = "raylib_zig-5.6.0-dev-KE8REDc2BQCri1t11guC1tZA-Luc7NuVeml_59LSELLe", }, }, .paths = .{ From 571d2116a5e7f19c6316ebb4943cdcff2601b1ce Mon Sep 17 00:00:00 2001 From: Jae B Date: Fri, 19 Sep 2025 11:24:32 +1000 Subject: [PATCH 2/6] fix build errors --- examples/raylib/build.zig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index 4853cfa..750a02e 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -37,13 +37,18 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, + .link_libc = true, }); const lib = b.addLibrary(.{ .linkage = .dynamic, .name = exe_name, .root_module = lib_mod, + // note(jae): 2025-09-19 + // Force use_llvm = true, to workaround issue in Zig 0.15.1 where an error occurs with + // - step: compile lib raylib Debug x86_64-linux-android failure + // panic: "TODO unhandled compression scheme" + .use_llvm = if (target.result.abi.isAndroid()) true else null, }); - lib.linkLibC(); b.installArtifact(lib); const raylib_dep = if (android_apk) |apk| @@ -61,14 +66,14 @@ pub fn build(b: *std.Build) void { }); const raylib_artifact = raylib_dep.artifact("raylib"); - lib.linkLibrary(raylib_artifact); + lib.root_module.linkLibrary(raylib_artifact); const raylib_mod = raylib_dep.module("raylib"); lib.root_module.addImport("raylib", raylib_mod); if (android_apk) |apk| { const android_dep = b.dependency("android", .{ - .optimize = optimize, .target = target, + .optimize = optimize, }); lib.root_module.addImport("android", android_dep.module("android")); lib.root_module.linkSystemLibrary("android", .{}); From 8fde603edafa8b2242335c18607c31885ae2ca02 Mon Sep 17 00:00:00 2001 From: Jae B Date: Fri, 19 Sep 2025 11:31:37 +1000 Subject: [PATCH 3/6] do more --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 038b521..3cdfd04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,9 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 with: - packages: 'tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456' + # 29.0.0 = Android 10 (Used by Oculus Quest 2) + # 35.0.0 = Android 15 + packages: 'tools platform-tools platforms;android-35 build-tools;29.0.0 ndk;35.0.0 ndk;29.0.13113456' # # Stable Zig Builds From 3d5a31bc9cfff67da1413535da54db696a18907b Mon Sep 17 00:00:00 2001 From: Jae B Date: Fri, 19 Sep 2025 11:34:37 +1000 Subject: [PATCH 4/6] fix raylib example --- .github/workflows/ci.yml | 3 +-- examples/raylib/build.zig | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cdfd04..3efc506 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,9 +35,8 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 with: - # 29.0.0 = Android 10 (Used by Oculus Quest 2) # 35.0.0 = Android 15 - packages: 'tools platform-tools platforms;android-35 build-tools;29.0.0 ndk;35.0.0 ndk;29.0.13113456' + packages: 'tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456' # # Stable Zig Builds diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index 750a02e..e08d192 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { const android_sdk = android.Sdk.create(b, .{}); const apk = android_sdk.createApk(.{ - .api_level = .android10, + .api_level = .android15, .build_tools_version = "35.0.1", .ndk_version = "29.0.13113456", }); From b328887dcfbee2146742bf353c0d2ae27c7095cd Mon Sep 17 00:00:00 2001 From: Jae B Date: Fri, 19 Sep 2025 11:40:41 +1000 Subject: [PATCH 5/6] more work --- examples/raylib/build.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index e08d192..c6f85bc 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -57,6 +57,13 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .android_api_version = @as([]const u8, b.fmt("{}", .{@intFromEnum(apk.api_level)})), .android_ndk = @as([]const u8, apk.ndk.path), + // NOTE(jae): 2025-09-19 + // Avoid compilation errors on Linux systems that don't have 'wayland-scanner' + // ie. + // $ zig build -Dandroid=true --verbose + // `wayland-scanner` may not be installed on the system. + // You can switch to X11 in your `build.zig` by changing `Options.linux_display_backend` + .linux_display_backend = .X11, // Avoid build issues on Linux systems }) else b.dependency("raylib_zig", .{ From fb09fcd6c532007c66f887717f614b408c159fb6 Mon Sep 17 00:00:00 2001 From: Jae B Date: Fri, 19 Sep 2025 11:45:02 +1000 Subject: [PATCH 6/6] fix --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3efc506..d5606fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,9 +116,10 @@ jobs: run: zig build -Dandroid=true --verbose working-directory: examples/sdl2 - - name: Build Raylib Example (Zig Stable) - run: zig build -Dandroid=true --verbose - working-directory: examples/raylib + # "Raylib requires zig version 0.15.1" error occurs + # - name: Build Raylib Example (Zig Previous Stable) + # run: zig build -Dandroid=true --verbose + # working-directory: examples/raylib # # Nightly Zig Builds