Skip to content

[5.0] Build and install 'clang' and 'clangd' in the macOS & linux toolchains #22273

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

Conversation

hyp
Copy link
Contributor

@hyp hyp commented Jan 31, 2019

  • Build script now builds clang_tools_extra as part of LLVM's build.
  • Build script now has a new libc++ build step to allow libc++ headers to be installed in the
    resulting toolchain.
  • 'clang', 'clangd', 'clang-headers' & 'compiler-rt' targets are now installed for
    the package build configurations for macOS and linux.
  • 'clang-resource-dir-symlink' is used in the package build configuration for macOS and linux
    to avoid duplication of Clang's headers and compiler-rt archives.

rdar://24912710
(cherry picked from commit 1941aaa)

@hyp hyp requested review from shahmishal and benlangmuir January 31, 2019 22:47
@hyp hyp requested a review from a team as a code owner January 31, 2019 22:47
@hyp
Copy link
Contributor Author

hyp commented Jan 31, 2019

@swift-ci build toolchain

Copy link
Member

@shahmishal shahmishal left a comment

Choose a reason for hiding this comment

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

LGTM! We will need to also update the toolchain bots before merging this PR, I will merge it once bots have been updated.

@shahmishal
Copy link
Member

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 1, 2019

Build failed
Swift Test Linux Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@shahmishal
Copy link
Member

#22282

@shahmishal
Copy link
Member

@swift-ci build toolchain

@shahmishal
Copy link
Member

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2019

Linux Toolchain (Ubuntu 16.04)
Download Toolchain
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

Install command
tar zxf swift-PR-22273-150-ubuntu16.04.tar.gz
More info

@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2019

macOS Toolchain
Download Toolchain
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

Install command
tar -zxf swift-PR-22273-197-osx.tar.gz --directory ~/

@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2019

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@benlangmuir
Copy link
Contributor

There's an issue with the libc++ header installation: https://bugs.swift.org/browse/SR-9861

@benlangmuir
Copy link
Contributor

Nevermind, that bug should not affect the swift-5 branch.

@hyp
Copy link
Contributor Author

hyp commented Feb 6, 2019

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 6, 2019

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@hyp
Copy link
Contributor Author

hyp commented Feb 11, 2019

@swift-ci test

@benlangmuir
Copy link
Contributor

@hyp while the Product issue doesn't specifically affect swift-5.0-branch, I think for consistency we should include the changes from #22404 since they affect the way that build-script-impl is invoked. That PR also depends on #22346.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@hyp
Copy link
Contributor Author

hyp commented Feb 15, 2019

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@tkremenek
Copy link
Member

@swift-ci clean test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@ianpartridge
Copy link
Contributor

Any news on when this might land? It will make a big improvement to the Swift 5 Docker images: https://forums.swift.org/t/which-clang-package-should-we-install/20542/12

@tkremenek
Copy link
Member

@swift-ci clean test macos

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@hyp
Copy link
Contributor Author

hyp commented Feb 22, 2019

@swift-ci clean test macos

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@jrose-apple
Copy link
Contributor

Heads-up that we'll need #22911 too.

@swift-ci
Copy link
Contributor

swift-ci commented Mar 5, 2019

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@akyrtzi
Copy link
Contributor

akyrtzi commented Mar 5, 2019

Discussed with @shahmishal about the OSX bot failure, we think the additional PRs @benlangmuir suggested may help to resolve the failure, @hyp will cherry-pick them to this PR.

@akyrtzi
Copy link
Contributor

akyrtzi commented Mar 5, 2019

Update: discussed with @benlangmuir and he says that clangd is problematic and is hitting an assertion hit. Given that clangd is not usable there's no reason to put all of clang+clangd in the swift-5.0 macOS toolchain, so @hyp is going to look into updating the PR to only put clang in the linux toolchain.

@ianpartridge
Copy link
Contributor

That sounds great - thanks @akyrtzi @benlangmuir @hyp!

- Build script now builds clang_tools_extra as part of LLVM's build.
- Build script now has a new libc++ build step to allow libc++ headers to be installed in the
  resulting toolchain.
- 'clang', 'clang-headers' & 'compiler-rt' targets are now installed for
  the package build configurations for linux.
- 'clang-resource-dir-symlink' is used in the package build configuration for linux
  to avoid duplication of Clang's headers and compiler-rt archives.

rdar://24912710
(cherry picked from commit 1941aaa)
@hyp hyp force-pushed the buildInstallClangAndClangd-swift5.0 branch from dcf5e20 to 76e66e9 Compare March 6, 2019 00:59
@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

Updated the PR to only install clang on Linux

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test OS X Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test Linux Platform
Git Sha - dcf5e208ddf5cd8cf6124617e0d8061a8448945b

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@shahmishal Why do the builds fail immediately?

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@swift-ci build toolchain

@shahmishal
Copy link
Member

@hyp, it's due to force push

Automatically restarting the build, due to invalid sha

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@shahmishal is macOS failure the same one we had the last time? I took out the Mac builds, but maybe the problem is in the build script?

@shahmishal
Copy link
Member

We need to cherry-pick these two PRs into #22273. Otherwise, we are going to try to install libcxx headers during PR testing.

#22404
#22346

These two PRs enable support to only install libcxx headers in package preset, the current solution in PR#22273 will try to install the headers if libcxx directory exists.

https://github.com/apple/swift/pull/22273/files#diff-65b44eb6cb88af2161d8e1176231aad0R1217

# Build libcxx, unless it doesn't exist.
	LIBCXX_SOURCE_DIR="${WORKSPACE}/libcxx"
	if [[ ! -e "${LIBCXX_SOURCE_DIR}" ]] ; then
	  SKIP_BUILD_LIBCXX=1
	fi 

This is the reason we are seeing PR failing due to "--install-destdir is required to install products."

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@swift-ci please test

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

Cherry-picked the changes

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test Linux Platform
Git Sha - 76e66e9

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test OS X Platform
Git Sha - 76e66e9

Now we build libcxx if and only if --libcxx is passed, like with other
optional products.  This loses the intended "build if sources are
checked out" behaviour, but behaves more predictably.

(cherry picked from commit e180006)

Revert "Revert "[build-script] Add Product for libc++""

add libcxx-cmake-options
@hyp hyp force-pushed the buildInstallClangAndClangd-swift5.0 branch from 71d88c5 to c221dd6 Compare March 6, 2019 21:20
@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

error: unknown setting: libcxx-cmake-options, fixed.

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test Linux Platform
Git Sha - 71d88c57c4066d216696c4cdb587a388fa17e9c7

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test OS X Platform
Git Sha - 71d88c57c4066d216696c4cdb587a388fa17e9c7

@hyp
Copy link
Contributor Author

hyp commented Mar 6, 2019

@swift-ci build toolchain

@hyp
Copy link
Contributor Author

hyp commented Mar 7, 2019

@shahmishal tests passed, please merge

@akyrtzi akyrtzi merged commit 624112d into swiftlang:swift-5.0-branch Mar 7, 2019
@ianpartridge
Copy link
Contributor

Awesome, thanks @hyp and @shahmishal!

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.

9 participants