Closed kzahedi closed 5 years ago
Hello 👋 This could happen because your version of macOS doesn't have the openSSL or libreSSL headers installed by default. If that's not the case it might be that your Xcodeproject was created without pkg-config
installed, it will likely not find the C library (libssl) without it.
Just so I can help better; what steps did you use to create the playground?
Thank you very much for your fast reply. Here are my steps:
My Swift Playground is:
import Cocoa import MongoKitten
var str = "Hello, playground"
And I receive the following error message
error: missing required module 'CNIOOpenSSL'
I have attached a screenshot below.
The failed compile message for MongoKitten contains 999+ compile errors. I have screenshotted a few of them in the second screenshot below. I had installed sourcery via homebrew.
Thanks, Keyan
The 120 characters error is not an error in our project or tooling. I'm suspecting your xcworkspace is running some script over the code for linting with a configuration we do not support. How did you link the playground against MongoKitten?
I am new to swift and playground. Basically, I followed the instructions I found in a WWDC talk. I opened a new workspace and included the MongoKitten.xcodeproj using the "Add file to
I don't recall installing swiftlint via brew, but somehow, it was installed. Uninstalling it removed all the compile errors for MongoKitten, but the include problem remains. Trying the run the three lines of code shown above still results in:
error: missing required module 'CNIOOpenSSL'
Recompiling CNIOOpenSSL did not resolve the issue.
try using https://github.com/JohnSundell/TestDrive
I didn't try the above, but I'm not sure how to get it working otherwise. If you clone MongoKitten itself using git
or by copying the zip
from the releases tab here on github. You can run swift build
. Does this work?
Does it work if you create the xcodeproject then with swift package generate-xcodeproj
?
try using https://github.com/JohnSundell/TestDrive
Thanks for the tip. Unfortunately, it does not work for MongoKitten:
testdrive https://github.com/OpenKitten/MongoKitten.git 📦 Cloning https://github.com/OpenKitten/MongoKitten.git... 🚢 Resolving latest version... 📋 Checking out 5.1.1... 💥 Xcode project missing at 'https://github.com/OpenKitten/MongoKitten.git'
Hmm... 🙁 None of those tools all support SPM it seems. You can try to create a small package (without Playground) for now.
mkdir NotAPlayground
cd NotAPlayground
swift package init --type=exeuctable
open Package.swift
swift package generate-xcodeproj
open NotAPlayground.xcodeproj
That works fine but causes other problems. One that is related to MongoKitten is the question of how to wait for the find expression to complete before moving on in the code.
SwiftNIO provides the wait()
API on all promises. Don't use it within an eventloop. So you'll want to use Database.synchronousConnect(...)
and then wait()
for all operations.
Thanks. That worked. Now I need to find out, how the second library that I rely on works in an executable setting :)
It would still be great to see MongoKitten work in a playground setting. I am trying to move from Python to Swift for my data science stuff and ML stuff.
@kzahedi if you're interested, we're working on MongoKitten mobile which supports Cocoapods as well as MongoDB's embedded database and NIOTransportServices for macOS and iOS.
I'm closing this since it's solved, but feel free to ask me other things here or in slack 👍
Hi,
I'm trying to use MongoKitten in a Swift Playground for Data Science purposes. Unfortunately, I cannot get it to work, because it will not find the CNIOOpenSSL module.
Does anyone know a solution to this problem?
Best, Keyan