Unable to use MongoKitten in MacOS app - missing required module 'CNIOOpenSSL
ramyrao opened this issue · comments
Describe the bug
I am trying to connect to MongoDB using MongoKitten driver in my MacOS app. I used the swift package manager to install the MongoKitten driver, however I keep getting an error
To Reproduce
My Package.Swift is as follows
import PackageDescription
let package = Package(
name: "Dependencies",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "Dependencies",
// type: .static,
targets: ["Dependencies"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/OpenKitten/MongoKitten.git", from: "5.0.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: "Dependencies",
dependencies: ["MongoKitten"]),
.testTarget(
name: "DependenciesTests",
dependencies: ["Dependencies"]),
]
)
Expected behavior
Ability to import MongoKitten and connect to the database in macOS app
Server-side Swift:
- OS: macOS 10.14 Mojave
- Swift Version: 5
- MongoKitten Version : 5.0.0
However, when I tried to build and run the code with "import MongoKitten"
I get the following error
missing required module 'CNIOOpenSSL'
I request you to let me know how to resolve this issue. I can provide any other information to help solve the matter
That version of SwiftNIO requires you to install openSSL/libreSSL headers via homebrew I believe.
I did try brew install libreSSL, but to no avail.
@ramyrao you've also selected your own machine as the target in Xcode, right?
Yes, that correct
@ramyrao Would it be possible to test if it works for you with the Swift Package Manager support in the current Xcode beta?
I just found this snippet, hope it helps you!
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
Just trying MongoKitten and having the same issue (and others) on macOS 10.14.6.