Compiling from source?

Has anyone been able to compile this from source? I have tried accross multiple configurations at this point and not had any luck.

"[998/1039][ 96%][1043.994s] Compiling /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/stdlib/public/core/
LINUX/x86_64/Swift.o
FAILED: stdlib/public/core/LINUX/x86_64/Swift.o
cd /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/stdlib/public/core && /usr/bin/python /home/sftf/swift
-source/swift/utils/line-directive @/home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/stdlib/public/core/vt
ifs.txt – /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/./bin/swiftc -c -sdk / -target x86_64-unknown-
linux-gnu -resource-dir /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/./lib/swift -O -g -D INTERNAL_CHE
CKS_ENABLED -D SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -I /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/
./lib/swift/linux/x86_64 -module-cache-path /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/./module-cach
e -no-link-objc-runtime -enable-library-evolution -Xfrontend -enable-resilience -Xfrontend -enforce-exclusivity=unchecked -nostdimpor
t -parse-stdlib -module-name Swift -Xfrontend -group-info-path -Xfrontend /home/sftf/swift-source/swift/stdlib/public/core/GroupInfo.
json -swift-version 5 -runtime-compatibility-version none -warn-swift3-objc-inference-complete -Xfrontend -verify-syntax-tree -Xllvm
-sil-inline-generics -Xllvm -sil-partial-specialization -Xcc -DswiftCore_EXPORTS -warn-implicit-overrides -module-link-name swiftCore
-force-single-frontend-invocation -parse-as-library -o /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/s
tdlib/public/core/LINUX/x86_64/Swift.o @/home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/stdlib/public/cor
e/vtifs.txt
swift: /home/sftf/swift-source/swift/lib/IRGen/IRGenDebugInfo.cpp:2183: void (anonymous namespace)::IRGenDebugInfoImpl::emitVariableD
eclaration(swift::irgen::IRBuilder &, ArrayRef<llvm::Value *>, swift::irgen::DebugTypeInfo, const swift::SILDebugScope *, swift::Valu
eDecl *, llvm::StringRef, unsigned int, swift::irgen::IndirectionKind, swift::irgen::ArtificialKind): Assertion `OffsetInBits + SizeI
nBits <= getSizeInBits(Var) && “pars > totum”’ failed.
Stack dump:
0. Program arguments: /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin/swift -frontend -c -fileli
st /tmp/sources-466ec7 -supplementary-output-file-map /tmp/supplementaryOutputs-fdb887 -disable-objc-attr-requires-foundation-module
-target x86_64-unknown-linux-gnu -disable-objc-interop -sdk / -I /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux
-x86_64/./lib/swift/linux/x86_64 -warn-swift3-objc-inference-complete -warn-implicit-overrides -enable-library-evolution -g -module-cache-path /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/./module-cache -module-link-name swiftCore -nos
tdimport -parse-stdlib -resource-dir /home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/./lib/swift -swift-v
ersion 5 -O -D INTERNAL_CHECKS_ENABLED -D SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -enable-resilience -enforce-exclusivity=unchecked -g
roup-info-path /home/sftf/swift-source/swift/stdlib/public/core/GroupInfo.json -verify-syntax-tree -enable-anonymous-context-mangled-names -Xllvm -sil-inline-generics -Xllvm -sil-partial-specialization -Xcc -DswiftCore_EXPORTS -parse-as-library -module-name Swift -o
/home/sftf/swift-source/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/stdlib/public/core/LINUX/x86_64/Swift.o -runtime-compati
bility-version none

  1.  Swift version 5.1-dev (LLVM 7d54a7c711, Swift 8f5f77aa34)                                                                    
    
  2. "

You can download a docker container with this issue here: https://hub.docker.com/r/moeri/swift-source/dockerfile

1 Like

Looks like you might have hit: https://bugs.swift.org/browse/TF-597.

Also, this is building the swift compiler from scratch. Unless you’re interested in making compiler changes, you can use a pre-built compiler toolchains and then make changes to https://github.com/tensorflow/swift-apis directly which is a more normal swift package and contains the bulk of the s4tf code with the exception of the AD compiler pass.

Okay, thank you. I was not sure how this project worked, so I was probably looking at the wrong thing. Thank you for the swift-apis link

Hoping to contribute soon.

Trying to build swift-apis. Downloaded the Xcode beta Version 11.0 beta 2 and the latest toolchain RC 4 and am getting this error. When I do a “swift build”. Any ideas?

error: manifest parse error(s):
<unknown>:0: error: Swift does not support the SDK ‘MacOSX10.14.sdk’

I tried the June 17th toolchain and didn’t get that error but got a ton of compiler errors and then it looks like the compiler asserted. Anyone know the secret sauce to correctly building swift-apis?

Admittedly I was able to get Swift compiler built from source after Parker’s comment above. I am currently working on Linux, and can’t help here as I don’t own a Mac machine :frowning:

I’ll try using the toolchain on Linux and see which Swift version works. Still won’t be fully transferable due to platform difference.

Thanks. Maybe I’ll try compiling the compiler from source and see if that’s doable.

I was able to solve my issue. For any others with this issue here is the solution:

  1. Open Xcode Beta
  2. Go to Preferences
  3. Go to Locations Tab
  4. In Command Line Tools dropdown select Xcode 11.0

I have both Xcode 10 and 11 installed and it was still trying to use Xcode 10 command line tools for builds. With this change the Swift-APIs compile successfully.

2 Likes

Got my first PR merged into the Swift for TensorFlow codebase yesterday. A bug fix for TransposedConv2D. They are very open to people contributing.

4 Likes

Yeah, I am new to swift, and have in general been struggling with getting my environment setup. Finally got my first test written in my local environment, so going to write a few more tests and then start on code.

3 Likes

I think I took the simpler approach with just doing the swift-apis and not the whole compiler but that may end up being an issue sometimes. Currently the latest master doesn’t build for me. Some compiler assertion or something like that. Unfortunately only Ubuntu builds are done nightly and not Mac.