All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] czmq: unbreak static linking
@ 2015-05-12 18:43 Peter Korsgaard
  2015-05-12 19:00 ` Thomas Petazzoni
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2015-05-12 18:43 UTC (permalink / raw)
  To: buildroot

commit: http://git.buildroot.net/buildroot/commit/?id=aa5254f1a2bc0ea3181d51990c18681b3071b9db
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Fixes:
http://autobuild.buildroot.net/results/faf/faf0bb00fccb1350afaef55f6cf14c11a5f5dc3c/
http://autobuild.buildroot.net/results/8d2/8d279baa4c8bffbb01f897119092c7b736942df4/
http://autobuild.buildroot.net/results/4d3/4d3dea604da9a5a1e7fe20548813f8de474ae33f/
http://autobuild.buildroot.net/results/fd6/fd602617839817352763e51754553960b7f795ac/

And many more.

Zeromq uses C++, but czmq forgets to explicitly link with libstdc++
(or use g++ to link), breaking static linking.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/czmq/czmq.mk |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/package/czmq/czmq.mk b/package/czmq/czmq.mk
index d25bf01..789e700 100644
--- a/package/czmq/czmq.mk
+++ b/package/czmq/czmq.mk
@@ -18,6 +18,12 @@ CZMQ_LICENSE_FILES = LICENSE
 # host-python, so disable asciidoc entirely.
 CZMQ_CONF_ENV = ac_cv_prog_czmq_have_asciidoc=no
 
+# zeromq uses C++, but czmq forgets to explicitly link with libstdc++
+# (or use g++ to link), breaking static linking.
+ifeq ($(BR2_STATIC_LIBS),y)
+CZMQ_CONF_ENV += LIBS='-lstdc++'
+endif
+
 define CZMQ_CREATE_CONFIG_DIR
 	mkdir -p $(@D)/config
 endef

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-12 18:43 [Buildroot] [git commit] czmq: unbreak static linking Peter Korsgaard
@ 2015-05-12 19:00 ` Thomas Petazzoni
  2015-05-12 19:30   ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2015-05-12 19:00 UTC (permalink / raw)
  To: buildroot

Dear Peter Korsgaard,

On Tue, 12 May 2015 20:43:12 +0200, Peter Korsgaard wrote:
> commit: http://git.buildroot.net/buildroot/commit/?id=aa5254f1a2bc0ea3181d51990c18681b3071b9db
> branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master
> 
> Fixes:
> http://autobuild.buildroot.net/results/faf/faf0bb00fccb1350afaef55f6cf14c11a5f5dc3c/
> http://autobuild.buildroot.net/results/8d2/8d279baa4c8bffbb01f897119092c7b736942df4/
> http://autobuild.buildroot.net/results/4d3/4d3dea604da9a5a1e7fe20548813f8de474ae33f/
> http://autobuild.buildroot.net/results/fd6/fd602617839817352763e51754553960b7f795ac/
> 
> And many more.
> 
> Zeromq uses C++, but czmq forgets to explicitly link with libstdc++
> (or use g++ to link), breaking static linking.
> 
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
>  package/czmq/czmq.mk |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/package/czmq/czmq.mk b/package/czmq/czmq.mk
> index d25bf01..789e700 100644
> --- a/package/czmq/czmq.mk
> +++ b/package/czmq/czmq.mk
> @@ -18,6 +18,12 @@ CZMQ_LICENSE_FILES = LICENSE
>  # host-python, so disable asciidoc entirely.
>  CZMQ_CONF_ENV = ac_cv_prog_czmq_have_asciidoc=no
>  
> +# zeromq uses C++, but czmq forgets to explicitly link with libstdc++
> +# (or use g++ to link), breaking static linking.
> +ifeq ($(BR2_STATIC_LIBS),y)
> +CZMQ_CONF_ENV += LIBS='-lstdc++'
> +endif

