Skip to content

[SR-12539] Linker error: undefined symbols for architecture x86_64 #54983

@swift-ci

Description

@swift-ci
Previous ID SR-12539
Radar rdar://problem/62201716
Original Reporter ttflee (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 70212d26669214163e40f20b98fe5981

Issue Description:

When linking the following code on macOS 10.15.3 with Xcode Version 11.4 (11E146):

import Darwinvar errorfds = fd_set()
    
let fd = Int32(3)
if __darwin_fd_isset(fd, &errorfds) != 0 {
    print(1)
}

the following error occurred:

$ swiftc -v -o /tmp/1 /tmp/1.swift
Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.3.0
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /tmp/1.swift -target x86_64-apple-darwin19.3.0 -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main -o /var/folders/vy/9qq29vsj3w54s53l1mylw0cm0000gn/T/1-47974c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld /var/folders/vy/9qq29vsj3w54s53l1mylw0cm0000gn/T/1-47974c.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/lib/darwin/libclang_rt.osx.a -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -lobjc -lSystem -arch x86_64 -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift -macosx_version_min 10.15.0 -no_objc_category_merging -o /tmp/1
Undefined symbols for architecture x86_64:
  "___darwin_check_fd_set", referenced from:
      _main in 1-47974c.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions