diff mbox series

package/zeromq: fix build failure due to binutils bug 21464

Message ID 20210317154520.1613272-1-giulio.benetti@benettiengineering.com
State Rejected
Headers show
Series package/zeromq: fix build failure due to binutils bug 21464 | expand

Commit Message

Giulio Benetti March 17, 2021, 3:45 p.m. UTC
The zeromq package exhibits binutils bug 21464 when built for the Nios2
architecture with optimization enabled, which causes a build failure.

As done for other packages in Buildroot work around this gcc bug by
setting optimization to -O0 if BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464=y.

Fixes:
http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 package/zeromq/zeromq.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Giulio Benetti March 17, 2021, 3:49 p.m. UTC | #1
Hi Thomas,

On 3/17/21 4:45 PM, Giulio Benetti wrote:
> The zeromq package exhibits binutils bug 21464 when built for the Nios2
> architecture with optimization enabled, which causes a build failure.
> 
> As done for other packages in Buildroot work around this gcc bug by
> setting optimization to -O0 if BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464=y.
> 
> Fixes:
> http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>   package/zeromq/zeromq.mk | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/package/zeromq/zeromq.mk b/package/zeromq/zeromq.mk
> index 182699403c..135b07b6c6 100644
> --- a/package/zeromq/zeromq.mk
> +++ b/package/zeromq/zeromq.mk
> @@ -23,12 +23,20 @@ ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \
>   	libzmq_cv_tcp_keepidle=yes \
>   	libzmq_cv_tcp_keepintvl=yes
>   
> +ZEROMQ_CXXFLAGS = $(TARGET_CXXFLAGS)
> +
>   # Internal error, aborting at dwarf2cfi.c:2752 in connect_traces
>   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
>   ifeq ($(BR2_m68k_cf),y)
> -ZEROMQ_CONF_OPTS += CXXFLAGS="$(TARGET_CXXFLAGS) -fno-defer-pop"
> +ZEROMQ_CXXFLAGS += -fno-defer-pop
> +endif
> +
> +ifeq ($(BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464),y)
> +ZEROMQ_CXXFLAGS += -O0
>   endif
>   
> +ZEROMQ_CONF_OPTS += CXXFLAGS="$(ZEROMQ_CXXFLAGS)"
> +
>   # Only tools/curve_keygen.c needs this, but it doesn't hurt to pass it
>   # for the rest of the build as well (which automatically includes stdc++).
>   ifeq ($(BR2_STATIC_LIBS),y)
> 

this patch works around binutils bug 21464 for this package.
The other packages affected by binutils bug 21464 seem affected by 
another bug instead and at the moment can't be worked around, I'll try 
to find a possible work around.
Giulio Benetti March 22, 2021, 1:15 p.m. UTC | #2
Hi Thomas,

On 3/17/21 4:49 PM, Giulio Benetti wrote:
> Hi Thomas,
> 
> On 3/17/21 4:45 PM, Giulio Benetti wrote:
>> The zeromq package exhibits binutils bug 21464 when built for the Nios2
>> architecture with optimization enabled, which causes a build failure.
>>
>> As done for other packages in Buildroot work around this gcc bug by
>> setting optimization to -O0 if BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464=y.
>>
>> Fixes:
>> http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559
>>
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>>    package/zeromq/zeromq.mk | 10 +++++++++-
>>    1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/package/zeromq/zeromq.mk b/package/zeromq/zeromq.mk
>> index 182699403c..135b07b6c6 100644
>> --- a/package/zeromq/zeromq.mk
>> +++ b/package/zeromq/zeromq.mk
>> @@ -23,12 +23,20 @@ ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \
>>    	libzmq_cv_tcp_keepidle=yes \
>>    	libzmq_cv_tcp_keepintvl=yes
>>    
>> +ZEROMQ_CXXFLAGS = $(TARGET_CXXFLAGS)
>> +
>>    # Internal error, aborting at dwarf2cfi.c:2752 in connect_traces
>>    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
>>    ifeq ($(BR2_m68k_cf),y)
>> -ZEROMQ_CONF_OPTS += CXXFLAGS="$(TARGET_CXXFLAGS) -fno-defer-pop"
>> +ZEROMQ_CXXFLAGS += -fno-defer-pop
>> +endif
>> +
>> +ifeq ($(BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464),y)
>> +ZEROMQ_CXXFLAGS += -O0
>>    endif
>>    
>> +ZEROMQ_CONF_OPTS += CXXFLAGS="$(ZEROMQ_CXXFLAGS)"
>> +
>>    # Only tools/curve_keygen.c needs this, but it doesn't hurt to pass it
>>    # for the rest of the build as well (which automatically includes stdc++).
>>    ifeq ($(BR2_STATIC_LIBS),y)
>>
> 
> this patch works around binutils bug 21464 for this package.
> The other packages affected by binutils bug 21464 seem affected by
> another bug instead and at the moment can't be worked around, I'll try
> to find a possible work around.
> 