I continue to remain unhappy with such changes. There are two options
here:

 * Either using gcc to link with a C++ library is incorrect, and czmq
   should be fixed to use g++.

 * Or using gcc to link with a C++ library is correct, and in this
   case, libzmq.pc should be fixed to include -lstdc++ in Libs.private.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-12 19:00 ` Thomas Petazzoni
@ 2015-05-12 19:30   ` Peter Korsgaard
  2015-05-12 20:34     ` Thomas Petazzoni
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2015-05-12 19:30 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 > I continue to remain unhappy with such changes. There are two options
 > here:

I agree that it would be better if we could get this kind of fixes
upstream. I don't know how receptive upstream will be as this doesn't
affect "normal people" though.

 >  * Either using gcc to link with a C++ library is incorrect, and czmq
 >    should be fixed to use g++.

That is arguable correct, but things are a bit more complicated as:

- libzerozmq is written in C++ and uses libstdc++ but exposes a C api
- czmq is a higher level wrapper also written in C
- Test program (czmq_selftest) is a C program linking against libczmq
  (and in term libzeromq)

 >  * Or using gcc to link with a C++ library is correct, and in this
 >    case, libzmq.pc should be fixed to include -lstdc++ in Libs.private.

While this is correct, it is not directly related to this. Czmq doesn't
use its own .pc file to know how to link the selftest program.

Alternatively we can simply mark czmq !BR2_STATIC_LIBS.

-- 
Venlig hilsen,
Peter Korsgaard 

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-12 19:30   ` Peter Korsgaard
@ 2015-05-12 20:34     ` Thomas Petazzoni
  2015-05-12 22:02       ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2015-05-12 20:34 UTC (permalink / raw)
  To: buildroot

Dear Peter Korsgaard,

On Tue, 12 May 2015 21:30:31 +0200, Peter Korsgaard wrote:

>  > I continue to remain unhappy with such changes. There are two options
>  > here:
> 
> I agree that it would be better if we could get this kind of fixes
> upstream. I don't know how receptive upstream will be as this doesn't
> affect "normal people" though.

Well, upstream zeromq should be able to accept patches making their .pc
file more correct.

>  >  * Either using gcc to link with a C++ library is incorrect, and czmq
>  >    should be fixed to use g++.
> 
> That is arguable correct, but things are a bit more complicated as:
> 
> - libzerozmq is written in C++ and uses libstdc++ but exposes a C api
> - czmq is a higher level wrapper also written in C
> - Test program (czmq_selftest) is a C program linking against libczmq
>   (and in term libzeromq)

Right, but that still doesn't answer whether using gcc to link a
C program against a C++ library is correct or not :-)

>  >  * Or using gcc to link with a C++ library is correct, and in this
>  >    case, libzmq.pc should be fixed to include -lstdc++ in Libs.private.
> 
> While this is correct, it is not directly related to this. Czmq doesn't
> use its own .pc file to know how to link the selftest program.

I'm not talking about fixing the czmq .pc file, but the zeromq one. If
zeromq uses C++, then its .pc file should have -lstdc++, no?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-12 20:34     ` Thomas Petazzoni
@ 2015-05-12 22:02       ` Peter Korsgaard
  2015-05-13  5:44         ` Lionel Orry
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2015-05-12 22:02 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

>> I agree that it would be better if we could get this kind of fixes
 >> upstream. I don't know how receptive upstream will be as this doesn't
 >> affect "normal people" though.

 > Well, upstream zeromq should be able to accept patches making their .pc
 > file more correct.

True.

 >> That is arguable correct, but things are a bit more complicated as:
 >> 
 >> - libzerozmq is written in C++ and uses libstdc++ but exposes a C api
 >> - czmq is a higher level wrapper also written in C
 >> - Test program (czmq_selftest) is a C program linking against libczmq
 >> (and in term libzeromq)

 > Right, but that still doesn't answer whether using gcc to link a
 > C program against a C++ library is correct or not :-)

I believe it is. How are people using E.G. libczmq to know that they
need to link with g++ just because a library libczmq uses happens to use
C++?


 >> >  * Or using gcc to link with a C++ library is correct, and in this
 >> >    case, libzmq.pc should be fixed to include -lstdc++ in Libs.private.
 >> 
 >> While this is correct, it is not directly related to this. Czmq doesn't
 >> use its own .pc file to know how to link the selftest program.

 > I'm not talking about fixing the czmq .pc file, but the zeromq one. If
 > zeromq uses C++, then its .pc file should have -lstdc++, no?

Ahh, now I get it. Yes, fixing libzmq.pc to have a Libs.privat: -lstdc++
should also work.

I'll give it a try.

czmq seems to be missing a dependency on host-pkgconf though.

-- 
Venlig hilsen,
Peter Korsgaard 

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-12 22:02       ` Peter Korsgaard
@ 2015-05-13  5:44         ` Lionel Orry
  2015-05-13  7:19           ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Lionel Orry @ 2015-05-13  5:44 UTC (permalink / raw)
  To: buildroot

Hi,

