merlimat closed pull request #3024: Enable SSL of LibCurl linked to C++ library
URL: https://github.com/apache/pulsar/pull/3024
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index c29db9a6a6..ca4363446f 100644
--- a/pulsar-client-cpp/CMakeLists.txt
+++ b/pulsar-client-cpp/CMakeLists.txt
@@ -198,10 +198,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
diff --git a/pulsar-client-cpp/docker/Dockerfile 
b/pulsar-client-cpp/docker/Dockerfile
index 8e7167c46a..1df845909a 100644
--- a/pulsar-client-cpp/docker/Dockerfile
+++ b/pulsar-client-cpp/docker/Dockerfile
@@ -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
@@ -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 && \
@@ -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
 
diff --git a/pulsar-client-cpp/pkg/deb/Dockerfile 
b/pulsar-client-cpp/pkg/deb/Dockerfile
index 7740728d90..117cbde221 100644
--- a/pulsar-client-cpp/pkg/deb/Dockerfile
+++ b/pulsar-client-cpp/pkg/deb/Dockerfile
@@ -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
 
@@ -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/
diff --git a/pulsar-client-cpp/pkg/rpm/Dockerfile 
b/pulsar-client-cpp/pkg/rpm/Dockerfile
index 2ff1288040..05cf898b2b 100644
--- a/pulsar-client-cpp/pkg/rpm/Dockerfile
+++ b/pulsar-client-cpp/pkg/rpm/Dockerfile
@@ -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
 
@@ -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/


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to