Skip to content

Build failed on macOS Sonoma with Xcode 15: zig2 duplicate symbol __mh_execute_header #17050

@thelastlin

Description

@thelastlin

Zig Version

0.11.0

Steps to Reproduce and Observed Behavior

  1. Install required dependencies.
  2. Configure and build with:
    export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); cd builld;
    cmake .. -DCMAKE_PREFIX_PATH=$PATH_TO_LLVM16_INSTALL_PATH
    make -j`nproc`
    which SDKROOT will be set to /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
  3. Failed at Linking CXX executable zig2, linker output:
     @(#)PROGRAM:ld  PROJECT:dyld-1015.7
     BUILD 19:43:18 Aug 22 2023
     configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
     will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
     LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
     TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3)
     Library search paths:
         ... 
     Framework search paths:
     ld: warning: ignoring duplicate libraries: '/path/to/llvm-16/lib/libclangAST.a', '/path/to/llvm-16/lib/libclangASTMatchers.a', '/path/to/llvm-16/lib/libclangAnalysis.a', '/path/to/llvm-16/lib/libclangParse.a', '/path/to/llvm-16/lib/libclangSema.a', '/path/to/llvm-16/lib/libclangStaticAnalyzerCheckers.a', '/path/to/llvm-16/lib/libclangStaticAnalyzerCore.a', '/path/to/llvm-16/lib/libclangStaticAnalyzerFrontend.a'
     duplicate symbol '__mh_execute_header' in:
         /path/to/build/CMakeFiles/zig2.dir/zig2.c.o
         boundary-file
     ld: 1 duplicate symbols
    

macOS: 23A5337a
Xcode: 15A5229m
LLVM(llvm-config --version): 16.0.6

Expected Behavior

  1. Succeed in linking zig2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-macosmacOS

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions