User/swift-project/swift/validation-test/BuildSystem/swift-cmake/Klass.swift:14:5: error: cannot find 'CPPLib_log' in scope
The following build commands failed:
CompileSwift normal x86_64 /User/swift-project/swift/validation-test/BuildSystem/swift-cmake/Klass.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
CompileSwift normal x86_64 /User/swift-project/swift/validation-test/BuildSystem/swift-cmake/Klass.swift
(3 failures)
ERROR: command terminated with a non-zero exit status 65, aborting
I'm not sure why that failure is happening but I suggest skipping the --test flag and trying to do a clean build without it until the issue is resolved. You can separately run the tests using lit.py.
Update: now the workaround has been updated to refer to a different line, it works! This only removed one of the errors for me unfortunately (sorry I accidentally closed the log so don't have more details), though I wasn't using --debug-swift flag if that makes any difference. I'm building now to see if removing the logging line from Klass.swift works as an alternate workaround.
While this removed the Klass errors, my build failed later, not sure if related to me removing the logging line but thought I'd share just in case... Given this has to do with a test target, I'll try adding --test back to see if that fixes anything. Update: It did not fix anything
Ld /Users/jackmarch/swift-project/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/RelWithDebInfo/lib/libTestPureSwiftSharedLib.dylib normal (in target 'TestPureSwiftSharedLib' from project 'Swift')
Is commenting add_subdirectory(validation-test) likely the reason so many of the tests are failing when I try to run them @LucianoPAlmeida ? (Note I changed the path from Ninja to Xcode, not sure if this is the reason as it says "warning: Building Xcode project is not supported yet. Skipping..."):
swift % utils/run-test --lit ../llvm-project/llvm/utils/lit/lit.py \
../build/Xcode-RelWithDebInfoAssert/swift-macosx-$(uname -m)/test-macosx-$(uname -m)
/Users/jackmarch/swift-project/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64/APINotes/Output/type_changes.swift.script: line 1: swift-frontend: command not found
Running tests from Xcode in check-swift-all target doesn't work either, e.g. errors like:
In file included from /Users/jackmarch/swift-project/swift/unittests/Localization/SerializationTests.cpp:13:
/Users/jackmarch/swift-project/swift/unittests/Localization/LocalizationTest.h:26:10: fatal error: 'gtest/gtest.h' file not found #include "gtest/gtest.h"
^~~~~~~~~~~~~~~
1 error generated.
Normally you run lit tests against a ninja build. So you build Xcode to work on a nice IDE, and for running lit tests you use a ninja build that I normally use:
// And then for Testing llvm-project/llvm/utils/lit/lit.py -sv --param swift_site_config=build/Ninja-ReleaseAssert/swift-macosx-x86_64/test-macosx-x86_64/lit.site.cfg swift/test/
Note that the folder x86_64 may be different if you are building on a M1 Mac ...
But for lit tests I always used the ninja build, because as far as I know it will not work on Xcode one ... so in short you have to build both ninja and Xcode, and run lit against the ninja one =]
What do you mean by "here is a workaround just to build using Xcode"? Sounds like you came up with a solution. I don't understand how to make it work, I'm getting the same build fail error from Klass.swift and com.apple.xcode.tools.swift.compiler.
in the folder swift-project/swift you will find a CMakeLists.txt. Luciano's workaround consists in commenting out the line 1074 add_subdirectory(validation-test) in this file and then run the build command again. Worked for me!:)
Thank you so much, your solution worked!
Now it's learning time for me, I have a lot of things to figure out from scratch before hopefully contributing to Swift.
So I think the right solution here is to not disable --validation-test. Rather I think that we probably want to just disable this test for now with the Xcode generator. The Xcode generator has many issues and isn't the normal build people use (we generally use ninja). So I am going to throw up a patch that does just that.
Xcode build is expecting to link against libswift.
I'm using ./swift/utils/build-script --xcode --release-debuginfo --debug-swift --skip-build-benchmarks --swift-darwin-supported-archs 'x86_64' --sccache --skip-ios --skip-tvos --skip-watchos --swift-disable-dead-stripping --skip-test-cmark ad Xcode 12.5 (12E262)