Bug 216843 - devel/hs-ncurses: fails to build with gcc5 or later
Summary: devel/hs-ncurses: fails to build with gcc5 or later
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Tobias C. Berner
URL:
Keywords:
Depends on:
Blocks: 216707
  Show dependency treegraph
 
Reported: 2017-02-06 11:02 UTC by Jan Beich
Modified: 2017-03-18 22:38 UTC (History)
3 users (show)

See Also:
gerald: maintainer-feedback+


Attachments
Pass -std=c99 while building hs-ncurses (3.79 KB, patch)
2017-02-13 14:46 UTC, Tobias C. Berner
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-02-06 11:02:33 UTC
Building ncurses-0.2.15...
Preprocessing library ncurses-0.2.15...
c2hs: C header contains errors:

/usr/include/runetype.h:92: (column 22) [ERROR]  >>> Syntax error !
  The symbol `const' does not fit here.

http://package23.nyi.freebsd.org/data/103amd64-default-PR216707/2017-02-06_06h16m04s/logs/errors/hs-ncurses-0.2.15.log
http://package22.nyi.freebsd.org/data/103i386-default-PR216707/2017-02-06_06h16m01s/logs/errors/hs-ncurses-0.2.15.log
Comment 1 Gerald Pfeifer freebsd_committer 2017-02-06 13:08:49 UTC
The is one of three (or four?) ports that currently blocks the update
of lang/gcc from GCC 4.9 to GCC 5, so adjusting this to "Affects Many
People".  It would be lovely could you help with this.
Comment 2 Gleb Popov freebsd_committer 2017-02-10 12:41:34 UTC
This is upstream problem - the Haskell package language-c that implements C parser doesn't support C11 stuff: https://github.com/visq/language-c/issues/4

So, there is nothing we can do about this, except using gcc49 for this port. This is also questionable, btw, because we either use gcc49 for all Haskell stuff, or just hack c2hs to use gcc49 for preprocessing. But latter may also cause subtle incompatibilies between compiler used for compilation and for preprocessing.
Comment 3 Jan Beich freebsd_committer 2017-02-10 12:55:12 UTC
Why not pass -std=gnu89 instead? I just don't know Haskell to create a patch.
Comment 4 Gleb Popov freebsd_committer 2017-02-10 14:27:21 UTC
(In reply to Jan Beich (mail not working) from comment #3)

We can patch c2hs so that it always pass -atd=gnu89 to preprocessor. But that would make all Haskell code that interfaces with C using c2hs to parse headers in C89, while they were compiled in C11. This could lead, in theory, to various inconsistencies. If you are OK with this, I can fiddle with c2hs port and make a patch.
Comment 5 Jan Beich freebsd_committer 2017-02-10 14:48:04 UTC
(In reply to arrowd from comment #4)
> would make all Haskell code that interfaces with C using c2hs to parse headers
> in C89, while they were compiled in C11.

Our C ABI is supposed to be compatible but I'm not sure about Haskell interfaces. Let's keep it safe by building the rest of of haskell@ ports in C89 mode. For one, Clang defaults to C11 only since 3.6.
Comment 6 Jan Beich freebsd_committer 2017-02-10 14:53:02 UTC
Looking at PCLANG in lang/ghc it's pinned to 3.5 which defaults to C99 while BCLANG may not have been tested with recent (at the time) 3.6 update on 11.0-CURRENT.
Comment 7 Gleb Popov freebsd_committer 2017-02-10 18:13:10 UTC
(In reply to Jan Beich (mail not working) from comment #6)

Moreover, I've tried building hs-ncurses with clang34 and it also failed with the same error. To be safe we need to switch all Haskell ports to lang/gcc49 instead of lang/gcc. This would also leave things as they are for Haskell users.
Comment 8 Jan Beich freebsd_committer 2017-02-10 18:39:16 UTC
Don't rely on obsolete lang/gcc* availability. The ports are not maintained upstream and exist only as a deathbed for unmaintained consumers. gerald@ tries to decrease their diversity i.e., there's no point in keeping lang/gcc49 just for haskell@ ports if they build with lang/gcc48 as well.

Not to mention altering USE_GCC value is the last resort. devel/hs-ncurses has few consumers, so marking BROKEN is another option.
Comment 9 Gerald Pfeifer freebsd_committer 2017-02-11 09:27:56 UTC
(In reply to Jan Beich (mail not working) from comment #8)
> Don't rely on obsolete lang/gcc* availability. The ports are not maintained
> upstream and exist only as a deathbed for unmaintained consumers. gerald@
> tries to decrease their diversity i.e., there's no point in keeping
> lang/gcc49 just for haskell@ ports if they build with lang/gcc48 as well.

Usually we try to go for the latest version that works (among others
since that has a higher chance of supporting newer hardware and possibly
getting a backport).  But, agreed, USE_GCC=X.Y is a stop gap and should
be avoided.
Comment 10 Tobias C. Berner freebsd_committer 2017-02-13 14:46:04 UTC
Created attachment 179949 [details]
Pass -std=c99 while building hs-ncurses

Hi

Attached is a patch which updates the involved hs-ports to the newest release:
devel/hs-c2hs 0.26.1 -> 0.28.1
devel/hs-language-c 0.4.7 -> 0.5.0
devel/hs-ncurses 0.2.15 -> 0.2.16

Further it injects '-std=c99' to hs-ncurses cabal file.
[Maybe this should be added to c2hs or language-c to be the default always...]

This makes devel/hs-ncurses build fine on my FreeBSD-current with gcc default version being 6.



mfg Tobias
Comment 11 Tobias C. Berner freebsd_committer 2017-02-13 15:27:12 UTC
Also builds fine against gcc4.9.
Comment 12 Gerald Pfeifer freebsd_committer 2017-03-18 11:15:19 UTC
Thank you for the patch, Tobias!

Can you please apply this (maintainer timeout and such)?
Comment 13 Gerald Pfeifer freebsd_committer 2017-03-18 12:12:25 UTC
Antoine Brodin <antoine@FreeBSD.org> just confirmed this in PR 216707:

   PR 216843 can be committed with maintainer timeout.

Are you going to do so, Tobias (since it's your patchset), or do you
prefer me to do so?
Comment 14 commit-hook freebsd_committer 2017-03-18 22:37:55 UTC
A commit references this bug:

Author: tcberner
Date: Sat Mar 18 22:37:46 UTC 2017
New revision: 436451
URL: https://svnweb.freebsd.org/changeset/ports/436451

Log:
  Force compilation of of devel/hs-ncurses in c99 mode, to allow devel/gcc to be updated

  * hs-ncurses failed, as it does not understand c11 features, which is the default
    in modern compilers. By passing cpp-options: -std=c99 via its cabal file, this
    can be surpressed.
  * While here, also update the affected ports

  PR:		216843
  Approved by:	maintainer timeout (4weeks), rakuco (mentor)

Changes:
  head/devel/hs-c2hs/Makefile
  head/devel/hs-c2hs/distinfo
  head/devel/hs-language-c/Makefile
  head/devel/hs-language-c/distinfo
  head/devel/hs-ncurses/Makefile
  head/devel/hs-ncurses/distinfo
  head/devel/hs-ncurses/files/
  head/devel/hs-ncurses/files/patch-ncurses.cabal