All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/cURL: fix static link whith openSSL
@ 2012-08-22 20:37 Yann E. MORIN
  2012-08-23  9:00 ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2012-08-22 20:37 UTC (permalink / raw)
  To: buildroot

When openSSL is selected, cURL is configured to use it.

But in this case, the libcurl.pc file /forgets/ to require link
against -ldl.

This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
but an executable wants to be linked statically (for various reasons
which are irrelevant here).

Fix that by conditionally append -ldl to the Libs.Private section of
the installed libcurl.pc if openSSL is enabled.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/libcurl/libcurl.mk |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
index 090bb4c..35c7f56 100644
--- a/package/libcurl/libcurl.mk
+++ b/package/libcurl/libcurl.mk
@@ -29,14 +29,20 @@ define LIBCURL_TARGET_CLEANUP
 	rm -rf $(TARGET_DIR)/usr/bin/curl-config \
 	       $(if $(BR2_PACKAGE_CURL),,$(TARGET_DIR)/usr/bin/curl)
 endef
-
+define LIBCURL_FIX_TARGET_PC
+	$(SED) '/^Libs.private:/s/[[:space:]]*$$/ -ldl/;' $(TARGET_DIR)/usr/lib/pkgconfig/libcurl.pc
+endef
 LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
+LIBCURL_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_TARGET_PC)
 
 define LIBCURL_STAGING_FIXUP_CURL_CONFIG
 	$(SED) "s,prefix=/usr,prefix=$(STAGING_DIR)/usr," $(STAGING_DIR)/usr/bin/curl-config
 endef
-
+define LIBCURL_FIX_STAGING_PC
+	$(SED) '/^Libs.private:/s/[[:space:]]*$$/ -ldl/;' $(STAGING_DIR)/usr/lib/pkgconfig/libcurl.pc
+endef
 LIBCURL_POST_INSTALL_STAGING_HOOKS += LIBCURL_STAGING_FIXUP_CURL_CONFIG
+LIBCURL_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_STAGING_PC)
 
 $(eval $(autotools-package))
 
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] package/cURL: fix static link whith openSSL
  2012-08-22 20:37 [Buildroot] [PATCH] package/cURL: fix static link whith openSSL Yann E. MORIN
@ 2012-08-23  9:00 ` Thomas Petazzoni
  2012-08-23 21:11   ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2012-08-23  9:00 UTC (permalink / raw)
  To: buildroot

Le Wed, 22 Aug 2012 22:37:03 +0200,
"Yann E. MORIN" <yann.morin.1998@free.fr> a ?crit :

> When openSSL is selected, cURL is configured to use it.
> 
> But in this case, the libcurl.pc file /forgets/ to require link
> against -ldl.
> 
> This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
> but an executable wants to be linked statically (for various reasons
> which are irrelevant here).
> 
> Fix that by conditionally append -ldl to the Libs.Private section of
> the installed libcurl.pc if openSSL is enabled.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Shouldn't this rather be fixed through a patch that gets submitted to
the upstream curl project?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] package/cURL: fix static link whith openSSL
  2012-08-23  9:00 ` Thomas Petazzoni
@ 2012-08-23 21:11   ` Yann E. MORIN
  2012-08-23 21:25     ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2012-08-23 21:11 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On Thursday 23 August 2012 11:00:34 Thomas Petazzoni wrote:
> Le Wed, 22 Aug 2012 22:37:03 +0200,
> "Yann E. MORIN" <yann.morin.1998@free.fr> a ?crit :
> 
> > When openSSL is selected, cURL is configured to use it.
> > 
> > But in this case, the libcurl.pc file /forgets/ to require link
> > against -ldl.
> > 
> > This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
> > but an executable wants to be linked statically (for various reasons
> > which are irrelevant here).
> > 
> > Fix that by conditionally append -ldl to the Libs.Private section of
> > the installed libcurl.pc if openSSL is enabled.
> > 
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Shouldn't this rather be fixed through a patch that gets submitted to
> the upstream curl project?

Probably, yes. There's even a comment in the libcurl.pc.in template, that
reads:
  # This should most probably benefit from getting a "Requires:" field added
  # dynamically by configure.

I've tried to find a simple way to do that, but I did not find so far. It is
too much involved IMHO.

I'll try to reproduce a small test-case, and submit a bug report upstream.
Of course, when I find a bit of time, I'll try to fix that and push a proper
fix... :-/

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] package/cURL: fix static link whith openSSL
  2012-08-23 21:11   ` Yann E. MORIN
