c2hs icon indicating copy to clipboard operation
c2hs copied to clipboard

GCC-7.0 specific _Float128 type - cannot recognize

Open XVilka opened this issue 7 years ago • 6 comments

When compiling alsa-mixer Haskell library met this problem:

Building alsa-mixer-0.2.0.3...
Preprocessing library alsa-mixer-0.2.0.3...
c2hs: C header contains errors:

/usr/include/bits/floatn.h:73: (column 29) [ERROR]  >>> Syntax error !
  The symbol `;' does not fit here.

Lines that cause it:

/* The remaining of this file provides support for older compilers.  */
#if __HAVE_FLOAT128

/* The type _Float128 exists only since GCC 7.0.  */
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
typedef __float128 _Float128;
# endif

Attaching full header here floatn.h.zip

Gentoo bug https://bugs.gentoo.org/644200

XVilka avatar Jan 13 '18 03:01 XVilka

You can build by just skipping the header --cppopts=-D_BITS_FLOATN_H. At least there's a workaround since 6+ months later c2hs is still broken :(

abarbu avatar Jan 25 '18 04:01 abarbu

This is the latest bug to show this error so I'm putting this here. (also mentioned in #192 and #191) I have pushed a commit with a potential fix in language_c. It could use some testing as I don't have as easy a way to replicate this as everyone else seems to.

Commit a7574997997752d98266d45c48ba21d801d8c77b at github/krakrjak/language-c is a straightforward diff, it builds here and needs some wider testing.

krakrjak avatar May 04 '18 07:05 krakrjak

I'm not sure why but switching to GCC 7 on Gentoo resolved this issue for me, like it's described in https://bugs.gentoo.org/644200

qrilka avatar Aug 25 '18 19:08 qrilka

Thanks @qrilka . This worked for me: stack install alsa-mixer --with-gcc /usr/bin/gcc-7

peterbecich avatar Feb 16 '19 18:02 peterbecich

Was this fixed? Seems not reproducible anymore.

XVilka avatar Nov 25 '19 17:11 XVilka

If you are using gcc-7 then this issue is 100% fixed. Potentially there is still an issue for pre-gcc-7 version (maybe), but we haven't seen reports of this issue when using gcc<7 in over a year.

krakrjak avatar Dec 17 '19 18:12 krakrjak