Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Add workarounds to address missing libswift_Concurrency.dylib (#113)
Browse files Browse the repository at this point in the history
Added platform declarations and linker flags to work around the missing libswift_Concurrency.dylib errors.
  • Loading branch information
cgrindel committed Jan 22, 2022
1 parent 911b0af commit 6e0ced8
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
7 changes: 2 additions & 5 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ ALL_OS_TEST_EXAMPLES = [
"simple",
"simple_revision",
"simple_with_binary",
# GH090: Disabled tests due to error:
# "Library not loaded: /usr/lib/swift/libswift_Concurrency.dylib"
#
# "local_package",
# "vapor",
"local_package",
"vapor",
]

MACOS_TEST_EXAMPLES = [
Expand Down
19 changes: 19 additions & 0 deletions examples/local_package/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")

config_setting(
name = "macos_os",
constraint_values = [
"@platforms//os:osx",
],
)

swift_binary(
name = "local_package",
srcs = ["main.swift"],
# Workaround for missing libswift_Concurrency.dylib
# https://forums.swift.org/t/swift-concurrency-back-deploy-issue/53917/10
linkopts = select({
":macos_os": [
"-Wl",
"-weak-lswift_Concurrency",
"-Wl",
"-rpath",
"/usr/lib/swift",
],
"//conditions:default": [],
}),
visibility = ["//swift:__subpackages__"],
deps = [
"@swift_pkgs//foo-kit:FooKit",
Expand Down
9 changes: 7 additions & 2 deletions examples/local_package/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ spm_repositories(
name = "swift_pkgs",
dependencies = [
spm_pkg(
from_version = "1.0.0",
exact_version = "1.4.2",
products = ["Logging"],
url = "https://github.com/apple/swift-log.git",
),
spm_pkg(
from_version = "2.0.0",
exact_version = "2.37.0",
products = ["NIO"],
url = "https://github.com/apple/swift-nio.git",
),
Expand All @@ -63,4 +63,9 @@ spm_repositories(
products = ["FooKit"],
),
],
# New concurrency stuff is supported in macOS v12.
platforms = [
".macOS(.v12)",
],
swift_version = "5.5",
)
21 changes: 20 additions & 1 deletion examples/vapor/Tests/AppTests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_test")

config_setting(
name = "macos_os",
constraint_values = [
"@platforms//os:osx",
],
)

swift_test(
name = "AppTests",
srcs = glob(["*.swift"]),
# Workaround for missing libswift_Concurrency.dylib
# https://forums.swift.org/t/swift-concurrency-back-deploy-issue/53917/10
linkopts = select({
":macos_os": [
"-Wl",
"-weak-lswift_Concurrency",
"-Wl",
"-rpath",
"/usr/lib/swift",
],
"//conditions:default": [],
}),
deps = [
"//Sources/App/Configuration",
"@swift_pkgs//vapor:XCTVapor",
"@zlib//:zlib",
"@zlib",
],
)
10 changes: 6 additions & 4 deletions examples/vapor/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,26 @@ spm_repositories(
dependencies = [
spm_pkg(
"https://github.com/vapor/vapor.git",
from_version = "4.0.0",
exact_version = "4.54.1",
products = [
"Vapor",
"XCTVapor",
],
),
spm_pkg(
"https://github.com/vapor/fluent.git",
from_version = "4.0.0",
exact_version = "4.4.0",
products = ["Fluent"],
),
spm_pkg(
"https://github.com/vapor/fluent-sqlite-driver.git",
from_version = "4.0.0",
exact_version = "4.1.0",
products = ["FluentSQLiteDriver"],
),
],
# New concurrency stuff is supported in macOS v12.
platforms = [
".macOS(.v10_15)",
".macOS(.v12)",
],
swift_version = "5.5",
)

0 comments on commit 6e0ced8

Please sign in to comment.