How to Build OpenSSL, zlib, and cURL Libraries on Linux

Photo by FLY:D on Unsplash
  • Build OpenSSL Libraries
  • Build zlib libraries
  • Build cURL Libraries
  • Use the Libraries with Refinitiv Real-Time SDK C/C++

Prerequisites

To follow the steps in this article, you need to have a Linux machine, such as Centos 7 with the following packages installed.

  1. wget: A utility for retrieving files using the HTTP or FTP protocols
  2. perl-core: Base perl meta-package (Required to build OpenSSL)
  3. make: A GNU tool that simplifies the build process for users
  4. gcc: GNU Compiler Collection
yum install wget.x86_64 perl-core make gcc

Build OpenSSL libraries

OpenSSL is a software library implementing the SSL and TLS protocols for applications that secure communications over computer networks. It is widely used by Internet servers, including the majority of HTTPS websites. It contains two libraries which are libssl and libcrypto. The libcrypto library provides the fundamental cryptographic routines used by libssl.

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz
tar -xzvf openssl-1.1.1n.tar.gz
cd openssl-1.1.1n
./config --prefix=/opt/openssl --openssldir=/usr/local/ssl
make
make test
make install

Build zlib Libraries

Zlib is a free and general-purpose lossless data-compression software library for use on any computer hardware and software platform, including Linux, macOS, and iOS. The zlib data format is itself portable across platforms. The following steps demonstrate how to build zlib libraries from the zlib source package on a Linux machine (Centos 7).

cd /usr/local/src
wget https://zlib.net/zlib-1.2.12.tar.gz
tar -xvzf zlib-1.2.12.tar.gz
cd zlib-1.2.12
./configure --prefix=/opt/zlib
./configure --help
make
make install

Build cURL Library

cURL is a computer software project providing a library (libcurl) and a command-line tool (curl) for transferring data using various network protocols. It builds and works identically on many platforms. cURL supports HTTPS and performs SSL certificate verification by default when a secure protocol is specified such as HTTPS. It relies on the OpenSSL libraries to perform SSL certificate verification.

cd /usr/local/src
wget https://curl.se/download/curl-7.83.0.tar.gz
tar -xzvf curl-7.83.0.tar.gz
cd curl-7.83.0
./configure --prefix /opt/curl --with-openssl=/opt/openssl --with-zlib=/opt/zlib
./configure --help
make
make install

Use the Libraries with Refinitiv Real-Time SDK C/C++

The zlib, OpenSSL, and cURL can be used with the Refinitiv Real-Time SDK C/C++ applications to connect to encrypted servers or Refinitiv Real-Time Optimized on the cloud.

  • /opt/zlib/lib/libz.so.1.2.12
  • /opt/openssl/lib/libssl.so.1.1
  • /opt/openssl/lib/libcrypto.so.1.1
  • /opt/curl/lib/libcurl.so.4.8.0
  • libz.so => libz.so.1.2.12
  • libcurl.so => libcurl.so.4.8.0
ln -s libz.so.1.2.12 libz.so.1
ln -s libcurl.so.4.8.0 libcurl.so
export LD_LIBRARY_PATH=/opt/refinitiv/Real-Time-SDK/Cpp-C/Ema/Executables/OL7_64_GCC485/Optimized
cp /etc/pki/tls/cert.pem /usr/local/ssl
ln -s /etc/pki/tls/cert.pem /usr/local/ssl/cert.pem

Summary

OpenSSL, zlib, and cURL are open-source and popular software projects used to secure communications over computer networks, compress data, and transfer data through various network protocols. Users can easily install these packages by using the package management tool. However, the installed packages may be outdated.

References

  1. cURL. n.d. cURL. [online] Available at: <https://curl.se/> [Accessed 3 May 2022].
  2. En.wikipedia.org. n.d. cURL — Wikipedia. [online] Available at: <https://en.wikipedia.org/wiki/CURL> [Accessed 3 May 2022].
  3. OpenSSL. n.d. OpenSSL. [online] Available at: <https://www.openssl.org/> [Accessed 3 May 2022].
  4. En.wikipedia.org. n.d. OpenSSL — Wikipedia. [online] Available at: <https://en.wikipedia.org/wiki/OpenSSL> [Accessed 3 May 2022].
  5. Developers.refinitiv.com. n.d. Refinitiv Real-Time C++ SDK | Refinitiv Developers. [online] Available at: <https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-cc> [Accessed 3 May 2022].
  6. En.wikipedia.org. n.d. zlib — Wikipedia. [online] Available at: <https://en.wikipedia.org/wiki/Zlib> [Accessed 11 May 2022].
  7. Zlib.net. n.d. zlib Home Site. [online] Available at: <https://zlib.net/> [Accessed 11 May 2022].

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store