OpenRisc binutils 21464 bug has a fix:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

I've tested it with binutils:
- 2.32
- 2.34
- 2.35.2
- 2.36.1

and works good while building:
- protobuf
- libtheora
- zeromq

zeromq is the only package that could be worked around with -O0.

I would add patches that add patches to all binutils versions, so this 
way buildroot toolchain built by buildroot are safe, but I should tag
as buggy all the external openrisc toolchains, basically the one 
provided by Bootlin. This implies adding patches to disable building 
libtheora with all its dependencies and I can do it, or otherwise we can 
wait for Bootlin to release a new fixed openrisc toolchain, what about that?

Also, zeromq is worked around using -O0 by this:
https://patchwork.ozlabs.org/project/buildroot/patch/20210317154520.1613272-1-giulio.benetti@benettiengineering.com/

protobuf has already been disabled by this:
https://git.buildroot.net/buildroot/commit/?id=9e71b6e2cb28a66e116019bf8808fb48cef1d7b9

libtheora needs a new patch taking care of dependencies.

In the meanwhile I've provided patch with the fix for binutils:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322131437.392225-1-giulio.benetti@benettiengineering.com/

Best regards
Thomas Petazzoni March 22, 2021, 1:42 p.m. UTC | #3
On Mon, 22 Mar 2021 14:15:08 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> OpenRisc binutils 21464 bug has a fix:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21464
> 
> I've tested it with binutils:
> - 2.32
> - 2.34
> - 2.35.2
> - 2.36.1
> 
> and works good while building:
> - protobuf
> - libtheora
> - zeromq

Excellent! Thanks for all this work!

Has this fix been suggested by upstream? How do you know it's the
"right" fix ?

> zeromq is the only package that could be worked around with -O0.
> 
> I would add patches that add patches to all binutils versions, so this 
> way buildroot toolchain built by buildroot are safe, but I should tag
> as buggy all the external openrisc toolchains, basically the one 
> provided by Bootlin. This implies adding patches to disable building 
> libtheora with all its dependencies and I can do it, or otherwise we can 
> wait for Bootlin to release a new fixed openrisc toolchain, what about that?

Don't bother with the external Bootlin toolchains, I was working on a
new release of the toolchains based on 2021.02, so I'll include the
binutils fix.

Thanks!

Thomas
Giulio Benetti March 22, 2021, 3:57 p.m. UTC | #4
On 3/22/21 2:42 PM, Thomas Petazzoni wrote:
> On Mon, 22 Mar 2021 14:15:08 +0100
> Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> 
>> OpenRisc binutils 21464 bug has a fix:
>> https://sourceware.org/bugzilla/show_bug.cgi?id=21464
>>
>> I've tested it with binutils:
>> - 2.32
>> - 2.34
>> - 2.35.2
>> - 2.36.1
>>
>> and works good while building:
>> - protobuf
>> - libtheora
>> - zeromq
> Excellent! Thanks for all this work!
> 
> Has this fix been suggested by upstream? How do you know it's the
> "right" fix ?

