From a316f9e7fc7f8e06852a40544e57f89018672ee4 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Tue, 5 Sep 2023 05:02:25 -0400 Subject: [PATCH] Disable UBSAN in zig builds. (#3292) Zig debug builds automatically enable ubsan. As the fix for #1891 had to be reverted, debug builds using zig will crash like so: ``` Illegal instruction at address 0x3237d2 raylib/src/rlgl.h:3690:91: 0x3237d2 in rlDrawVertexArrayElements (/home/rcorre/src/raylib-zig-template/raylib/src/rcore.c) glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)buffer + offset); ``` This disables UBSAN when using zig to build raylib. --- src/build.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/build.zig b/src/build.zig index 27250f5ff060..09d954bf5a9b 100644 --- a/src/build.zig +++ b/src/build.zig @@ -6,6 +6,7 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built "-std=gnu99", "-D_GNU_SOURCE", "-DGL_SILENCE_DEPRECATION=199309L", + "-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/1891 }; const raylib = b.addStaticLibrary(.{