PerfectlySoft / Perfect

Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)
https://www.perfect.org
Apache License 2.0
13.83k stars 945 forks source link

It won't compile with openssl 1.1 #264

Open GildedHonour opened 6 years ago

GildedHonour commented 6 years ago
$ openssl version
OpenSSL 1.1.0h  27 Mar 2018

When I compile a test app, I get:

-1.0 -Xlinker -L/usr/lib/openssl-1.0
Compile Swift Module 'PerfectThread' (3 sources)
Compile Swift Module 'PerfectLib' (9 sources)
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/PerfectLib.git-1786198115510552362/Sources/PerfectLib/Dir.swift:129:16: warning: 'readdir_r' is deprecated
        return readdir_r(d, &dirEnt, endPtr)
               ^
Compile Swift Module 'PerfectCrypto' (7 sources)
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/ByteIO.swift:64:45: error: use of undeclared type 'BIO'
typealias BIOPointer = UnsafeMutablePointer<BIO>?
                                            ^~~
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/ByteIO.swift:78:48: error: use of undeclared type 'BIO_METHOD'
        fileprivate init(method: UnsafeMutablePointer<BIO_METHOD>?) {
                                                      ^~~~~~~~~~
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/ByteIO.swift:232:11: error: initializer does not override a designated initializer from its superclass
        override init(bio: BIOPointer) {
        ~~~~~~~~ ^
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/ByteIO.swift:210:14: error: 'checkedResult' produces 'Int', not the expected contextual result type 'Int'
                return try checkedResult(Int(BIO_write(head, bytes.baseAddress, Int32(bytes.count))))
                           ^
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/OpenSSLInternal.swift:281:25: error: use of undeclared type 'EVP_MD'
        var evp: UnsafePointer<EVP_MD> {
                               ^~~~~~
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/OpenSSLInternal.swift:408:25: error: use of undeclared type 'EVP_CIPHER'
        var evp: UnsafePointer<EVP_CIPHER> {
                               ^~~~~~~~~~
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/ByteIO.swift:64:45: error: use of undeclared type 'BIO'
typealias BIOPointer = UnsafeMutablePointer<BIO>?
                                            ^~~
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/ByteIO.swift:78:48: error: use of undeclared type 'BIO_METHOD'
        fileprivate init(method: UnsafeMutablePointer<BIO_METHOD>?) {
                                                      ^~~~~~~~~~
/home/alex/projects/swift/PerfectTemplate/.build/checkouts/Perfect-Crypto.git--6715580120719650082/Sources/PerfectCrypto/Keys.swift:35:35: error: use of undeclared type 'EVP_PKEY'
        init(_ key: UnsafeMutablePointer<EVP_PKEY>?) {
                                         ^~~~~~~~
error: terminated(1): /usr/bin/swift-build-tool -f /home/alex/projects/swift/PerfectTemplate/.build/debug.yaml main output:
GildedHonour commented 6 years ago

I've also tried this

$ export="PKG_CONFIG_PATH /usr/lib/openssl-1.0/pkgconfig"
$swift build

and

$ swift build -Xswiftc -I/usr/include/openssl

didn't help

mxcl commented 6 years ago

I experience this also on Ubuntu 18.04 which I needed to get curl > 7.51.

This is the 5th time I've found an issue with Perfect that is ignored by the maintainers, if I can't find a solution to this I'm trying Vapor instead.

Perfect has mostly been good, but it seems unmaintained and mostly unloved.

mxcl commented 6 years ago

K on Ubuntu 18.04 you can:

sudo apt-get install openssl1.0 libssl1.0-dev

Which will get you passed this issue.

mxcl commented 6 years ago

No, this leads to dependency hell since there is no libcurl-dev for OpenSSL 1.0.

I recommend sticking with Ubuntu 16.04

nordbit commented 6 years ago

Compiled successful under 18.04.1 and published yestreday swift 4.2 snapshot for 18.04 (Swift version 4.2 (swift-4.2-CONVERGENCE))

k-mlynarski commented 6 years ago

Compiled successful under 18.04.1 and published yestreday swift 4.2 snapshot for 18.04 (Swift version 4.2 (swift-4.2-CONVERGENCE))

Could you please tell a little more about this? What did you have to do to make it work?

LeeCenY commented 5 years ago

This project includes a script which will install Swift and all major dependencies for Perfect directly into your Ubuntu system. https://github.com/PerfectlySoft/Perfect-Ubuntu