On Wed, May 13, 2015 at 12:02 AM, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:
>
> Hi,
>
>>> I agree that it would be better if we could get this kind of fixes
>  >> upstream. I don't know how receptive upstream will be as this doesn't
>  >> affect "normal people" though.
>
>  > Well, upstream zeromq should be able to accept patches making their .pc
>  > file more correct.
>
> True.
>
>  >> That is arguable correct, but things are a bit more complicated as:
>  >>
>  >> - libzerozmq is written in C++ and uses libstdc++ but exposes a C api
>  >> - czmq is a higher level wrapper also written in C
>  >> - Test program (czmq_selftest) is a C program linking against libczmq
>  >> (and in term libzeromq)
>
>  > Right, but that still doesn't answer whether using gcc to link a
>  > C program against a C++ library is correct or not :-)
>
> I believe it is. How are people using E.G. libczmq to know that they
> need to link with g++ just because a library libczmq uses happens to use
> C++?
>
>
>  >> >  * Or using gcc to link with a C++ library is correct, and in this
>  >> >    case, libzmq.pc should be fixed to include -lstdc++ in Libs.private.
>  >>
>  >> While this is correct, it is not directly related to this. Czmq doesn't
>  >> use its own .pc file to know how to link the selftest program.
>
>  > I'm not talking about fixing the czmq .pc file, but the zeromq one. If
>  > zeromq uses C++, then its .pc file should have -lstdc++, no?
>
> Ahh, now I get it. Yes, fixing libzmq.pc to have a Libs.privat: -lstdc++
> should also work.
>
> I'll give it a try.

I agree, the libzmq.pc needs to be fixed. It is not specific to czmq
but to all software components which statically link against libzmq
but are not necessarily written in C++.
I have this issue on other projects and I manually add '-lstdc++'.

>
> czmq seems to be missing a dependency on host-pkgconf though.
>
> --
> Venlig hilsen,
> Peter Korsgaard
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Regards,
Lionel

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-13  5:44         ` Lionel Orry
@ 2015-05-13  7:19           ` Peter Korsgaard
  2015-05-13  7:23             ` Thomas Petazzoni
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2015-05-13  7:19 UTC (permalink / raw)
  To: buildroot

>>>>> "Lionel" == Lionel Orry <lionel.orry@gmail.com> writes:

Hi,

 >> Ahh, now I get it. Yes, fixing libzmq.pc to have a Libs.privat: -lstdc++
 >> should also work.
 >> 
 >> I'll give it a try.

 > I agree, the libzmq.pc needs to be fixed. It is not specific to czmq
 > but to all software components which statically link against libzmq
 > but are not necessarily written in C++.
 > I have this issue on other projects and I manually add '-lstdc++'.

Ok, good.

I've sent a patch doing that upstream as it has now been accepted:

https://github.com/zeromq/libzmq/pull/1398

And I've added it to buildroot as well.

-- 
Venlig hilsen,
Peter Korsgaard 

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-13  7:19           ` Peter Korsgaard
@ 2015-05-13  7:23             ` Thomas Petazzoni
  2015-05-13  7:57               ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2015-05-13  7:23 UTC (permalink / raw)
  To: buildroot

Dear Peter Korsgaard,

On Wed, 13 May 2015 09:19:21 +0200, Peter Korsgaard wrote:

> Ok, good.
> 
> I've sent a patch doing that upstream as it has now been accepted:
> 
> https://github.com/zeromq/libzmq/pull/1398
> 
> And I've added it to buildroot as well.

Thanks a lot for doing this, it seems like a much better solution to me.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [git commit] czmq: unbreak static linking
  2015-05-13  7:23             ` Thomas Petazzoni
@ 2015-05-13  7:57               ` Peter Korsgaard
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2015-05-13  7:57 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Dear Peter Korsgaard,
 > On Wed, 13 May 2015 09:19:21 +0200, Peter Korsgaard wrote:

 >> Ok, good.
 >> 
 >> I've sent a patch doing that upstream as it has now been accepted:
 >> 
 >> https://github.com/zeromq/libzmq/pull/1398
 >> 
 >> And I've added it to buildroot as well.

 > Thanks a lot for doing this, it seems like a much better solution to me.

Yes, thanks for the heads up and help.

-- 
Venlig hilsen,
Peter Korsgaard 

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

end of thread, other threads:[~2015-05-13  7:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 18:43 [Buildroot] [git commit] czmq: unbreak static linking Peter Korsgaard
2015-05-12 19:00 ` Thomas Petazzoni
2015-05-12 19:30   ` Peter Korsgaard
2015-05-12 20:34     ` Thomas Petazzoni
2015-05-12 22:02       ` Peter Korsgaard
2015-05-13  5:44         ` Lionel Orry
2015-05-13  7:19           ` Peter Korsgaard
2015-05-13  7:23             ` Thomas Petazzoni
2015-05-13  7:57               ` Peter Korsgaard

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.