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

swift 5.9.2 #157113

Merged
merged 2 commits into from
Feb 22, 2024
Merged

swift 5.9.2 #157113

merged 2 commits into from
Feb 22, 2024

Conversation

razvanazamfirei
Copy link
Member

@razvanazamfirei razvanazamfirei commented Dec 12, 2023

Created by brew bump


Created with brew bump-formula-pr.

  • resource blocks have been checked for updates.

@github-actions github-actions bot added python Python use is a significant feature of the PR or issue bump-formula-pr PR was created using `brew bump-formula-pr` long build Set a long timeout for formula testing icu4c ICU use is a significant feature of the PR or issue labels Dec 12, 2023
@razvanazamfirei razvanazamfirei added the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 12, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 12, 2023
@p-linnane p-linnane requested a review from Bo98 December 12, 2023 22:30
@p-linnane p-linnane mentioned this pull request Dec 12, 2023
1 task
@Bo98 Bo98 self-assigned this Dec 12, 2023
@Bo98
Copy link
Member

Bo98 commented Dec 12, 2023

Will have more time to look into issues here unlike last time now that Ruby 3 is basically done.

All the changes in the original Swift 5.9 PR should however apply here (except the CMake patch)

@razvanazamfirei razvanazamfirei added CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. and removed CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. labels Dec 13, 2023
@github-actions github-actions bot added CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. and removed CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. labels Dec 13, 2023
@razvanazamfirei razvanazamfirei added the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 15, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 16, 2023
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. To keep this pull request open, add a help wanted or in progress label.

@github-actions github-actions bot added the stale No recent activity label Dec 18, 2023
@Bo98 Bo98 removed the stale No recent activity label Dec 19, 2023
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. To keep this pull request open, add a help wanted or in progress label.

@github-actions github-actions bot added the stale No recent activity label Dec 22, 2023
@razvanazamfirei razvanazamfirei added CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. and removed stale No recent activity labels Dec 22, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 22, 2023
@Bo98 Bo98 added the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 22, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 22, 2023
@Bo98 Bo98 added the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 22, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 22, 2023
@Bo98 Bo98 added the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 22, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Dec 23, 2023
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Feb 20, 2024
@Bo98 Bo98 added CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. CI-linux-self-hosted Build on Linux self-hosted runner labels Feb 21, 2024
@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Feb 21, 2024
@SMillerDev
Copy link
Member

We'll need to try this again later I guess.

The self-hosted runner: 12-arm64-7978145460-2 lost communication with the server. Verify the machine is running and has a healthy network connection. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

@finagolfin
Copy link

No matter what, it seems pkg-config is not respected.

I doubt that, since it worked with 5.8, though as you say we cannot account for spuriously installed headers. You can try running the failing SwiftPM command manually with the --vv flag, to make sure it is invoking pkg-config correctly.

@Bo98
Copy link
Member

Bo98 commented Feb 21, 2024

You can reproduce the same issue in the official Docker image. That indicates to me that it's not a Homebrew-specific problem:

$ docker run --rm -it swift:5.9.2
# apt update
# apt install g++ make cmake curl
# cd /root
# curl -LO https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz
# tar xf sqlite-autoconf-3450100.tar.gz
# cd sqlite-autoconf-3450100
# ./configure --prefix=/opt/prefix
# make install
# cd ..
# export PKG_CONFIG_PATH=/opt/prefix/lib/pkgconfig
# pkg-config --cflags sqlite3
-I/opt/prefix/include
# git clone https://github.com/apple/swift-package-manager
# cd swift-package-manager
# git checkout swift-5.9.2-RELEASE
# swift build
/root/swift-package-manager/.build/checkouts/swift-llbuild/lib/Core/SQLiteBuildDB.cpp:28:10: fatal error: 'sqlite3.h' file not found
#include <sqlite3.h>
         ^~~~~~~~~~~
1 error generated.

--vv does not show any pkg-config line. --pkg-config-path vs PKG_CONFIG_PATH makes no difference

