krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
907 stars 334 forks source link

Failed to use in Objc when installing with Carthage #119

Closed caioremedio closed 2 years ago

caioremedio commented 3 years ago

I'm adding using carthage with the following command:

carthage update --platform iOS OpenSSL --use-xcframeworks

Build process is fine, the problem is when deploying on a real device. js_rsa its a custom class in objc that use some imports from OpenSSL.

Undefined symbols for architecture arm64:
  "_PEM_read_RSA_PUBKEY", referenced from:
      _js_public_encrypt in js_rsa.o
      _js_public_decrypt in js_rsa.o
  "_RSA_private_encrypt", referenced from:
      _js_private_encrypt in js_rsa.o
  "_RSA_public_encrypt", referenced from:
      _js_public_encrypt in js_rsa.o
  "_RSA_size", referenced from:
      _js_private_decrypt in js_rsa.o
      _js_public_encrypt in js_rsa.o
      _js_private_encrypt in js_rsa.o
      _js_public_decrypt in js_rsa.o
  "_RSA_public_decrypt", referenced from:
      _js_public_decrypt in js_rsa.o
  "_RSA_private_decrypt", referenced from:
      _js_private_decrypt in js_rsa.o
  "_ERR_load_CRYPTO_strings", referenced from:
      _js_private_decrypt in js_rsa.o
      _js_public_encrypt in js_rsa.o
      _js_private_encrypt in js_rsa.o
      _js_public_decrypt in js_rsa.o
  "_ERR_get_error", referenced from:
      _js_private_decrypt in js_rsa.o
      _js_public_encrypt in js_rsa.o
      _js_private_encrypt in js_rsa.o
      _js_public_decrypt in js_rsa.o
  "_PEM_read_RSAPrivateKey", referenced from:
      _js_private_decrypt in js_rsa.o
      _js_private_encrypt in js_rsa.o
  "_ERR_error_string", referenced from:
      _js_private_decrypt in js_rsa.o
      _js_public_encrypt in js_rsa.o
      _js_private_encrypt in js_rsa.o
      _js_public_decrypt in js_rsa.o
  "_RSA_free", referenced from:
      _js_private_decrypt in js_rsa.o
      _js_public_encrypt in js_rsa.o
      _js_private_encrypt in js_rsa.o
      _js_public_decrypt in js_rsa.o
ld: symbol(s) not found for architecture arm64

But, if I use the provided OpenSSL.xcframework from this repo (master), everything works fine. Only the version built by Carthage that fails.

So what I'm missing here?

krzyzanowskim commented 3 years ago

ld: symbol(s) not found for architecture arm64

is the framework embedded in the app, and is carthage building it alright for the architecture?