-
Notifications
You must be signed in to change notification settings - Fork 10.5k
build: allow fallback for CMAKE_Swift_COMPILER
migration
#38239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The original change c0d6d8f added a soft migration path from `SWIFT_NATIVE_SWIFT_TOOLS_PATH` to `CMAKE_Swift_COMPILER`, which broke some setups. Subsequently 9da7665 added an overly restrictive check to ensure that `CMAKE_Swift_COMPILER` is always set when `SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER` is set. This loosens the check to ensure that either `CMAKE_Swift_COMPILER` or `SWIFT_NATIVE_SWIFT_TOOLS_PATH` can be used during the migration.
CC: @davezarzycki |
@swift-ci please test |
Running a nightly build for Windows at https://dev.azure.com/compnerd/swift-build/_build/results?buildId=52716&view=results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I forgot a restorative change. The bug still exists:
cd /home/dave/b/u/t/tools/swift/stdlib/public/core && /usr/bin/python3.9 /home/dave/ro_s/u/swift/utils/line-directive @/home/dave/b/u/t/tools/swift/stdlib/public/core/dfaab9867ab9868918d54c7626d620fe0cb9c79c.txt -- -c -sdk / -target x86_64-unknown-linux-gnu -resource-dir /home/dave/b/u/t/./lib/swift -O -D INTERNAL_CHECKS_ENABLED -D SWIFT_RUNTIME_OS_VERSIONING -module-cache-path /home/dave/b/u/t/./module-cache -no-link-objc-runtime -enable-library-evolution -Xfrontend -enforce-exclusivity=unchecked -nostdimport -parse-stdlib -module-name Swift -Xfrontend -group-info-path -Xfrontend /home/dave/ro_s/u/swift/stdlib/public/core/GroupInfo.json -swift-version 5 -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements -warn-swift3-objc-inference-complete -Xfrontend -verify-syntax-tree -Xllvm -sil-inline-generics -Xllvm -sil-partial-specialization -Xfrontend -enable-experimental-concise-pound-file -Xfrontend -enable-ossa-modules -Xcc -DswiftCore_EXPORTS -warn-implicit-overrides -module-link-name swiftCore -whole-module-optimization -parse-as-library -I /home/dave/b/u/t/./lib/swift/linux -o /home/dave/b/u/t/tools/swift/stdlib/public/core/LINUX/x86_64/Swift.o @/home/dave/b/u/t/tools/swift/stdlib/public/core/dfaab9867ab9868918d54c7626d620fe0cb9c79c.txt
Traceback (most recent call last):
File "/home/dave/ro_s/u/swift/utils/line-directive", line 742, in <module>
run()
File "/home/dave/ro_s/u/swift/utils/line-directive", line 694, in run
command = subprocess.Popen(
File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '-c'
Weird, the following results in
|
Huh? That sounds like the issue, but why? |
Add a workaround for `NOT CMAKE_Swift_COMPILER` not evaluating properly.
@davezarzycki - I added a horrible workaround to the CMake in the hopes that it evaluates properly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So overall, after the STREQUAL
fix, the net result is the same to me. I can't use SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
anymore unless I supply a pre-built Swift, which if that's the goal, then fine, I can live without SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
.
CC @gottesmm
CMakeLists.txt
Outdated
if (SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER) | ||
if (NOT CMAKE_Swift_COMPILER AND NOT SWIFT_PREBUILT_SWIFT) | ||
if ("${CMAKE_Swift_COMPILER}" STREQUAL "CMAKE_Swift_COMPILER-NOTFOUND" AND NOT SWIFT_PREBUILT_SWIFT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing and debugging, it needs to be: "${CMAKE_Swift_COMPILER}" STREQUAL "NOTFOUND"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay.
Wait, I'm not sure how the build is supposed to work in this case. You are saying that CMake doesn't find the Swift compiler nor is |
One of the supported build modes uses the just built |
Ah, for that I think that we should definitely get @gottesmm's opinion on introducing a more precise |
Right, I was allowing for a liberal definition of "runtime" or that the build variable name was no longer ideal but otherwise ya, we need @gottesmm's input. |
@gottesmm -- ping? |
1 similar comment
@gottesmm -- ping? |
This is woefully out of date at this point, closing this off. I imagine that is now longer valuable. |
The original change c0d6d8f added a
soft migration path from
SWIFT_NATIVE_SWIFT_TOOLS_PATH
toCMAKE_Swift_COMPILER
, which broke some setups. Subsequently9da7665 added an overly restrictive
check to ensure that
CMAKE_Swift_COMPILER
is always set whenSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
is set. This loosens the checkto ensure that either
CMAKE_Swift_COMPILER
orSWIFT_NATIVE_SWIFT_TOOLS_PATH
can be used during the migration.Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves SR-NNNN.