Warning about CMake 3.14 on Linux with swift-corelibs-xctest

Hey all-

I'm not sure if this is the right spot for this, but wanted to give folks a heads up that compiling Swift with CMake 3.14 will fail due to a bunch of missing functions in libXCTest.so, which I traced back from its symlink to the library in swift-corelibs-xctest; the file was there (so the symlink worked) but the actual file was zero bytes. The errors look like:

/usr/bin/ld.gold: error: /builddir/build/BUILD/swift-source/build/buildbot_linux/swiftpm-linux-x86_64/.bootstrap/lib/swift/linux/libXCTest.so: file is empty /builddir/build/BUILD/swift-source/build/buildbot_linux/swiftpm-linux-x86_64/x86_64-unknown-linux/release/BasicPerformanceTests.build/ByteStringPerfTests.swift.o:ByteStringPerfTests.swift.o:function

Turns out in CMake 3.14 they changed how -E copy works and the result is that copying a file to the same location (as happens in swift-corelibs-xctest) results in the file being overwritten with an empty version. The command that causes this problem is, for example:

/usr/bin/cmake -E copy /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/xctest-linux-x86_64/libXCTest.so /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/xctest-linux-x86_64

This is an issue with Fedora which is currently on 3.14. I checked all the Ubuntu versions and so far 3.14 hasn't been pushed there yet; I don't know if/when Ubuntu will get it but if you suddenly notice build failures with libXCTest.so this may be the culprit.

I filed a bug report with the CMake folks: Copying a file to the same directory zeros out the file (#19075) · Issues · CMake / CMake · GitLab

Hope that helps anyone who comes across this; they've accepted this as an actual issue so here's hoping that Ubuntu gets 3.14.1 or later.

Ron