Error building Swift - can't import XCTest

(Ludwig Hollmann) #1


I am new to the Swift community and I am right now trying to compile swift from the Github repo. I followed the instructions exactly and everything went fine until I ran ./utils/build-script --release-debuginfo. I left my iMac 2009 10.13.6 running over night and got the following output.

[41/628] Compiling /Users/lh/swift-source/build/Ni...stdlib/public/Darwin/XCTest/macosx/x86_64/XCTest.
... / output intentionally removed by me / ...
/Users/lh/swift-source/swift/stdlib/public/Darwin/XCTest/XCTest.swift:13:19: error: no such module 'XCTest'
@_exported import XCTest // Clang module

Does anyone know what the problem might be? I ran all of the commands in the file and my swift-source looks as follows

$ ls 
build				libcxx				swift				swift-stress-tester
clang				llbuild				swift-corelibs-foundation	swift-syntax
clang-tools-extra		lldb				swift-corelibs-libdispatch	swift-xcode-playground-support
cmark				llvm				swift-corelibs-xctest		swiftpm
compiler-rt			ninja				swift-integration-tests

Does anyone have any idea on how this could be fixed?

(Victor Guerra) #2

hi @Ludwig!

I am facing the same issue... did you figure out what's the cause for this?


(Jordan Rose) #3

I missed this at the time, but can you (both) see what happens when you run xcode-select -p? It's possible we're not configuring stuff right when you have the Command Line Tools package installed.

(Victor Guerra) #4

in my case:

$> xcode-select -p

(Ludwig Hollmann) #5

I get the exact same output

(Jordan Rose) #6

Okay. Can one of you file a bug? And then the workaround I'd suggest would be deleting the CMakeCache.txt files out of your build directory, and then running build-script again with the DEVELOPER_DIR environment variable set to /Applications/ (or wherever your Xcode 10.1 lives).

(Victor Guerra) #7

sure .. will file a bug and try the workaround you suggest.

Thanks Jordan.

(Victor Guerra) #8

$> xcode-select -s /Applications/

before re-running the build script would help as well.

(Victor Guerra) #9

bug filed : SR-9669