How to solve this error 'BIO_new' is deprecated in cocoa?
You solve this issue by not using Apple's version of OpenSSL located in /usr/include
and /usr/lib
. Its an old version - 0.9.8 - so its missing a number of features. Its loss will not be missed.
Instead, you should download, build and install the latest version of OpenSSL. You can download it from OpenSSL: Source, Tarballs.
Configure with the following (there's a more comprehensive list of options on the OpenSSL wiki at Configure Options).
$ export KERNEL_BITS=64
$ ./config no-ssl2 enable-ec_nistp_64_gcc_128 --openssldir=/usr/local
$ make all
$ sudo make install
--openssldir=/usr/local
means /usr/local/ssl
will be the base directory for the installation.
Later, when you compile and link, you perform the following:
- Add
/usr/local/ssl/include
ans a header search path (i.e., a -I
option)
- Add
/usr/local/ssl/lib
ans a library search path (i.e., a -L
option)
If you use -L
, then be sure to use DYLD_LIBRARY_PATH
when executing your program. Its like LD_PRELOAD
on Linux. If you don't use DYLD_LIBRARY_PATH
, then dyld
will load the old, 0.9.8 version of OpenSSL located in /usr/lib
; and not your updated, 1.0.1 version of OpenSSL located in /usr/local/ssl/lib/
.
Better, omit -L
and specify the full library paths.
/usr/local/ssl/lib/libssl.a
/usr/local/ssl/lib/libcrypto.a
This way you don't need to worry about -L
and DYLD_LIBRARY_PATH
. Things just work as expected.