GithubHelp home page GithubHelp logo

Comments (6)

slimsag avatar slimsag commented on August 19, 2024

After updating our SDK to macOS 12.0 Monterey, it seems we face a few version incompatibilities with Zig's libc version which is on the older macOS 11 version. One example:

slimsag@hexops-ci gpu % SDK_PATH="$(pwd)/../.." zig build run-dawn-example -Dtarget=aarch64-macos   
error(link): undefined reference to symbol '___isPlatformVersionAtLeast'
error(link):   first referenced in '/Users/slimsag/Desktop/hexops/mach/gpu/zig-cache/o/3bd047a77c4b38019657965ff1fa5151/libdawn-native.a(/Users/slimsag/Desktop/hexops/mach/gpu/zig-cache/o/23eba02466d5f0700a75334aa5662ea4/BackendMTL.o)'
thread 7268393 panic: attempt to unwrap error: UndefinedSymbolReference

Another example:

Zig's sys/cdefs.h on macOS targets does not define things like __kernel_ptr_semantics as empty, which leads to type definitions in e.g. IOKit/IOTypes.h becoming syntactically invalid (macro doesn't expand to nothing):

typedef mach_vm_address_t       IOVirtualAddress __kernel_ptr_semantics;

from mach.

slimsag avatar slimsag commented on August 19, 2024

Curiously, even after updating Zig's libc headers to reflect macOS 12 in ziglang/zig#10200 - the linking failure did not go away:

error(link): undefined reference to symbol '___isPlatformVersionAtLeast'
error(link):   first referenced in '/Users/slimsag/Desktop/hexops/mach/gpu/zig-cache/o/a4898ce0dd88be1c63f03f62251f9adb/libdawn-native.a(/Users/slimsag/Desktop/hexops/mach/gpu/zig-cache/o/22c50fc6233f5284bfe9a440d8943d61/BackendMTL.o)'
thread 7413503 panic: attempt to unwrap error: UndefinedSymbolReference

isPlatformVersionAtLeast is referenced in every Dawn/WebGPU binary compiled with Zig natively, but is not found when cross-compiling.

isPlatformVersionAtLeast is not defined in Dawn's source code, nor in any framework in the macOS 12 SDK so far as I can see. I've searched all source files and binaries, it's not there. Where does this thing come from?

from mach.

slimsag avatar slimsag commented on August 19, 2024

Looks like LLVM inserts it: https://reviews.llvm.org/D90367

Speculating, I suspect that when compiling natively clang's compiler-rt (which defines this symbol) is linked in - while when cross compiling Zig's port of compiler-rt does not have this as it was a relatively recent addition (Oct 2020) ziglang/zig#1504

Maybe we need to port this to Zig's compiler-rt library.

from mach.

slimsag avatar slimsag commented on August 19, 2024

Filed ziglang/zig#10227 and working on a PR for Zig

from mach.

slimsag avatar slimsag commented on August 19, 2024

ziglang/zig#10232

from mach.

slimsag avatar slimsag commented on August 19, 2024

Confirmed fixed.

from mach.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.