I was following this tutorial on how to use the SDL_ttf library when I got this error:
error: lld-link: undefined symbol: _setjmp
note: referenced by ../external/freetype/src/sfnt/ttcmap.c:3843
note: libSDL2_ttf.a(libSDL2_ttf_la-sfnt.o):(tt_face_build_cmaps.isra.0)
note: referenced by ../external/freetype/src/smooth/ftgrays.c:1929
note: libSDL2_ttf.a(libSDL2_ttf_la-smooth.o):(gray_convert_glyph_inner)
My build.zig looks like this:
const std = @import("std");
pub fn build(b: *std.Build) void{
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "main",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe.addIncludePath(b.path("dep/SDL2-2.30.5/include/"));
exe.addIncludePath(b.path("dep/SDL2_image-2.8.2/x86_64-w64-mingw32/include/SDL2/"));
exe.addIncludePath(b.path("dep/SDL2_ttf-2.22.0/x86_64-w64-mingw32/include/SDL2/"));
exe.addLibraryPath(b.path("dep/SDL2-2.30.5/lib/x64/"));
exe.addLibraryPath(b.path("dep/SDL2_image-2.8.2/x86_64-w64-mingw32/lib/"));
exe.addLibraryPath(b.path("dep/SDL2_ttf-2.22.0/x86_64-w64-mingw32/lib/"));
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("SDL2");
exe.linkSystemLibrary("shlwapi");
exe.linkSystemLibrary("gdi32");
exe.linkSystemLibrary("winmm");
exe.linkSystemLibrary("Rpcrt4");
exe.linkSystemLibrary("SDl2main");
exe.linkSystemLibrary("SDL2_image");
exe.linkSystemLibrary("SDL2_ttf");
b.installArtifact(exe);
const run_step = b.addRunArtifact(exe);
const run_exe = b.step("run", "Run the application");
run_exe.dependOn(&run_step.step);
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
// Similar to creating the run step earlier, this exposes a `test` step to
// the `zig build --help` menu, providing a way for the user to request
// running the unit tests.
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_exe_unit_tests.step);
}
Do I need to link an another library or something?
Edit: Ignore the setup for exe_unit_tests because I don’t need it for now.