Skip to content
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

[Build] Enable building the early Swift Driver on linux with the prebuilt host toolchain #69564

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

finagolfin
Copy link
Contributor

@finagolfin finagolfin commented Nov 1, 2023

@bnbarham, let's see if this works on the linux CI now. This simply reverts most of your #68091, with the prebuilt Swift toolchain now installed on the linux CI.

@bnbarham
Copy link
Contributor

bnbarham commented Nov 1, 2023

@swift-ci please build toolchain

@finagolfin
Copy link
Contributor Author

Alright, the only platform actually affected by this pull worked, linux. I checked the CI log and it's building and using the early swift driver just fine.

MacOS and Windows aren't affected by this pull: the former had a spurious build failure, while the latter's CI appears to be broken right now.

@bnbarham, ready for review and merge.

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please build toolchain UBI9

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please build toolchain CentOS 7

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please build toolchain Ubuntu 22.04

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please build toolchain Amazon Linux 2

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please build toolchain Ubuntu 18.04

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please test

@finagolfin
Copy link
Contributor Author

Linux CI failed because the early swift driver tests are now being run, maybe for the first time on linux. @artemcm, you added those tests in #36377 a couple years ago, did you ever try them on linux? Natively on Android, I simply disable them with --skip-test-early-swift-driver.

Amazon Linux 2 toolchain build failed at source checkout, unrelated to this pull.

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

@swift-ci please build toolchain Amazon Linux 2

@bnbarham
Copy link
Contributor

bnbarham commented Nov 2, 2023

Natively on Android, I simply disable them with --skip-test-early-swift-driver.

I'd rather get to the bottom of the failures than just disable them 😅. That really just needs reproducing locally since the tests just all fail with exit code 1 though.

@finagolfin
Copy link
Contributor Author

I'd rather get to the bottom of the failures than just disable them

Both this CI and my native Android toolchain build run the more extensive tests in the swift-driver repo later in the build, so I figured that's enough.

That really just needs reproducing locally since the tests just all fail with exit code 1 though.

Not all, if you scroll down, there are weird errors like this:

Command Output (stderr):
--
Swift version 5.11-dev (LLVM 1cd18baafcdabfd, Swift e002773d258ee29)
Target: x86_64-unknown-linux-gnu
Handled a.swift
Handled b.swift
Handled c.swift
Handled d.swift
Handled e.swift
Handled f.swift
Handled g.swift
error: autolink-extract command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: error opening input file 'a.o' (The file was not recognized as a valid object file
)

Most likely, it is just the various environment variables not being set right on linux. I figured it was something like that on Android and never looked into it.

@finagolfin
Copy link
Contributor Author

Looked into those failing tests, it appears they are surfacing a genuine discrepancy between the legacy C++ Driver and the new swift-driver. I'm working on a fix.

@finagolfin
Copy link
Contributor Author

@artemcm, how about a CI run with swiftlang/swift-driver#1479, that should fix most of these tests.

@artemcm
Copy link
Contributor

artemcm commented Nov 7, 2023

@finagolfin
Copy link
Contributor Author

Rebased and added a fix for the single failing test, @bnbarham, need another CI run with the linked swift-driver pull.

@@ -9,7 +9,7 @@
// CHECK-INITIAL: {{(Job finished: {compile: main.o <= main.swift}|Finished Compiling main.swift)}}
// CHECK-INITIAL: {{(Job finished: {compile: file1.o <= file1.swift}|Finished Compiling file1.swift)}}
// CHECK-INITIAL: {{(Job finished: {compile: file2.o <= file2.swift}|Finished Compiling file2.swift)}}
// CHECK-INITIAL: {{(Job finished: {link: main <= main.o file1.o file2.o}|Finished Linking main)}}
// CHECK-INITIAL: {{(Job finished: {link: main <= main.o file1.o file2.o|Finished Linking main)}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test now passes on linux as part of the early swift driver tests, so I enabled it, but it then failed with the old C++ Driver.

The issue is that these two lines don't expect another autolink file to be added on macOS, but that is needed on linux, which outputs this instead:

Job finished: {link: main <= main.o file1.o file2.o ... 1 more}

Omitting the closing brace here and below should get this test to work on both Mac and linux.

@bnbarham
Copy link
Contributor

bnbarham commented Nov 8, 2023

swiftlang/swift-driver#1479
@swift-ci test

@finagolfin
Copy link
Contributor Author

@bnbarham, ready for review and merge, after one last Windows CI run and merge of the linked swift-driver pull, that gets these early swift driver tests to work on linux.

@DougGregor
Copy link
Member

Oh, this is great. Thank you @finagolfin

@bnbarham
Copy link
Contributor

bnbarham commented Nov 9, 2023

Thanks @finagolfin! I'll do one last toolchain build and then merge :)

@bnbarham
Copy link
Contributor

bnbarham commented Nov 9, 2023

swiftlang/swift-driver#1479

@swift-ci please build toolchain Ubuntu 22.04

@bnbarham bnbarham merged commit 9ea3146 into swiftlang:main Nov 9, 2023
6 checks passed
@finagolfin finagolfin deleted the early-driver branch November 10, 2023 03:13
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.

4 participants