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

Lexical error ! The character '#' does not fit here #268

Closed romanofski closed 2 years ago

romanofski commented 3 years ago

I've run into this problem while packaging https://github.com/purebred-mua/hs-notmuch for Fedora 34 and beyond. The build failed with:

+ LANG=C.utf8
+ ./Setup build
Preprocessing library for notmuch-0.3.0.0..
c2hs: C header contains errors:
dist/build/Notmuch/Binding.i:1: (column 1) [ERROR]  >>> Lexical error !
  The character '#' does not fit here.
error: Bad exit status from /var/tmp/rpm-tmp.HyB7BW (%build)
    Bad exit status from /var/tmp/rpm-tmp.HyB7BW (%build)

A preliminary search showed, that it might be LANG related, however setting it to C doesn't change the error we're running into. I'm attaching the generated Binding.i.txt. It doesn't look odd to me, however I'm new to it all so I don't spot what is wrong with it if it's something obvious to the experienced.

Logs for the working Fedora 33 build: Dependencies, Build log, other logs

Logs for the failing Fedora 34 build: Dependencies, Build log, other logs

The logs for the c2hs build are accessible here: https://copr.fedorainfracloud.org/coprs/romanofski/purebred/build/2091487/ in case that matters.

juhp commented 3 years ago

This is due to changes in gcc11, see gtk2hs/gtk2hs#304

(Downstream report: https://bugzilla.redhat.com/show_bug.cgi?id=1957233)

vmchale commented 3 years ago

This will be fixed when the bounds on language-c are bumped, no?

why-not-try-calmer commented 3 years ago

I am hitting the same issue when trying to stack build a project using the cpython package.

deech commented 3 years ago

The language-c upper bounds have been bumped ( https://github.com/haskell/c2hs/commit/5912527eca481ca542a973c358436b0883be2aad ) . Does this still happen on master?

lebensterben commented 3 years ago

@deech I just build c2hs on from master branch and can confirm that it solved my problem. Please consider to release this ASAP as this is breaking lots of packages.

podiki commented 3 years ago

Also having issues with stack build for projects that need c2hs. I've used latest commit from here and still getting same error on building e.g. taffybar, though I'm not entirely sure the latest git version of c2hs is being used (should be...). A quick bump in version/release with this fix would help.

juhp commented 3 years ago

deech kindly just released 0.28.8

romanofski commented 2 years ago

I think this can be closed.