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
Created attachment 210706 [details] compilatin testcase boiled down snippet from openvnc's buffer.c
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).
Created attachment 210708 [details, diff] fix compilation with switched on -maltivec
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.
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.
(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?
(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?
I am cc'ing our gcc-porting team. Can you advise whether this is a GCC bug or whether the code is invalid?
imo, current code is broken. use stdbool.h.
Patch added in cvs in version bump 2.1.0
Re-open because patch doesn't work see bug #297854
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=""
Add filter out -maltivec for ppc patch. Re-open the bug if it is also required on ppc64
Hello, Can you please try master, should fix this issue, ebuikd at bug#409577. Thanks!