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 error on Ubuntu 18, Swift 5.1 : "reference to 'SHA256_CTX' is ambiguous" #116
Comments
This error seems surprising: we seem to be conflicting with libssl. I’m a bit surprised that the libssl is being included at all though. Can you provide the verbose output for this build? |
Sure, here it is
|
I can reproduce. This looks like a new bug in Swift 5.1. Here's my repro project: Package.swift // swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "qwer",
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/vapor/console-kit.git", from: "4.0.0-alpha.1"),
.package(url: "https://github.com/vapor/nio-websocket-client.git", from: "1.0.0-alpha.1"),
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.1.1"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.1.0"),
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-alpha.1.5"),
.package(url: "https://github.com/vapor/swift-nio-http-client.git", from: "0.0.0"),
.package(url: "https://github.com/kylebrowning/APNSwift", from: "1.0.0"),
.package(url: "https://github.com/vapor/crypto-kit.git", from: "4.0.0-alpha.1"),
.package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.3.0"),
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.1.0"),
.package(url: "https://github.com/vapor/routing-kit.git", from: "4.0.0-alpha.1"),
.package(url: "https://github.com/vapor/async-kit.git", from: "1.0.0-alpha.1"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.4.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "qwer",
dependencies: [
"APNSwift",
"Vapor",
"NIOWebSocketClient",
"NIOHTTPClient",
"NIOExtras",
"NIOHTTPCompression",
"ConsoleKit",
"RoutingKit",
"NIO",
"_NIO1APIShims",
"NIOTLS",
"NIOHTTP1",
"NIOConcurrencyHelpers",
"NIOFoundationCompat",
"NIOWebSocket",
"NIOTestUtils",
"Logging",
"AsyncKit",
"NIOHTTP2",
"NIOSSL",
"CryptoKit",
]),
.testTarget(
name: "qwerTests",
dependencies: ["qwer"]),
]
) and import APNSwift
import Vapor
import NIOWebSocketClient
import NIOHTTPClient
import NIOExtras
import NIOHTTPCompression
import ConsoleKit
import RoutingKit
import NIO
import _NIO1APIShims
import NIOTLS
import NIOHTTP1
import NIOConcurrencyHelpers
import NIOFoundationCompat
import NIOWebSocket
import NIOTestUtils
import Logging
import AsyncKit
import NIOHTTP2
import NIOSSL
import CryptoKit
print("Hello, world!") when compiled with swift 5.1 from Xcode 11 beta 3 (
followed by a Swift compiler crasher
filed as https://bugs.swift.org/browse/SR-11125 . |
Motivation: If we don't import CNIOBoringSSL @_implementationOnly, then some details of libssl's C structs might leak into NIOSSL's ABI which might lead to clashes further down the line. Modification: - make all CNIOBoringSSL(Shims) imports @_implementationOnly - remove all concrete libssl types from instance variables Result: - fixes apple#116 - works around SR-11125
Motivation: If we don't import CNIOBoringSSL @_implementationOnly, then some details of libssl's C structs might leak into NIOSSL's ABI which might lead to clashes further down the line. Modification: - make all CNIOBoringSSL(Shims) imports @_implementationOnly - remove all concrete libssl types from instance variables Result: - fixes apple#116 - works around SR-11125
Motivation: If we don't import CNIOBoringSSL @_implementationOnly, then some details of libssl's C structs might leak into NIOSSL's ABI which might lead to clashes further down the line. Modification: - make all CNIOBoringSSL(Shims) imports @_implementationOnly - remove all concrete libssl types from instance variables Result: - fixes #116 - works around SR-11125
@glaurent we released the workaround. Mind trying again? |
@weissi I just did. I confirm that it works fine now, thanks a lot 👍 |
Amazing, thanks |
I'm trying to build swift-nio-ssl on an Ubuntu 18 machine, using Swift 5.1, as part of a server based on Vapor 4 alpha (yes I know). Everything builds fine except for the following error :
<unknown>:0: error: reference to 'SHA256_CTX' is ambiguous /srv/datadisk01/www/VideoSaverServer/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include/CNIOBoringSSL/base.h:411:32: note: candidate found by name lookup is 'SHA256_CTX' typedef struct sha256_state_st SHA256_CTX; ^ //usr/include/openssl/sha.h:56:3: note: candidate found by name lookup is 'SHA256_CTX' } SHA256_CTX; ^ Failed to reconstruct type for $sSo10SHA256_CTXaD Original type: (type_alias_type decl=CAPNSOpenSSL.(file).SHA256_CTX)
Is that error expected somehow ? I have libssl 1.1 installed on this server, on which the vapor package depends.
The text was updated successfully, but these errors were encountered: