Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 293840 - net-misc/openvpn-2.1_rc21 fails to compile with gcc-4.4.2 when '-maltivec' is in CFLAGS
Summary: net-misc/openvpn-2.1_rc21 fails to compile with gcc-4.4.2 when '-maltivec' is...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: Cédric Krier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-20 12:42 UTC by Jan Scholz
Modified: 2012-04-28 05:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
compilatin testcase (buffer.c,604 bytes, text/plain)
2009-11-20 12:48 UTC, Jan Scholz
Details
fix compilation with switched on -maltivec (openvpn-2.1_gcc44_fix.patch,458 bytes, patch)
2009-11-20 12:56 UTC, Jan Scholz
Details | Diff
apply openvpn-2.1_gcc44_fix.patch (openvpn-2.1-rc21.ebuild_fix-compilation-with-maltivec.patch,1.26 KB, patch)
2009-11-20 13:10 UTC, Jan Scholz
Details | Diff
filter out -maltivec on ppc (openvpn-2.1.0-r1.ebuild,5.72 KB, text/plain)
2010-01-05 11:35 UTC, Jan Scholz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Scholz 2009-11-20 12:42:37 UTC
when emerging openvpn-2.1_rc21 (rc20 as well) compilation of buffer.c fails with the following message:
powerpc-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I.   -I.    -O2 -mcpu=G4 -maltivec -mabi=altivec -pipe -fPIC -fno-strict-aliasing -D_REENTRANT -pthread -MT buffer.o -MD -MP -MF .deps/buffer.Tpo -c -o buffer.o buffer.c
In file included from buffer.h:29,
                 from buffer.c:28:
thread.h:186: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'openvpn_thread_enabled'

If I remove -maltivec from CFLAGS by -mno-altivec compilation works fine.

However, using gcc-4.3.4 it compiles even with -maltivec

Reproducible: Always

Steps to Reproduce:
1. (on a ppc) put -maltivec in CFLAGS
2. select gcc version 4.4.2
3. emerge openvpn

Actual Results:  
Compilation fails in buffer.c:
powerpc-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I.   -I.    -O2 -mcpu=G4 -maltivec -mabi=altivec -pipe -fPIC -fno-strict-aliasing -D_REENTRANT -pthread -MT buffer.o -MD -MP -MF .deps/buffer.Tpo -c -o buffer.o buffer.c
In file included from buffer.h:29,
                 from buffer.c:28:
thread.h:186: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'openvpn_thread_enabled'


Expected Results:  
clean compilation
Comment 1 Jan Scholz 2009-11-20 12:48:17 UTC
Created attachment 210706 [details]
compilatin testcase

boiled down snippet from openvnc's buffer.c
Comment 2 Jan Scholz 2009-11-20 12:54:37 UTC
I reduced openvpn's buffer.c to the test case attached above
attachment (id=210706)

According to the gcc man page the altivec option defines bool__

> The `altivec' attribute allows one to declare AltiVec vector data
> types supported by the AltiVec Programming Interface Manual.  The
> attribute requires an argument to specify one of three vector types:
> `vector__', `pixel__' (always followed by unsigned short), and `bool__'
> (always followed by unsigned).

seems like the keyword 'bool' is defined as well. Strange enough, the same should happen in older gcc versions, but the compilation fails only with gcc-4.4 (though I only tested 4.4.2).
Comment 3 Jan Scholz 2009-11-20 12:56:55 UTC
Created attachment 210708 [details, diff]
fix compilation with switched on -maltivec
Comment 4 Jan Scholz 2009-11-20 13:10:01 UTC
Created attachment 210709 [details, diff]
apply openvpn-2.1_gcc44_fix.patch

[openvpn] fix compilation with -maltivec

Hand over the definition of 'bool' from openvpn's basic.h to
<stdbool.h>. This works form me, although I think to make it nicer, the
existence of stdbool.h should be checked, for example by the
AC_HEADER_STDBOOL macro.

Seems like this _is_ considered a gcc bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40017

For now, let's fix it here.
Comment 5 Cédric Krier gentoo-dev 2009-11-21 18:30:23 UTC
I don't know if it can not introduce side effect because in basic.h bool is defined as an int but in stdbool.h bool is defined as _Bool.
Comment 6 Robert Buchholz (RETIRED) gentoo-dev 2009-11-22 12:46:35 UTC
(In reply to comment #4)
> Seems like this _is_ considered a gcc bug:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40017

The apparent fix has been released with 4.4.1. Why are you experiencing this bug then? Are the two unrelated?

> For now, let's fix it here.

Have you proposed or discussed the patch upstream?

Comment 7 Jan Scholz 2009-11-23 12:49:58 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > Seems like this _is_ considered a gcc bug:
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40017
> 
> The apparent fix has been released with 4.4.1. Why are you experiencing this
> bug then? Are the two unrelated?
>

You're right, the fix should be in 4.4.2. So the issues are just related because both are connected with -maltivec and the 'bool' keyword.

> > For now, let's fix it here.
> 
> Have you proposed or discussed the patch upstream?

No, I haven't. Basically because I'm not sure whether it's a bug in openvpn or a regression in gcc. So what's your opinion on that?
Comment 8 Robert Buchholz (RETIRED) gentoo-dev 2009-11-23 13:23:54 UTC
I am cc'ing our gcc-porting team. Can you advise whether this is a GCC bug or whether the code is invalid?
Comment 9 SpanKY gentoo-dev 2009-11-23 16:37:02 UTC
imo, current code is broken.  use stdbool.h.
Comment 10 Cédric Krier gentoo-dev 2009-12-19 19:44:54 UTC
Patch added in cvs in version bump 2.1.0
Comment 11 Cédric Krier gentoo-dev 2009-12-29 18:14:28 UTC
Re-open because patch doesn't work see bug #297854
Comment 12 Jan Scholz 2010-01-05 11:35:55 UTC
Created attachment 215272 [details]
filter out -maltivec on ppc

To make openvpn-2.1.0 compile on ppc, filter out -maltivec.
How about ppc64? Do we need to filter altivec there as well?

Here's a diff to portages openvpn-2.1.0-r1.ebuild, the complete ebuild is attached.

--- a/gentoo/overlay/net-misc/openvpn/openvpn-2.1.0-r1.ebuild
+++ b/gentoo/overlay/net-misc/openvpn/openvpn-2.1.0-r1.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/openvpn-2.1.0-r1.ebuild,v 1.1 2009/12/29 18:13:05 cedk Exp $
 
-inherit eutils multilib toolchain-funcs autotools
+inherit eutils multilib toolchain-funcs autotools flag-o-matic
 
 IPV6_VERSION="0.4.10"
 DESCRIPTION="OpenVPN is a robust and highly flexible tunneling application compatible with many OSes."
@@ -56,6 +56,13 @@ src_unpack() {
 }
 
 src_compile() {
+       # basic.h defines a type 'bool' that conflicts with the altivec
+       # keyword bool which has to be fixed upstream, see bugs #293840
+       # and #297854.
+       # For now, filter out -maltivec on ppc and append -mno-altivec, as
+       # -maltivec is enabled implicitly by -mcpu and similar flags.
+       use ppc && filter-flags -maltivec && append-flags -mno-altivec
+
        local myconf=""
Comment 13 Cédric Krier gentoo-dev 2010-02-28 16:11:56 UTC
Add filter out -maltivec for ppc patch.
Re-open the bug if it is also required on ppc64
Comment 14 Alon Bar-Lev 2012-04-28 05:36:07 UTC
Hello,
Can you please try master, should fix this issue, ebuikd at bug#409577.
Thanks!