@Bo98 Bo98 added the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Feb 21, 2024
@finagolfin
Copy link

Oh, just thought of it and looked it up, maybe you need to add Homebrew as a linux packager in SwiftPM?

@Bo98
Copy link
Member

Bo98 commented Feb 21, 2024

That's a fair point that Homebrew for Linux should probably be added to that in order to make things work without needing to manually specify PKG_CONFIG_PATH (though not entirely sure how to implement a combined Homebrew + system package manager setup given pkg-config only respects the first provider: https://github.com/apple/swift-package-manager/blob/058574d8aa40dbc7d9208b44164d8cff622b9b72/Sources/PackageLoading/Target%2BPkgConfig.swift#L76)

Though the result of that is always merged with PKG_CONFIG_PATH, so ultimately the result is the same to what we're already doing here for llbuild: https://github.com/apple/swift-package-manager/blob/98747d519cab0a5e0a1610ccf8d558cbd4099454/Sources/PackageLoading/PkgConfig.swift#L82

@finagolfin
Copy link

--vv does not show any pkg-config line.

Stick a swift package clean in right before checking the verbose output, or at some point SwiftPM stops running pkg-config and just uses the cached build config. I had no problem seeing the pkg-config invocation on Fedora linux just now with the system Swift 5.8.1, except after a couple swift build invocations without cleaning in between.

Though the result of that is always merged with PKG_CONFIG_PATH, so ultimately the result is the same to what we're already doing here for llbuild

Obviously not, as something is going wrong: you'll probably need to step through with a debugger or build a SwiftPM that prints some output to figure this out.

@Bo98
Copy link
Member

Bo98 commented Feb 21, 2024

Stick a swift package clean in right before checking the verbose output, or at some point SwiftPM stops running pkg-config and just uses the cached build config. I had no problem seeing the pkg-config invocation on Fedora linux just now with the system Swift 5.8.1, except after a couple swift build invocations without cleaning in between.

I see

debug: pkg-config --variable pc_path pkg-config

but that's about it.

And just to confirm pkg-config works, I ran:

// swift-tools-version: 5.9

import PackageDescription

let package = Package(
    name: "libTest",
    targets: [
        .systemLibrary(name: "testsqlite3", pkgConfig: "sqlite3"),
        .target(name: "libTest", dependencies: ["testsqlite3"]),
    ]
)

And it works fine (note the -I/opt/prefix/include):

debug: pkg-config --variable pc_path pkg-config
Building for debugging...
/usr/bin/clang -target aarch64-unknown-linux-gnu -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=libTest -I /tmp/swifttest/Sources/libTest/include -fmodule-map-file=/tmp/swifttest/Sources/testsqlite3/module.modulemap -I/opt/prefix/include -fmodules-cache-path=/tmp/swifttest/.build/aarch64-unknown-linux-gnu/debug/ModuleCache -fPIC -fno-omit-frame-pointer -MD -MT dependencies -MF /tmp/swifttest/.build/aarch64-unknown-linux-gnu/debug/libTest.build/main.c.d -c /tmp/swifttest/Sources/libTest/main.c -o /tmp/swifttest/.build/aarch64-unknown-linux-gnu/debug/libTest.build/main.c.o

It only doesn't work with llbuild's Package.swift, which doesn't use .systemLibrary. Note that the SPMSQLite3 in SwiftPM itself, which uses .systemLibrary, compiles and links absolutely fine - no further hacks were necessary beyond llbuild.

@finagolfin
Copy link

OK, so pkg-config is run and the pkg-config-path is being set fine for you then, and we go back to the original issue of whether SwiftPM's dependency on SQLite should be applied to llbuild also. I figured it was, since it cross-compiles fine for me, but as I said a couple weeks ago, I wasn't sure.

We'll need to dig into that next.

@Bo98
Copy link
Member

Bo98 commented Feb 21, 2024

