vapor/http

dyld: Library not loaded: /usr/local/opt/libressl/lib/libssl.47.dylib

RayZhao1998 opened this issue · 4 comments

Hello, I'm trying to use vapor/http, as written in the http document, I have written the following code:

import HTTP

struct EchoResponder: HTTPServerResponder {
    func respond(to request: HTTPRequest, on worker: Worker) -> EventLoopFuture<HTTPResponse> {
        let res = HTTPResponse(body: request.body)
        return worker.eventLoop.newSucceededFuture(result: res)
    }
}

let group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
defer { try! group.syncShutdownGracefully() }

let server = try HTTPServer.start(hostname: "localhost", port: 8110, responder: EchoResponder(), on: group).wait()

try server.onClose.wait()

But, It crashed. The console is:

dyld: Library not loaded: /usr/local/opt/libressl/lib/libssl.47.dylib
  Referenced from: /Users/ray/Library/Developer/Xcode/DerivedData/Vlask-ckoslomraparwddvgzyxcbsrfldg/Build/Products/Debug/Vlask
  Reason: no suitable image found.  Did find:
	/usr/local/opt/libressl/lib/libssl.47.dylib: code signature in (/usr/local/opt/libressl/lib/libssl.47.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
	/usr/local/Cellar/libressl/2.9.2/lib/libssl.47.dylib: code signature in (/usr/local/Cellar/libressl/2.9.2/lib/libssl.47.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

My environment is:

  • MacOS 10.15 Beta2
  • Xcode 11.0 Beta2
  • Swift 5.0.1

So lucky, I have solved the problem.

It seems that Xcode 11.0 has a selection in Signing & Capabilities for Disable Library Validation, make it selected and solve the problem.

Hi @RayZhao1998 where can i find Disable Library Validation? Didn't see it in app, run or Vapor tagets

Hi @RayZhao1998 where can i find Disable Library Validation? Didn't see it in app, run or Vapor tagets

Hi @hyouuu , select the Run target and in Signing & Capabilities you can add a capability called 'Hardened Runtime', then you can see the selection of Disable Library Validation.

image

Interesting - the whole "Hardened Runtime" section doesn't show on my vapor project. But I was able to fix it by running vapor update.
Thanks anyways!