Skip to content

Commit

Permalink
Enable SSL of LibCurl linked to C++ library (apache#3024)
Browse files Browse the repository at this point in the history
* Enable SSL of LibCurl linked to C++ library

* Update openssl versions

* Update openssl to 1.1.0j
  • Loading branch information
massakam authored and merlimat committed Dec 13, 2018
1 parent ff927e8 commit 1048fdd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pulsar-client-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ set(COMMON_LIBS
${Boost_CHRONO_LIBRARY}
${Boost_DATE_TIME_LIBRARY}
${Boost_ATOMIC_LIBRARY}
${CURL_LIBRARY_PATH}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARY_PATH}
${PROTOBUF_LIBRARIES}
${CURL_LIBRARY_PATH}
${ADDITIONAL_LIBRARIES}
${LIB_JSON}
dl
Expand Down
28 changes: 18 additions & 10 deletions pulsar-client-cpp/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ ENV PATH="/opt/python/${PYTHON_SPEC}/bin:${PATH}"

RUN ln -s /opt/python/${PYTHON_SPEC}/include/python${PYTHON_VERSION}m /opt/python/${PYTHON_SPEC}/include/python${PYTHON_VERSION}

# Perl (required for building OpenSSL)
RUN curl -O -L https://www.cpan.org/src/5.0/perl-5.10.0.tar.gz && \
tar xvfz perl-5.10.0.tar.gz && \
cd perl-5.10.0 && \
./configure.gnu --prefix=/usr/local/ && \
make && make install && \
rm -rf /perl-5.10.0.tar.gz /perl-5.10.0

####################################
# These dependencies can be found in Ubuntu but they're not compiled with -fPIC,
# so they cannot be statically linked into a shared library
Expand All @@ -46,12 +54,12 @@ RUN curl -O -L https://zlib.net/zlib-1.2.11.tar.gz && \
rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11

# Compile OpenSSL
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_0_2l.tar.gz && \
tar xvfz OpenSSL_1_0_2l.tar.gz && \
cd openssl-OpenSSL_1_0_2l/ && \
./Configure -fPIC no-shared linux-x86_64 && \
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0j.tar.gz && \
tar xvfz OpenSSL_1_1_0j.tar.gz && \
cd openssl-OpenSSL_1_1_0j/ && \
./Configure -fPIC --prefix=/usr/local/ssl/ no-shared linux-x86_64 && \
make && make install && \
rm -rf /OpenSSL_1_0_2l.tar.gz /openssl-OpenSSL_1_0_2l
rm -rf /OpenSSL_1_1_0j.tar.gz /openssl-OpenSSL_1_1_0j

# Download and compile boost
RUN curl -O -L https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz && \
Expand Down Expand Up @@ -126,12 +134,12 @@ RUN curl -O -L https://github.com/open-source-parsers/jsoncpp/archive/1.8.0.tar
rm -rf /1.8.0.tar.gz /jsoncpp-1.8.0

# LibCurl
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_54_0/curl-7.54.0.tar.gz && \
tar xvfz curl-7.54.0.tar.gz && \
cd curl-7.54.0 && \
CFLAGS=-fPIC ./configure && \
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_58_0/curl-7.58.0.tar.gz && \
tar xvfz curl-7.58.0.tar.gz && \
cd curl-7.58.0 && \
CFLAGS=-fPIC ./configure --with-ssl=/usr/local/ssl/ && \
make && make install && \
rm -rf /curl-7.54.0.tar.gz /curl-7.54.0
rm -rf /curl-7.58.0.tar.gz /curl-7.58.0

RUN pip install twine

Expand Down
25 changes: 13 additions & 12 deletions pulsar-client-cpp/pkg/deb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

FROM debian:9

RUN apt-get update && \
RUN apt-get update -y && \
apt-get install -y curl g++ make python-dev \
libxml2-utils git

Expand Down Expand Up @@ -64,20 +64,21 @@ RUN curl -O -L https://github.com/madler/zlib/archive/v1.2.11.tar.gz && \
make && make install && \
rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11

RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0h.tar.gz && \
tar xvfz OpenSSL_1_1_0h.tar.gz && \
cd openssl-OpenSSL_1_1_0h/ && \
./Configure -fPIC no-shared linux-x86_64 && \
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0j.tar.gz && \
tar xvfz OpenSSL_1_1_0j.tar.gz && \
cd openssl-OpenSSL_1_1_0j/ && \
./Configure -fPIC --prefix=/usr/local/ssl/ no-shared linux-x86_64 && \
make && make install && \
rm -rf /OpenSSL_1_1_0h.tar.gz /openssl-OpenSSL_1_1_0h
rm -rf /OpenSSL_1_1_0j.tar.gz /openssl-OpenSSL_1_1_0j

# LibCurl
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_54_0/curl-7.54.0.tar.gz && \
tar xvfz curl-7.54.0.tar.gz && \
cd curl-7.54.0 && \
CFLAGS=-fPIC ./configure && \
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_58_0/curl-7.58.0.tar.gz && \
tar xvfz curl-7.58.0.tar.gz && \
cd curl-7.58.0 && \
CFLAGS=-fPIC ./configure --with-ssl=/usr/local/ssl/ && \
make && make install && \
rm -rf /curl-7.54.0.tar.gz /curl-7.54.0

rm -rf /curl-7.58.0.tar.gz /curl-7.58.0

RUN apt-get install -y dpkg-dev

ENV OPENSSL_ROOT_DIR /usr/local/ssl/
25 changes: 12 additions & 13 deletions pulsar-client-cpp/pkg/rpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

FROM centos:7

RUN yum update && \
RUN yum update -y && \
yum install -y gcc-c++ make cmake git rpm-build \
python-devel createrepo

Expand Down Expand Up @@ -64,20 +64,19 @@ RUN curl -O -L https://github.com/madler/zlib/archive/v1.2.11.tar.gz && \
make && make install && \
rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11

RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0h.tar.gz && \
tar xvfz OpenSSL_1_1_0h.tar.gz && \
cd openssl-OpenSSL_1_1_0h/ && \
./Configure -fPIC no-shared linux-x86_64 && \
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0j.tar.gz && \
tar xvfz OpenSSL_1_1_0j.tar.gz && \
cd openssl-OpenSSL_1_1_0j/ && \
./Configure -fPIC --prefix=/usr/local/ssl/ no-shared linux-x86_64 && \
make && make install && \
rm -rf /OpenSSL_1_1_0h.tar.gz /openssl-OpenSSL_1_1_0h
rm -rf /OpenSSL_1_1_0j.tar.gz /openssl-OpenSSL_1_1_0j

# LibCurl
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_54_0/curl-7.54.0.tar.gz && \
tar xvfz curl-7.54.0.tar.gz && \
cd curl-7.54.0 && \
CFLAGS=-fPIC ./configure && \
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_58_0/curl-7.58.0.tar.gz && \
tar xvfz curl-7.58.0.tar.gz && \
cd curl-7.58.0 && \
CFLAGS=-fPIC ./configure --with-ssl=/usr/local/ssl/ && \
make && make install && \
rm -rf /curl-7.54.0.tar.gz /curl-7.54.0


rm -rf /curl-7.58.0.tar.gz /curl-7.58.0

ENV OPENSSL_ROOT_DIR /usr/local/ssl/

0 comments on commit 1048fdd

Please sign in to comment.