Bug 197924 - x11-toolkits/hs-gtk : fails to build with gcc5-built ghc
Summary: x11-toolkits/hs-gtk : fails to build with gcc5-built ghc
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-haskell (Nobody)
Depends on:
Reported: 2015-02-22 16:17 UTC by John Marino
Modified: 2015-03-30 10:44 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (haskell)

hs-gtk build log (28.94 KB, text/plain)
2015-02-22 16:17 UTC, John Marino
no flags Details
fix cpp for hs-gtk (1.09 KB, patch)
2015-03-22 16:15 UTC, John Marino
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Marino freebsd_committer 2015-02-22 16:17:58 UTC
Created attachment 153319 [details]
hs-gtk build log

GHC builds with gcc5 and most hs- ports build just fine.  There is at least one exception, and that is hs-gtk.

I don't have a fix, but I thought I would report it and upload the load so that the issue is known.
Comment 1 Bugzilla Automation freebsd_committer 2015-02-22 16:17:58 UTC
Auto-assigned to maintainer haskell@FreeBSD.org
Comment 2 Gabor Pali freebsd_committer 2015-02-22 20:12:03 UTC
Thank you for reporting the problem.  This looks like an upstream issue, though, please note that the version of the package in the ports tree ( is not the latest (0.13.4).  Perhaps it would be worth to move to a more recent version to see if this is still a problem there.
Comment 3 John Marino freebsd_committer 2015-02-22 20:19:29 UTC
It couldn't hurt to update the version.  At worst we would be in the same spot. :)
Comment 4 Gabor Pali freebsd_committer 2015-02-22 20:36:23 UTC
Indeed :-)  I could do this as part of upgrading the whole gtk2hs to 0.13, probably.
Comment 5 John Marino freebsd_committer 2015-03-18 12:41:30 UTC
So after fixing a bunch of ports and forcing others to be built by the base gcc47, hs-gtk is now the top port in terms of causing ports to be skipped in poudriere.

Does hs-gtk use the C pre-processor by any chance?  the cpp changed behavior starting with gcc 5 so maybe that's what is causing the breakage.
Comment 6 Gabor Pali freebsd_committer 2015-03-22 02:41:53 UTC
I am not sure if the gtk2hs-buildtools (which is used by gtk for preprocessing) use cpp of GCC, but GHC (the Haskell compiler) certainly does.  But this should have been causing much more headaches if that was a problem for GHC.

For now, I do not have any ideas on this subject -- I have brought many of the gtk2hs ports up to date on my development machines, but in order to make it push to the development overlay, I shall also fight with the dependencies, such as leksah to see if they are willing to build with them (and fix them if needed).  I do not like having broken ports around either.  Hope I can do this soon.
Comment 7 John Marino freebsd_committer 2015-03-22 08:20:33 UTC
(In reply to Gabor Pali from comment #6)
But this should have been causing much more headaches if that was a problem for GHC.

Not necessarily; if the cpp is used correctly there's no issue.  What I've seen is when somebody uses cpp for non-conventional tasks like as a template or some other thing -- and then the output isn't expected.

the fix is just add "-P" to the arguments of cpp, then it will behave as before.  I'll take a look at buildtools.
Comment 8 John Marino freebsd_committer 2015-03-22 16:15:59 UTC
Created attachment 154661 [details]
fix cpp for hs-gtk

Yes, the hypothesis was correct; the behavior change in CPP was responsible for hs-gtk breaking.  The attached patch to devel/hs-gtk2hs-buildtools enables hs-gtk to build, and everything else that depends on hs-gtk as well.
Comment 9 John Marino freebsd_committer 2015-03-30 08:19:54 UTC
Gabor, what do you think about the patch?
Comment 10 Gabor Pali freebsd_committer 2015-03-30 09:28:28 UTC
Oops, sorry, this has probably escaped my humble attention.

I have not tested it, but other than that it looks good to me.  So, feel free to commit it if this helps to build hs-gtk properly (and does not break anything else).
Comment 11 commit-hook freebsd_committer 2015-03-30 10:43:45 UTC
A commit references this bug:

Author: marino
Date: Mon Mar 30 10:43:06 UTC 2015
New revision: 382648
URL: https://svnweb.freebsd.org/changeset/ports/382648

  devel/hs-gtk2hs-buildtools: Fix build of www/hs-gtk with gcc5

  The Haskell gtk buildtools use CPP.  The CPP on gcc5 has changed
  behavior, thus preventing hs-gtk from successfully building with gcc5.
  By adding the -P argument when invoking "cpp" which forces the old
  behavior, hs-gtk can be built by all versions of gcc.

  PR:		197924
  Submitted by:	marino
  Approved by:	haskell@ (pgj@)

Comment 12 John Marino freebsd_committer 2015-03-30 10:44:59 UTC
Thanks.  I was not aware of any fallout from the change, so I went ahead and committed it.