c2hs icon indicating copy to clipboard operation
c2hs copied to clipboard

Syntax error! The symbol `__attribute__' does not fit here. for time.h on OSX

Open cblp opened this issue 4 years ago • 3 comments

glib> Configuring glib-0.13.8.0...
glib> build
glib> Preprocessing library for glib-0.13.8.0..
glib> setup: Error in C header file.
glib> 
glib> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/time.h:154: (column 17) [FATAL] 
glib>   >>> Syntax error!
glib>   The symbol `__attribute__' does not fit here.

Because of similar issues, I consider it a c2hs bug.

cblp avatar Jun 05 '20 12:06 cblp

Similar: https://gitlab.haskell.org/haskell/ghcup-hs/-/jobs/389030#L1196

Configuring libarchive-2.2.5.0...
Preprocessing library for libarchive-2.2.5.0..
c2hs: C header contains errors:
/usr/include/bits/alltypes.h:71: (column 18) [ERROR]  >>> Syntax error !
  The symbol `_Alignas' does not fit here.

hasufell avatar Jul 07 '20 20:07 hasufell

This is an issue with language-c not being able to parse those constructs. I've been getting around them with something like this in my .cabal file:

  if os(darwin)
    cc-options: -D_Alignas= -D__attribute__=

deech avatar Aug 13 '20 22:08 deech

This is an issue with language-c not being able to parse those constructs. I've been getting around them with something like this in my .cabal file:

  if os(darwin)
    cc-options: -D_Alignas= -D__attribute__=

Doesn't work here:

  • https://gitlab.haskell.org/haskell/ghcup-hs/-/jobs/771092#L1331
  • https://gitlab.haskell.org/haskell/ghcup-hs/-/commit/490207c6ac5d5aa2823483a6eba480d0ce2e459f#375f33130d9a0929983d444c20caa59f7929d709_30_21

hasufell avatar Aug 24 '21 18:08 hasufell