Closed lendvair closed 1 year ago
Any idea @krzyzanowskim? Still couldn't solve this issue. Are you able to reproduce it?
Hi, this issue is related to update of underlying OpenSSL library (from 1.0. to 1.1.) made here in this repo in July.
OpenSSL 1.1.* switched to predefined C structs and Swift is not handling them very nicely. You can read something about it here.
Hi, I'm also having issues with Xcode 12.3 (12C33), I've tried to import OpenSSL in every way possible, also tried to run the Cocoapods Integration-Example, but I'm always getting the same error:
No such module 'OpenSSL'
Someone can help me? I need to upgrate OpenSSL to the latest version to get M1 support...
Thanks
@Oni-zerone arm is supported since 1.1.x. It looks like some configuration issue you have. You can always get OpenSSL.xcframework and link it manually.
I got the same issue with @Oni-zerone. I have Xcode 13.1 and OpenSSL 1.1.13 added via Swift Package Manager, and "No such module OpenSSL" error appeared when I try to use import OpenSSL
line.
This error disappears when I clean the build folder, build the project, and wait until the build process is complete.
For me, the import seems working fine (I'm using SPM) but I have the same error as @lendvair:
Cannot find type 'X509' in scope
for a simple line:
let cert : UnsafeMutablePointer<X509>
How to solve this? Is it some configuration issue or we can't use X509 this way anymore? If not, what is a proper implementation for dealing with X509 certificates now? @lendvair were you able to fix this?
X509 struct is no longer part of the public API in OpenSSL 1.1.x. All you can do is use OpaquePointer with functions
I'm using the library in Objective-C and can use the X509 stuff with an import
And do stuff like X509 *x509 = PEM_read_bio_X509(blob, NULL, 0, NULL);
afair struct itself is in private header, the X509 is just a declaration, and Swift don't understand that
There is a new Apple package for working with X509 certificates. Haven't tried that myself.
Whatever you do, you just need to use X509 functions that are available and pass OpaquePointer
let x509 = d2i_X509(...) // OpaquePointer
X509_free(x509)
also since Swift can't import macros, some functions may not be available and you have to untangle C macro manually
Hi Marcin,
I tried to build your CocoaPods Example application on master branch. Downloaded, pod install, build, happiness.
If I insert at line 17 in AppDelegate.swift:
let cert : UnsafeMutablePointer<X509>
Xcode failed to build the application with the following error at line 17: Cannot find type 'X509' in scope. I've tried everything to solve this issue, but ran out of ideas.
Xcode 12.3 (12C33)
Could you check it please?
Best regards, Richard