c2hs
c2hs copied to clipboard
GCC-7.0 specific _Float128 type - cannot recognize
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
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 :(
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.
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
Thanks @qrilka . This worked for me: stack install alsa-mixer --with-gcc /usr/bin/gcc-7
Was this fixed? Seems not reproducible anymore.
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.