haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
198 stars 50 forks source link

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

Open cblp opened 4 years ago

cblp commented 4 years ago
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.

hasufell commented 4 years ago

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.
deech commented 4 years ago

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__=
hasufell commented 3 years ago

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: