I’m trying to develop an iOS swift voip application and I chose PJSIP to work with. I have it working but I need to compile the library with TLS/OpenSSL support because I cannot register an account in my SIP server and I’m suspecting this could be the problem.
The steps I followed are:
- I clone the pjsip project and I configure the config_site.h with this values:
#define PJ_CONFIG_IPHONE 1
#include <pj/config_site_sample.h>
-
I download the openssl library and I compile it with these commands:
export CROSS_TOP=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/ export CROSS_SDK=iPhoneOS17.5.sdk export CC="/Applications/XCode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64" ./Configure iphoneos-cross --prefix=/Users/bantona/openssl/ make make install
-
I prepare the PJSIP compilation running these commands:
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
# arm64 simulator
ARCH="-arch arm64" CFLAGS="-O2 -m64" LDFLAGS="-O2 -m64" MIN_IOS="-mios-simulator-version-min=13.0" ./configure-iphone --with-ssl=/Users/bantona/openssl
The expected outcome of this command (according to the PJSIP lib installation guide) is something like:
...
checking for OpenSSL installations..
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... no
aconfigure: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!
aconfigure: WARNING: openssl/ssl.h: proceeding with the compiler's result
checking for openssl/ssl.h... yes
checking for ERR_load_BIO_strings in -lcrypto... yes
checking for SSL_library_init in -lssl... yes
OpenSSL library found, SSL support enabled
...
but I’m getting:
...
Using SSL prefix... /Users/bantona/openssl
checking for OpenSSL installations..
checking for openssl/ssl.h... yes
checking for ERR_load_BIO_strings in -lcrypto... no
checking for ERR_get_error in -lcrypto... no
checking for SSL_CTX_new in -lssl... no
** OpenSSL libraries not found **
...
I’m working with a M2 Macbook Pro.
I’ve been trying more approaches (brew installation, config_site.h with #define PJ_HAS_SSL_SOCK 1 and many more) but nothing ends up working.
Any help would be appreciated and let me know if any of you need more specific information.
Cheers,
Borja.