vapor / http

🚀 Non-blocking, event-driven HTTP built on Swift NIO.
MIT License
240 stars 65 forks source link

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

Closed RayZhao1998 closed 5 years ago

RayZhao1998 commented 5 years ago

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:

RayZhao1998 commented 5 years ago

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.

hyouuu commented 4 years ago

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

RayZhao1998 commented 4 years ago

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
hyouuu commented 4 years ago

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!