#stage3 build fails on macOS, "undefined reference to symbol 'dyld_stub_binder'"

1 messages · Page 1 of 1 (latest)

unique axle
#

Hi, I'm trying to compile Zig from source on macOS 13.1.

When compiling stage3, I get the following error:

zig build-exe zig ReleaseFast native: error: error(link): undefined reference to symbol 'dyld_stub_binder'
error: UndefinedSymbolReference

My CMake command is cmake .. -DCMAKE_PREFIX_PATH="/usr/local/opt/llvm@15;$(brew --prefix zstd)" -DCMAKE_BUILD_TYPE=Release -DZIG_NO_LIB=ON -DZIG_STATIC_LLVM=ON -DZIG_STATIC_ZLIB=ON -DZIG_STATIC=ON.

I've seen issue #12069 about this, which says this error used to be caused by a lack of support for Ventura, but that Ventura support has since been added. Did 13.1 break it again? Am I just doing something wrong?

rugged lantern
#

Greetings, tiny Earth Human! Morbo sees the same error in a different place, and wonders if the two issues might be related.

Did you recently upgrade macOS, by any chance?

Morbo uses the official daily pre-compiled zig/zls binaries (aarch64-macos.13.3). But when Morbo builds a simple "hello world" program that links to an externally-built library object, zig build run fails with the same error message that Earth Human is seeing:

$ zig build run

zig build-exe import_libfoobar Debug native: error: error(link): undefined reference to symbol 'dyld_stub_binder'
error: UndefinedSymbolReference

zig build-exe import_libfoobar Debug native: error: the following command exited with error code 1:
zig build-exe src/import_libfoobar.zig                    \
    -I/opt/homebrew/Cellar/fontconfig/2.14.2/include      \
    -I/opt/homebrew/opt/freetype/include/freetype2        \
    -I/opt/homebrew/Cellar/libpng/1.6.39/include/libpng16 \
    --cache-dir zig-cache                                 \
    --global-cache-dir ~/.cache/zig                       \
    --name helloworld_test                                \
    --mod clap::contrib/zig-clap/clap.zig                 \
    --deps clap                                           \
    -I src/file                                           \
    -I src/util                                           \
    -L dist/lib                                           \
    --enable-cache                                        \
    --listen=-

Morbo is using the following versions of zig/zls:

  • zig v0.11.0-dev.2336+5b82b4004
  • zls v0.11.0-dev.359+8b5c649

Morbo recently upgraded to macOS 13.3 (22E252) from 13.x (Morbo doesn't remember the exact previous version/build. I WILL DESTROY YOU!).

It might just be a coincidence, but Morbo only started getting these errors after upgrading macOS. Perhaps the puny OS upgrade broke something?

#

Here is Morbo's code:

// src/import_libfoobar.zig

const libfoobar = @cImport({
    @cInclude("libfoobar.h");
});

pub fn main() !void {
    std.debug.print("How's the family? {s}\n", .{"Belligerent and numerous."});
}
// build.zig

pub fn build(b: *Builder) void {
    // ...
    
    const exe = b.addExecutable(.{
        .name = "import_libfoobar",
        .root_source_file = .{ .path = "src/import_libfoobar.zig" },
    });
    
    // Where to find the C library's .h files.
    exe.addIncludePath("contrib/libfoobar");
    
    // Where to find the C libary's pre-compiled object file (libfoobar.la).
    exe.addLibraryPath("dist/lib");
    
    // This worked fine before upgrading to macOS 13.3 (22E252);
    // now it throws a compile-time `UndefinedSymbolReference` error.
    exe.linkSystemLibrary("libfoobar");
    
    // ...
}
bronze iris
#

Yeah, same issue here after the last macOS update. (beta version, 13.4)

bronze iris
#

The culprit might be Xcode, which was just updated.

upbeat sand
#

#compiler-devel message