Yes it's been suggested by Stafford here:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

>> zeromq is the only package that could be worked around with -O0.
>>
>> I would add patches that add patches to all binutils versions, so this
>> way buildroot toolchain built by buildroot are safe, but I should tag
>> as buggy all the external openrisc toolchains, basically the one
>> provided by Bootlin. This implies adding patches to disable building
>> libtheora with all its dependencies and I can do it, or otherwise we can
>> wait for Bootlin to release a new fixed openrisc toolchain, what about that?
> 
> Don't bother with the external Bootlin toolchains, I was working on a
> new release of the toolchains based on 2021.02, so I'll include the
> binutils fix.

Ok, so it fixes this bug for Buildroot toolchain and you'll provide 
Bootlin toolchain and we can consider this bug as not affecting
Buildroot anymore. The chance one would use an external OpenRisc 
toolchain would be very rare. Right?

Then we could revert commit:
"package/protobuf: disable package if binutils is affected from bug 21464"
https://git.buildroot.net/buildroot/commit/?id=9e71b6e2cb

While doing all these tests I've gound that libgeos still has this bug 
and most of all, the diff proposed doesn't fix bug 21464, they are 2 
different bugs, so I've updated that here:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

And submitted the other bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=27624

So bug 21464 is still there and my binutils patches need do be re-worded.

And please drop my pending patch:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322131437.392225-1-giulio.benetti@benettiengineering.com/

I've submitted a reworded one:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322155655.547476-1-giulio.benetti@benettiengineering.com/

Best regards
Thomas Petazzoni March 22, 2021, 4:03 p.m. UTC | #5
On Mon, 22 Mar 2021 16:57:23 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> > Has this fix been suggested by upstream? How do you know it's the
> > "right" fix ?  
> 
> Yes it's been suggested by Stafford here:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Ah, OK!

> > Don't bother with the external Bootlin toolchains, I was working on a
> > new release of the toolchains based on 2021.02, so I'll include the
> > binutils fix.  
> 
> Ok, so it fixes this bug for Buildroot toolchain and you'll provide 
> Bootlin toolchain and we can consider this bug as not affecting
> Buildroot anymore. The chance one would use an external OpenRisc 
> toolchain would be very rare. Right?

Yes, that's the idea.

> So bug 21464 is still there and my binutils patches need do be re-worded.
> 
> And please drop my pending patch:
> https://patchwork.ozlabs.org/project/buildroot/patch/20210322131437.392225-1-giulio.benetti@benettiengineering.com/
> 
> I've submitted a reworded one:
> https://patchwork.ozlabs.org/project/buildroot/patch/20210322155655.547476-1-giulio.benetti@benettiengineering.com/

OK, thanks!

Thomas
diff mbox series

Patch

diff --git a/package/zeromq/zeromq.mk b/package/zeromq/zeromq.mk
index 182699403c..135b07b6c6 100644
--- a/package/zeromq/zeromq.mk
+++ b/package/zeromq/zeromq.mk
@@ -23,12 +23,20 @@  ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \
 	libzmq_cv_tcp_keepidle=yes \
 	libzmq_cv_tcp_keepintvl=yes
 
+ZEROMQ_CXXFLAGS = $(TARGET_CXXFLAGS)
+
 # Internal error, aborting at dwarf2cfi.c:2752 in connect_traces
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
 ifeq ($(BR2_m68k_cf),y)
-ZEROMQ_CONF_OPTS += CXXFLAGS="$(TARGET_CXXFLAGS) -fno-defer-pop"
+ZEROMQ_CXXFLAGS += -fno-defer-pop
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464),y)
+ZEROMQ_CXXFLAGS += -O0
 endif
 
+ZEROMQ_CONF_OPTS += CXXFLAGS="$(ZEROMQ_CXXFLAGS)"
+
 # Only tools/curve_keygen.c needs this, but it doesn't hurt to pass it
 # for the rest of the build as well (which automatically includes stdc++).
 ifeq ($(BR2_STATIC_LIBS),y)