krzyzanowskim / OpenSSL

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

Error "unknown type name 'BN_ULONG'" while building project on simulator #72

Closed VNKorchagin closed 5 years ago

VNKorchagin commented 5 years ago

When i try to build project in XCode (Version 10.2.1) on simulator i get the error:

In file included from [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/pkcs7.h:62: In file included from [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/asn1.h:74: [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:314:5: error: unknown type name 'BN_ULONG' BN_ULONG d; / Pointer to an array of 'BN_BITS2' bit ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:330:5: error: unknown type name 'BN_ULONG' BN_ULONG n0[2]; / least significant word(s) of Ni; (type ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:487:22: error: a parameter list without types is only allowed in a function definition int BN_num_bits_word(BN_ULONG); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:535:1: error: unknown type name 'BN_ULONG' BN_ULONG BN_mod_word(const BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:535:39: error: unknown type name 'BN_ULONG' BN_ULONG BN_mod_word(const BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:536:1: error: unknown type name 'BN_ULONG' BN_ULONG BN_div_word(BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:536:33: error: unknown type name 'BN_ULONG' BN_ULONG BN_div_word(BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:537:28: error: unknown type name 'BN_ULONG' int BN_mul_word(BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:538:28: error: unknown type name 'BN_ULONG' int BN_add_word(BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:539:28: error: unknown type name 'BN_ULONG' int BN_sub_word(BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:540:28: error: unknown type name 'BN_ULONG' int BN_set_word(BIGNUM a, BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:541:1: error: unknown type name 'BN_ULONG' BN_ULONG BN_get_word(const BIGNUM a); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:557:37: error: unknown type name 'BN_ULONG' int BN_mod_exp_mont_word(BIGNUM r, BN_ULONG a, const BIGNUM p, ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:596:24: error: unknown type name 'BN_ULONG' void BN_consttime_swap(BN_ULONG swap, BIGNUM a, BIGNUM b, int nwords); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:914:1: error: unknown type name 'BN_ULONG' BN_ULONG bn_mul_add_words(BN_ULONG rp, const BN_ULONG ap, int num, ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:914:27: error: unknown type name 'BN_ULONG' BN_ULONG bn_mul_add_words(BN_ULONG rp, const BN_ULONG ap, int num, ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:914:47: error: unknown type name 'BN_ULONG' BN_ULONG bn_mul_add_words(BN_ULONG rp, const BN_ULONG ap, int num, ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:915:27: error: unknown type name 'BN_ULONG' BN_ULONG w); ^ [path to project]Pods/Headers/Public/OpenSSL-Universal/openssl/bn.h:916:1: error: unknown type name 'BN_ULONG' BN_ULONG bn_mul_words(BN_ULONG rp, const BN_ULONG ap, int num, BN_ULONG w); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.

The project is compile successfully on a real device. I suspect that needs to make changes to "Build Settings". How I can fix this error?

VNKorchagin commented 5 years ago

I make this changes

Screenshot 2019-07-29 at 12 19 11 Screenshot 2019-07-29 at 12 18 55

but it's doesn't work

krzyzanowskim commented 5 years ago

you shouldn't need to change anything. Cocoapods should do all the changes. Maybe something with Pods integration is not right in the project?

VNKorchagin commented 5 years ago

I tried:

pod deintegrate
pod clean
pod install

But that didn't fix the problem. I can't understand why the project is successfully building on a real device, but not building on the simulator.

What do these mistakes mean? If I understand correctly: my project does not see the constant BN_ULONG

krzyzanowskim commented 5 years ago

It can't find the path to headers, this is managed by Pods scheme config. Are you sure you didn't override this setting somewhere? Are you able to reproduce the issue with the just created new project?

VNKorchagin commented 5 years ago

I can't reproduce this error on new project. I will do additional research to identify the causes of the error.

tiagomnh commented 5 years ago

Have you found a solution @VNKorchagin?

I'm having the same issue but only when building for the simulator of 32-bit devices. For 64-bit it builds successfully.

VNKorchagin commented 5 years ago

Have you found a solution?

No, I did not find any solution to this problem. I suspect that I need to make some changes to the project settings, but I don’t know which ones. If I need to run the app on the simulator, then I just change pod for OpenSSL (as a temporary solution).

ilammy commented 5 years ago

Just chiming in. The issue seems to be actual for Carthage projects as well. Build fails with the same errors when compiling code using OpenSSL, but the OpenSSL project itself seems to build successfully.

OrfeasZ commented 5 years ago

I encountered this problem as well. It looks like this project doesn't include a configuration for the 32-bit version of the simulator. I've forked it and added support for the 32-bit iOS simulator in this repo (and also updated to OpenSSL 1.0.2t). You can use directly with CocoaPods like this:

pod 'OpenSSL-Universal', :git => 'https://github.com/OrfeasZ/OpenSSL.git'

If you want to build it yourself, simply clone it, ensure you have XCode and Carthage installed (regardless of whether you're planning on using it or not), and run build.sh in the main project directory.

@krzyzanowskim I can send a PR your way if this is something you're interested in merging into this repo.

dalia89 commented 3 years ago

rename Podfile.Lock --> pod 'OpenSSL-Universal', '~>1.0.2.20' paste this in Podfile --> open terminal --> cd ios --> pod install

adityasingh773 commented 2 years ago

For me, the issue was related to older Cocoapods version, updating my cocoapods fixed it sudo gem install cocoapods