@ 2012-08-23 21:25     ` Yann E. MORIN
  0 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2012-08-23 21:25 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On Thursday 23 August 2012 23:11:29 Yann E. MORIN wrote:
> On Thursday 23 August 2012 11:00:34 Thomas Petazzoni wrote:
> > Le Wed, 22 Aug 2012 22:37:03 +0200,
> > "Yann E. MORIN" <yann.morin.1998@free.fr> a ?crit :
> > 
> > > When openSSL is selected, cURL is configured to use it.
> > > 
> > > But in this case, the libcurl.pc file /forgets/ to require link
> > > against -ldl.
> > > 
> > > This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
> > > but an executable wants to be linked statically (for various reasons
> > > which are irrelevant here).
> > > 
> > > Fix that by conditionally append -ldl to the Libs.Private section of
> > > the installed libcurl.pc if openSSL is enabled.
> > > 
> > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > 
> > Shouldn't this rather be fixed through a patch that gets submitted to
> > the upstream curl project?
> 
> Probably, yes. There's even a comment in the libcurl.pc.in template, that
> reads:
>   # This should most probably benefit from getting a "Requires:" field added
>   # dynamically by configure.

OK, I've changed my mind: forget this patch of mine, I'll just redo it
by adding a proper 'Requires:' line, that's much cleaner.

Doint it properly in curl's source will take a bit more time, but I'll
eventually look at it (but not before Monday, I'm off for the WE, with
probably no access to a computer, much less to internet. Yeah! Roots!).

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] package/cURL: fix static link whith openSSL
@ 2012-09-05 22:01 Yann E. MORIN
  0 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2012-09-05 22:01 UTC (permalink / raw)
  To: buildroot

When openSSL is selected, cURL is configured to use it.

But in this case, the libcurl.pc file /forgets/ to require link
against -ldl.

This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
but an executable wants to be linked statically (for various reasons
which are irrelevant here).

Fix that by appending a 'Requires: openssl' line to the installed
libcurl.pc, if openSSL is enabled.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/libcurl/libcurl.mk |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
index 090bb4c..6441a80 100644
--- a/package/libcurl/libcurl.mk
+++ b/package/libcurl/libcurl.mk
@@ -29,14 +29,20 @@ define LIBCURL_TARGET_CLEANUP
 	rm -rf $(TARGET_DIR)/usr/bin/curl-config \
 	       $(if $(BR2_PACKAGE_CURL),,$(TARGET_DIR)/usr/bin/curl)
 endef
-
+define LIBCURL_FIX_TARGET_PC
+	printf 'Requires: openssl\n' >>$(TARGET_DIR)/usr/lib/pkgconfig/libcurl.pc
+endef
 LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
+LIBCURL_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_TARGET_PC)
 
 define LIBCURL_STAGING_FIXUP_CURL_CONFIG
 	$(SED) "s,prefix=/usr,prefix=$(STAGING_DIR)/usr," $(STAGING_DIR)/usr/bin/curl-config
 endef
-
+define LIBCURL_FIX_STAGING_PC
+	printf 'Requires: openssl\n' >>$(STAGING_DIR)/usr/lib/pkgconfig/libcurl.pc
+endef
 LIBCURL_POST_INSTALL_STAGING_HOOKS += LIBCURL_STAGING_FIXUP_CURL_CONFIG
+LIBCURL_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_STAGING_PC)
 
 $(eval $(autotools-package))
 
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-05 22:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-22 20:37 [Buildroot] [PATCH] package/cURL: fix static link whith openSSL Yann E. MORIN
2012-08-23  9:00 ` Thomas Petazzoni
2012-08-23 21:11   ` Yann E. MORIN
2012-08-23 21:25     ` Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2012-09-05 22:01 Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.