Something to compare between us would be this verbose output of SQLiteBuildDB.cpp.o (this one's from the Swift Docker image, so might be a little different if running a full Swift build):

/usr/bin/clang -target aarch64-unknown-linux-gnu -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=llbuildCore -I /root/swift-package-manager/.build/checkouts/swift-llbuild/lib/Core/include -I /root/swift-package-manager/.build/checkouts/swift-llbuild/lib/Basic/include -fmodule-map-file=/root/swift-package-manager/.build/aarch64-unknown-linux-gnu/debug/llbuildBasic.build/module.modulemap -I /root/swift-package-manager/.build/checkouts/swift-llbuild/lib/llvm/Support/include -fmodule-map-file=/root/swift-package-manager/.build/aarch64-unknown-linux-gnu/debug/llvmSupport.build/module.modulemap -I /root/swift-package-manager/.build/checkouts/swift-llbuild/lib/llvm/Demangle/include -fmodule-map-file=/root/swift-package-manager/.build/aarch64-unknown-linux-gnu/debug/llvmDemangle.build/module.modulemap -fmodules-cache-path=/root/swift-package-manager/.build/aarch64-unknown-linux-gnu/debug/ModuleCache -fPIC -fno-omit-frame-pointer -MD -MT dependencies -MF /root/swift-package-manager/.build/aarch64-unknown-linux-gnu/debug/llbuildCore.build/SQLiteBuildDB.cpp.d -std=c++14 -c /root/swift-package-manager/.build/checkouts/swift-llbuild/lib/Core/SQLiteBuildDB.cpp -o /root/swift-package-manager/.build/aarch64-unknown-linux-gnu/debug/llbuildCore.build/SQLiteBuildDB.cpp.o

Note that it's missing -I/opt/prefix/include. Where does your pkg-config --cflags sqlite3 point to and do you see those flags passed to the compiler?

@finagolfin
Copy link

Where does your pkg-config --cflags sqlite3 point to and do you see those flags passed to the compiler?

I'll schedule a build tomorrow and check. It's possible that since the Termux build also sets CFLAGS, the llbuild dependency is fulfilled by that, while --pkg-config-path only applies to the SwiftPM dependency on SQLite. I will run a verbose build and let you know why it worked for me.

@finagolfin
Copy link

finagolfin commented Feb 21, 2024

Alright, ran a verbose build that removed the --pkg-config-path flags, finagolfin/termux-packages@32fc996ec. It shows pkg-config invoked, SQLiteBuildDB.cpp.o still building fine (implying it's getting that include directory from CFLAGS or elsewhere, not from pkg-config), and the final link fails because it's missing the path to the cross-compiled SQLite library, which pkg-config did supply before I disabled the --pkg-config-path flags for this run.

It appears you are right that llbuild will require making its SQLite dependency explicit, and your previous 5.8 Homebrew build and my Termux builds happened to work for other reasons.

@Bo98
Copy link
Member

Bo98 commented Feb 21, 2024

Thanks for checking that! Indeed, final link seems to work as expected.

I think we can consider this being reported as swiftlang/swift-llbuild#901

@github-actions github-actions bot removed the CI-long-timeout [DEPRECATED] Use longer GitHub Actions CI timeout. label Feb 22, 2024
Copy link
Contributor

🤖 An automated task has requested bottles to be published to this PR.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Feb 22, 2024
@BrewTestBot BrewTestBot added this pull request to the merge queue Feb 22, 2024
Merged via the queue into Homebrew:master with commit d443fa4 Feb 22, 2024
12 checks passed
@razvanazamfirei razvanazamfirei deleted the bump-swift-5.9.2 branch March 13, 2024 00:55
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 12, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bump-formula-pr PR was created using `brew bump-formula-pr` CI-linux-self-hosted Build on Linux self-hosted runner CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. icu4c ICU use is a significant feature of the PR or issue in progress Stale bot should stay away long build Set a long timeout for formula testing outdated PR was locked due to age python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants