Search code examples
iosobjective-ciphonexcode

'openssl/rsa.h' file not found


I am using ccavenue as the payment gateway. I am getting "'openssl/rsa.h' file not found" this error while running the application.

Is there any way to add openssl via cocoapods or avoid this issue.

Thanks in advance.


Solution

  • If you have come across this sha.h not found error on a Mac/ios development, it is because Apple dropped support for openssl.(I faced this error in my macOs-mojave version)

    refer to this link : https://www.anintegratedworld.com/mac-osx-fatal-error-opensslsha-h-file-not-found/

    You can follow the steps below as a workaround for this issue:

    1. brew install openssl
    • This will install a folder called openssl into your /usr/local/Cellar folder (where all your other brew downloads reside).
    1. cd /usr/local/include
    • The trick though is to go into your usr/local/includes folder and create a symlink (aka folder shortcut in the windows world) to your Cellar folder.
    1. ln -s ../opt/openssl/include/openssl
    • ln is used to create a link and -s means it is symbolic. Next we are saying what is the destination and the . (dot) indicates to create the link in the current directory.

    Now when you compile the code, the warning should disappear because your compiler will search in this directory (one of many standard directories) and find the header file sha.h via the shortcut link.

    You should probably run a few other commands as best practise:

    1. brew doctor

    2. brew update

    3. brew upgrade

    This will resolve issue.

    Note : I faced this particular issue (openssl/rsa.h file not found) when i was trying to install 'RSclient' package in my R environment.