c2hs
c2hs copied to clipboard
Failure with GCC 7
I was trying to build gnuidn-0.2.2 against GCC 7.1.1 and failed with a failure of c2hs:
Preprocessing library gnuidn-0.2.2...
c2hs: C header contains errors:
/usr/lib/gcc/i686-pc-linux-gnu/7.1.1/include/stddef.h:435: (column 3) [ERROR] >>> Syntax error !
The symbol `__float128' does not fit here.
I have tried to build it against GCC 6.3.1 and the error is gone. It seems a problem of c2hs with GCC 7.
Are you using c2hs-0.28.2
? If not please upgrade. You can verify with c2hs --version
.
Yes it is c2hs-0.28.2
Similar issues were also reported at https://bugzilla.redhat.com/show_bug.cgi?id=1427000 and https://github.com/gtk2hs/gtk2hs/issues/200.
/usr/lib/gcc/i686-pc-linux-gnu/7.1.1/include/stddef.h:435:
#ifdef __i386__
__float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128))));
#endif
The type __float128
exposed in i686 build is unsupported by language-c
used by c2hs.
https://github.com/visq/language-c/blob/master/README#L36
I have sent a pull request https://github.com/visq/language-c/pull/33 to add __float128
with which the issue should be addressed.
Offtopic 肥猫大法好 感谢肥猫辛勤劳作
I'm using gcc 7.2.0 and getting an error that also mentions 128-bit floating point:
c2hs: C header contains errors:
/usr/include/stdlib.h:133: (column 18) [ERROR] >>> Syntax error !
The symbol `strtof128' does not fit here.
Pull request #193 updates to language-c-0.7, which has @MaskRay's pull request, but it doesn't seem to solve my problem. @felixonmars: Does it solve yours?
I think the error I saw is a result of _Float128
being unrecognized by language-c
when it tries to process a line like this from stdlib.h
:
extern _Float128 strtof128 (const char *__restrict __nptr, char **__restrict __endptr) ...
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Floating-Types.html#Floating-Types
So, it's a problem with language-c
, and needs to be fixed there. When it finally gets fixed there, c2hs
will still need to update to a version of language-c
that has the fix.
The __float128
change to language-c
is upstreamed https://github.com/visq/language-c/pull/33
But it still fails with _Float128
. https://github.com/visq/language-c/issues/39
I have submitted a small fix, https://github.com/visq/language-c/pull/41
I tested it with the 0.7.0 compatibility improvements made by @deech and my test cases started working without having to define _Float128
for c2hs.
I think this is now fixed in https://github.com/haskell/c2hs/issues/192#issuecomment-346962050. Please try and let me know and I'll close.
Still fails on it https://github.com/haskell/c2hs/issues/198