#[macOS] Statically linking results in libobjc linker error

1 messages · Page 1 of 1 (latest)

steady solar
#

Zig version 0.11.0

This is my build.zig:

    exe.linkFramework("System");
    exe.linkFramework("CoreFoundation");
    exe.linkFramework("Foundation");
    exe.linkFramework("QuartzCore");
    exe.linkFramework("CoreAudio");
    exe.linkFramework("AudioUnit");
    exe.linkFramework("AudioToolbox");
    exe.linkFramework("ForceFeedback");
    exe.linkFramework("IOKit");
    exe.linkFramework("Cocoa");
    exe.linkFramework("Carbon");
    exe.linkFramework("CoreGraphics");
    exe.linkFramework("CoreHaptics");
    exe.linkFramework("GameController");
    exe.linkFramework("Metal");

    exe.linkSystemLibrary("objc"); // im linking objc but it still cant find the symbols
    exe.linkSystemLibrary("SDL2");
    exe.linkSystemLibrary("SDL2main");

Many linker errors occur all in the same missing dependency when compiling, here is a single instance:

error(link): undefined reference to symbol '_objc_msgSend$addPendingWindowOperation:'
error(link):   first referenced in '/Users/undersquire/Documents/Personal/zig_game/vendor/SDL/build/libSDL2.a(SDL_cocoawindow.m.o)'
error: UndefinedSymbolReference
``` Many other linker errors exist for other random `_objc_...` symbols.

Does anyone know why it cant find the objc symbols even though I am linking libobjc?
steady solar
steady solar
#

So it seems this is happening with any library that depends on macOS or objc libs, I tried statically linking bgfx with the same errors of undefined symbols to objc runtime