Perfect icon indicating copy to clipboard operation
Perfect copied to clipboard

It won't compile with openssl 1.1

Open GildedHonour opened this issue 6 years ago • 7 comments

$ 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 avatar Jul 31 '18 02:07 GildedHonour

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

GildedHonour avatar Jul 31 '18 02:07 GildedHonour

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 avatar Aug 24 '18 18:08 mxcl

K on Ubuntu 18.04 you can:

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

Which will get you passed this issue.

mxcl avatar Aug 24 '18 18:08 mxcl

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

I recommend sticking with Ubuntu 16.04

mxcl avatar Aug 24 '18 18:08 mxcl

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

nordbit avatar Aug 25 '18 08:08 nordbit

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?

k-mlynarski avatar Oct 04 '18 11:10 k-mlynarski

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

LeeCenY avatar Nov 19 '18 02:11 LeeCenY