Skip to content

[CMake] Fix issues when running build-tooling-libs #61683

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

Merged
merged 1 commit into from
Oct 22, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 22, 2022

There were three different issues going on here, all of these were triggered by #61618 which stared including AST/AnyFunctionRef.h from the ASTBridging modulemap

  • We did not find the clang include dirs because the unified build that build-tooling-libs is using does not import ClangConfig, setting CLANG_INCLUDE_DIRS in swift_common_unified_build_config fixed this problem.
  • Some of the headers in swift-ast-generated-headers import generated headers from clang that might not have been created yet. Making swift-ast-generated-headers depend on the clang generated headers fixes this problem. This just lowers the dependency because swiftAST depends on swift-ast-generated-headers
  • If a Swift compiler from Xcode is used, the SwiftShims don’t live next to the compiler but in the SDK. Adding the SDKs lib to the include paths fixes this problem

There were three different issues going on here, all of these were triggered by swiftlang#61618 which stared including `AST/AnyFunctionRef.h` from the ASTBridging modulemap

- We did not find the clang include dirs because the unified build that build-tooling-libs is using does not import ClangConfig, setting `CLANG_INCLUDE_DIRS` in `swift_common_unified_build_config` fixed this problem.
- Some of the headers in `swift-ast-generated-headers` import generated headers from clang that might not have been created yet. Making `swift-ast-generated-headers` depend on the clang generated headers fixes this problem. This just lowers the dependency because `swiftAST` depends on `swift-ast-generated-headers`
- If a Swift compiler from Xcode is used, the SwiftShims don’t live next to the compiler but in the SDK. Adding the SDKs lib to the include paths fixes this problem
@ahoppen ahoppen requested review from etcwilde and egorzhdan October 22, 2022 10:35
@ahoppen
Copy link
Member Author

ahoppen commented Oct 22, 2022

@swift-ci Please smoke test

get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
set(sdk_option ${sdk_option} "-I" "${swift_exec_bin_dir}/../lib")
set(sdk_option ${sdk_option} "-I" "${swift_exec_bin_dir}/../lib" "-I" "${sdk_path}/usr/lib")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, does this mean we'll include two copies of SwiftShims when using an open source toolchain with an SDK from Xcode? If that's true, can we instead add only one of these two directories if both exist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done that locally and it worked just fine. I assume that it just chooses the first include path that it finds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks.

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for fixing this!

@ahoppen ahoppen merged commit 86642fa into swiftlang:main Oct 22, 2022
@ahoppen ahoppen deleted the ahoppen/fix-tooling-libs-build branch October 22, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants