# Swift build problem x86\_64, arm64, arm7 (Swift 5.1)

**URL:** <https://forums.swift.org/t/swift-build-problem-x86-64-arm64-arm7-swift-5-1/27595>\
**Category:** Compiler\
**Tags:** arm, compiler, clang, llvm\
**Created:** [August 4, 2019, 1:37am UTC](https://forums.swift.org/t/swift-build-problem-x86-64-arm64-arm7-swift-5-1/27595 "2019-08-04T01:37:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpectralDragon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spectraldragon/32/5035_2.png) [@SpectralDragon](https://forums.swift.org/u/SpectralDragon)\
**Post date:** [August 4, 2019, 1:37am UTC](https://forums.swift.org/t/swift-build-problem-x86-64-arm64-arm7-swift-5-1/27595/1 "2019-08-04T01:37:57Z")

</div>

When I trying build swift, I got the next error message:

```nohighlight
Undefined symbols for architecture x86_64:
  "___isOSVersionAtLeast", referenced from:
      swift::initializeProtocolLookup() in ImageInspectionMachO.cpp.o
      swift::initializeProtocolConformanceLookup() in ImageInspectionMachO.cpp.o
      swift::initializeTypeMetadataRecordLookup() in ImageInspectionMachO.cpp.o
      swift::initializeDynamicReplacementLookup() in ImageInspectionMachO.cpp.o
ld: symbol(s) not found for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
[5/19][26%][7.760s] Building CXX object tools/SourceKit/lib/SwiftLang/CMakeFiles/SourceKitSwiftLang.dir/SwiftTypeContextInfo.cpp.o
ninja: build stopped: subcommand failed.
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

```

The same message I got for arm64 and arm7.  
In llvm I see clang version 7.0.0 without `lib` folder (only `include` dir).

Please help me 🙂

---

<div class="post-metadata">

**Author:** ![Andrew\_Trick](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/andrew_trick/32/323_2.png) [@Andrew\_Trick](https://forums.swift.org/u/Andrew_Trick)\
**Post date:** [August 4, 2019, 4:32am UTC](https://forums.swift.org/t/swift-build-problem-x86-64-arm64-arm7-swift-5-1/27595/2 "2019-08-04T04:32:54Z")

</div>

I've seen this problem. I'm not sure how I fixed it aside from starting over from a clean build. If you have compiler-rt checked out (via swift/utils/update-checkout --clone), then when llvm builds (via build-script) it should populate this build directory: llvm-macosx-x86\_64/tools/clang/runtime/compiler-rt-bins/lib/builtins. Those libclang\_rt libraries define \_\_\_isOSVersionAtLeast. I'm currently building with 11 beta 5, 11M382q.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [August 4, 2019, 9:28pm UTC](https://forums.swift.org/t/swift-build-problem-x86-64-arm64-arm7-swift-5-1/27595/3 "2019-08-04T21:28:40Z")

</div>

If clang is able to statically infer that the OS is going to be new enough, it will statically eliminate the calls, resulting in the reference being removed. I don't have a macOS build handy, but it is possible that the OS version is being cached and resulting in an incorrect parameter to clang and creating a dynamic check.
