Skip to contentSkip to conversation

rabbitmq-c: openssl/popt sub-options don't work in stat_ic linking

PATCH New Thomas Petazzoni 2 participants 3 messages May 14, 2017 – May 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rabbitmq-c: openssl/popt sub-options don't work in stat_ic linking

rabbitmq-c currently fails to build in a number of static linking situations, due to two issues:

- CMake FindOpenSSL module is buggy. Even though it uses pkg-config, it doesn't use the information returned by pkg-config, and therefore doesn't know about second order libraries that need be part of the link for static linking to succeed. Due to this, -lz is not passed, and therefore rabbitmq-c fails when linking against libssl/libcrypto. This issue has been reported to upstream CMake at
https://gitlab.kitware.com/cmake/cmake/issues/16885.

- popt might use libintl, but CMake doesn't know about that. For autotools based packages, we typically work around this by passing LIBS=, but CMake apparently has no equivalent to LIBS=.

To workaround this, we only use the OpenSSL and Popt optional dependencies in dynamic linking situations.

Fixes:

http://autobuild.buildroot.net/results/798dbe5e5fd0463bb2066cb115656795144c327f/

---
 package/rabbitmq-c/rabbitmq-c.mk | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
package/rabbitmq-c/rabbitmq-c.mk +8 -2
index 1ca35ad..eef09ec 100644
@@ -21,14 +21,20 @@ else ifeq ($(BR2_SHARED_LIBS),y)
 RABBITMQ_C_CONF_OPTS += -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF
 endif
 
-ifeq ($(BR2_PACKAGE_OPENSSL),y)
+# CMake OpenSSL detection is buggy, and doesn't properly use
+# pkg-config, so it fails when statically linking. See
+# https://gitlab.kitware.com/cmake/cmake/issues/16885.
+ifeq ($(BR2_PACKAGE_OPENSSL):$(BR2_STATIC_LIBS),y:)
 RABBITMQ_C_CONF_OPTS += -DENABLE_SSL_SUPPORT=ON
 RABBITMQ_C_DEPENDENCIES += openssl
 else
 RABBITMQ_C_CONF_OPTS += -DENABLE_SSL_SUPPORT=OFF
 endif
 
-ifeq ($(BR2_PACKAGE_POPT), y)
+# Popt is sometimes linked against libintl, but CMake doesn't know
+# about that, and there's no way to tell manually CMake to link
+# against an additional library.
+ifeq ($(BR2_PACKAGE_POPT):$(BR2_STATIC_LIBS),y:)
 RABBITMQ_C_CONF_OPTS += -DBUILD_TOOLS=ON
 RABBITMQ_C_DEPENDENCIES += popt
 else
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 rabbitmq-c: openssl/popt sub-options don't work in stat_ic linking

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

rabbitmq-c currently fails to build in a number of static linking situations, due to two issues:

- CMake FindOpenSSL module is buggy. Even though it uses pkg-config, it doesn't use the information returned by pkg-config, and therefore doesn't know about second order libraries that need be part of the link for static linking to succeed. Due to this, -lz is not passed, and therefore rabbitmq-c fails when linking against libssl/libcrypto. This issue has been reported to upstream CMake at
https://gitlab.kitware.com/cmake/cmake/issues/16885.

Quoted 6 lines

- popt might use libintl, but CMake doesn't know about that. For autotools based packages, we typically work around this by passing LIBS=, but CMake apparently has no equivalent to LIBS=.

To workaround this, we only use the OpenSSL and Popt optional dependencies in dynamic linking situations.

I was hesitating if it wasn't better to just make rabbitmq-c depend on !static, but OK.

Committed after fixing subject, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 rabbitmq-c: openssl/popt sub-options don't work in stat_ic linking

In reply to Thomas Petazzoni
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

rabbitmq-c currently fails to build in a number of static linking situations, due to two issues:

- CMake FindOpenSSL module is buggy. Even though it uses pkg-config, it doesn't use the information returned by pkg-config, and therefore doesn't know about second order libraries that need be part of the link for static linking to succeed. Due to this, -lz is not passed, and therefore rabbitmq-c fails when linking against libssl/libcrypto. This issue has been reported to upstream CMake at
https://gitlab.kitware.com/cmake/cmake/issues/16885.

- popt might use libintl, but CMake doesn't know about that. For autotools based packages, we typically work around this by passing LIBS=, but CMake apparently has no equivalent to LIBS=.

Quoted 8 lines

To workaround this, we only use the OpenSSL and Popt optional dependencies in dynamic linking situations.

Fixes:

http://autobuild.buildroot.net/results/798dbe5e5fd0463bb2066cb115656795144c327f/

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard