From aa92f9dff0d565228e920a4b793eceff13651b61 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 29 Oct 2015 01:06:36 -0400 Subject: [PATCH 1/5] rgw: link against system openssl (instead of dlopen at runtime) Signed-off-by: Sage Weil --- ceph.spec.in | 1 + debian/control | 1 + src/Makefile-env.am | 1 + src/rgw/Makefile.am | 5 +++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ceph.spec.in b/ceph.spec.in index 406c4f5ddd8..d385074f78a 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -139,6 +139,7 @@ BuildRequires: libblkid-devel >= 2.17 BuildRequires: libudev-devel BuildRequires: libtool BuildRequires: make +BuildRequires: openssl-devel BuildRequires: parted BuildRequires: perl BuildRequires: pkgconfig diff --git a/debian/control b/debian/control index 3e6751117ea..c30d5766f8b 100644 --- a/debian/control +++ b/debian/control @@ -41,6 +41,7 @@ Build-Depends: autoconf, libleveldb-dev, libnss3-dev, libsnappy-dev, + libssl-dev, liblttng-ust-dev, libtool, libudev-dev, diff --git a/src/Makefile-env.am b/src/Makefile-env.am index a347537eb81..3a80f2c2aaf 100644 --- a/src/Makefile-env.am +++ b/src/Makefile-env.am @@ -291,6 +291,7 @@ CEPH_GLOBAL = $(LIBGLOBAL) $(LIBCOMMON) $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXT LIBCOMMON_DEPS = LIBRADOS_DEPS = LIBRGW_DEPS = +LIBCIVETWEB_DEPS = # This is used by the dencoder test DENCODER_SOURCES = diff --git a/src/rgw/Makefile.am b/src/rgw/Makefile.am index 9eefc1abbb4..40705a373c4 100644 --- a/src/rgw/Makefile.am +++ b/src/rgw/Makefile.am @@ -129,7 +129,8 @@ libcivetweb_la_SOURCES = \ libcivetweb_la_CXXFLAGS = ${CIVETWEB_INCLUDE} -fPIC -Woverloaded-virtual \ ${AM_CXXFLAGS} -libcivetweb_la_CFLAGS = -I$(srcdir)/civetweb/include ${CIVETWEB_INCLUDE} -fPIC +libcivetweb_la_CFLAGS = -I$(srcdir)/civetweb/include ${CIVETWEB_INCLUDE} -fPIC -DNO_SSL_DL +LIBCIVETWEB_DEPS += -lssl noinst_LTLIBRARIES += libcivetweb.la @@ -143,7 +144,7 @@ radosgw_SOURCES = \ rgw/rgw_main.cc radosgw_CFLAGS = -I$(srcdir)/civetweb/include -fPIC -I$(srcdir)/xxHash -radosgw_LDADD = $(LIBRGW) $(LIBCIVETWEB) $(LIBRGW_DEPS) $(RESOLV_LIBS) \ +radosgw_LDADD = $(LIBRGW) $(LIBCIVETWEB) $(LIBCIVETWEB_DEPS) $(LIBRGW_DEPS) $(RESOLV_LIBS) \ $(CEPH_GLOBAL) bin_PROGRAMS += radosgw From b451cbb368100f10b734061ad957fbafd4780991 Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Wed, 10 Feb 2016 19:14:06 -0500 Subject: [PATCH 2/5] Use ld.so to link in ssl crypto (cmake changes). Using dlopen() to load in ssl crypto makes me cringe. Also it requires either installing the devel package, or appending library versioning to the library name civetweb tries to load, which is ugly. This is only a license problem for people whose system distribution does not include openssl. Signed-off-by: Marcus Watts --- src/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2cedec6c003..2172b510863 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1195,6 +1195,11 @@ if(${WITH_RADOSGW}) rgw/rgw_xml_enc.cc ) + set(civetweb_common_files civetweb/src/civetweb.c) + add_library(civetweb_common_objs OBJECT ${civetweb_common_files}) + set_property(TARGET civetweb_common_objs + APPEND PROPERTY COMPILE_DEFINITIONS NO_SSL_DL=1) + add_library(rgw_a STATIC ${rgw_a_srcs}) target_include_directories(rgw_a PUBLIC "${CMAKE_SOURCE_DIR}/src/civetweb/include") target_link_libraries(rgw_a librados cls_rgw_client cls_refcount_client @@ -1211,7 +1216,6 @@ if(${WITH_RADOSGW}) rgw/rgw_civetweb.cc rgw/rgw_civetweb_frontend.cc rgw/rgw_civetweb_log.cc - civetweb/src/civetweb.c rgw/rgw_main.cc) set(radosgw_admin_srcs @@ -1251,12 +1255,13 @@ if(${WITH_RADOSGW}) include/rados/rgw_file.h DESTINATION include/rados) - add_executable(radosgw ${radosgw_srcs} $) + add_executable(radosgw ${radosgw_srcs} $ + $) target_link_libraries(radosgw rgw_a librados cls_rgw_client cls_lock_client cls_refcount_client cls_log_client cls_statelog_client cls_timeindex_client cls_version_client cls_replica_log_client cls_user_client - curl expat global fcgi resolv ${BLKID_LIBRARIES} ${ALLOC_LIBS}) + curl expat global fcgi resolv ssl crypto ${BLKID_LIBRARIES} ${ALLOC_LIBS}) install(TARGETS radosgw DESTINATION bin) add_executable(radosgw-admin ${radosgw_admin_srcs} $) @@ -1264,7 +1269,7 @@ if(${WITH_RADOSGW}) cls_rgw_client cls_lock_client cls_refcount_client cls_log_client cls_statelog_client cls_timeindex_client cls_version_client cls_replica_log_client cls_user_client - curl expat global fcgi resolv ${BLKID_LIBRARIES} ${ALLOC_LIBS}) + curl expat global fcgi resolv ssl crypto ${BLKID_LIBRARIES} ${ALLOC_LIBS}) install(TARGETS radosgw-admin DESTINATION bin) From f3925ec5efefa94cea7d79010c5611835fe888e9 Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Sat, 20 Feb 2016 03:29:27 -0500 Subject: [PATCH 3/5] Fix ssl link error. When linking against -lssl, should also include -lcrypto. // fixup merge with previous Signed-off-by: Marcus Watts --- src/rgw/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rgw/Makefile.am b/src/rgw/Makefile.am index 40705a373c4..beb6ab25b41 100644 --- a/src/rgw/Makefile.am +++ b/src/rgw/Makefile.am @@ -130,7 +130,7 @@ libcivetweb_la_SOURCES = \ libcivetweb_la_CXXFLAGS = ${CIVETWEB_INCLUDE} -fPIC -Woverloaded-virtual \ ${AM_CXXFLAGS} libcivetweb_la_CFLAGS = -I$(srcdir)/civetweb/include ${CIVETWEB_INCLUDE} -fPIC -DNO_SSL_DL -LIBCIVETWEB_DEPS += -lssl +LIBCIVETWEB_DEPS += -lssl -lcrypto noinst_LTLIBRARIES += libcivetweb.la From aaa0f6fa7798879160fb8685aef88d53ea8c7435 Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Tue, 23 Feb 2016 18:35:21 -0500 Subject: [PATCH 4/5] Use fixed version of civetweb to avoid warning. The warning about SSLv23_client_method is because when using dynamic linking, this should always be non-zero. That's inside of civetweb, so this commit is to pull the submodule up to the fix. Signed-off-by: Marcus Watts --- src/civetweb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/civetweb b/src/civetweb index 8d271315a54..554fa96229b 160000 --- a/src/civetweb +++ b/src/civetweb @@ -1 +1 @@ -Subproject commit 8d271315a541218caada366f84a2690fdbd474a2 +Subproject commit 554fa96229bcb2de08c9e9d976a3153d324126b3 From 86718592c0c5595446d2d5b3baf95e30c972160f Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Sat, 27 Feb 2016 02:34:14 -0500 Subject: [PATCH 5/5] cmake fix: build civetweb with the right include path. In an earlier commit, civetweb.c got moved into a separate cmake 'object' library civetweb_common_objs so that it could be built just once for use with several different targets. At the time, there was a separate global "include_directory" to give the right include path for including "civetweb.h". A later commit in master created an rgw_a library, and restricted civetweb.h's include path for only building rgw_a objects. So, as the product of these these two commits, the target_include_directories command for the civetweb include path now needs to be applied to civetweb_common_objs and not rgw_a. Signed-off-by: Marcus Watts --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2172b510863..e0eebf17aec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1197,11 +1197,12 @@ if(${WITH_RADOSGW}) set(civetweb_common_files civetweb/src/civetweb.c) add_library(civetweb_common_objs OBJECT ${civetweb_common_files}) + target_include_directories(civetweb_common_objs PUBLIC + "${CMAKE_SOURCE_DIR}/src/civetweb/include") set_property(TARGET civetweb_common_objs APPEND PROPERTY COMPILE_DEFINITIONS NO_SSL_DL=1) add_library(rgw_a STATIC ${rgw_a_srcs}) - target_include_directories(rgw_a PUBLIC "${CMAKE_SOURCE_DIR}/src/civetweb/include") target_link_libraries(rgw_a librados cls_rgw_client cls_refcount_client cls_log_client cls_statelog_client cls_timeindex_client cls_version_client cls_replica_log_client cls_user_client curl global expat)