# Is haskell broken in 11.1?



## dpx (Jul 26, 2017)

Hi, I am long time linux user but very new with FreeBSD and I run into a problem I can't solve.

Few days ago I installed 11.0-RELEASE and set my basic environment which includes xmonad and xmobar. Haskell has recompiled my xmonad.hs settings well so I am sure everything worked as expected.

Today I upgraded to 11.1-RELEASE and haskell seems to be broken. Everything is up to date, including properly finished upgrade of BSD and all the packages.

I tried installing port version of xmobar (which requires recompiling of course) and I got this message:

```
> cd /usr/ports/x11/hs-xmobar/
> sudo make install
===>   hs-xmobar-0.24.3 depends on executable: ghc - found
===>   hs-xmobar-0.24.3 depends on package: ghc>=7.10.2 - found
===>   hs-xmobar-0.24.3 depends on package: hs-HTTP>=4000.2.4 - found
===>   hs-xmobar-0.24.3 depends on package: hs-mtl>=2.1 - found
===>   hs-xmobar-0.24.3 depends on package: hs-parsec>=3.1 - found
===>   hs-xmobar-0.24.3 depends on package: hs-regex-compat>=0 - found
===>   hs-xmobar-0.24.3 depends on package: hs-stm>=2.3 - found
===>   hs-xmobar-0.24.3 depends on package: hs-X11>=1.6.1 - found
===>   hs-xmobar-0.24.3 depends on package: hs-utf8-string>=0 - found
===>   hs-xmobar-0.24.3 depends on package: hs-X11-xft>=0.2 - found
===>   hs-xmobar-0.24.3 depends on package: hs-utf8-string>=0 - found
===>   hs-xmobar-0.24.3 depends on package: libiconv>=1.14_9 - found
===>   hs-xmobar-0.24.3 depends on executable: gcc5 - found
===>   hs-xmobar-0.24.3 depends on file: /usr/local/bin/as - found
===>   hs-xmobar-0.24.3 depends on file: /usr/local/libdata/pkgconfig/xpm.pc - found
===>   hs-xmobar-0.24.3 depends on shared library: libgmp.so - found (/usr/local/lib/libgmp.so)
===>  Configuring for hs-xmobar-0.24.3
Linking ./setup ...

In file included from /usr/local/lib/ghc-7.10.2/include/rts/Threads.h:19:0:
    0,
                     from /usr/local/lib/ghc-7.10.2/include/Rts.h:206,
                     from /tmp/ghc19059_0/ghc_3.c:1:

/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed/sys/types.h:266:9:
     error: unknown type name '__vm_ooffset_t'
     typedef __vm_ooffset_t vm_ooffset_t;
             ^

/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed/sys/types.h:268:9:
     error: unknown type name '__vm_pindex_t'
     typedef __vm_pindex_t vm_pindex_t;
             ^
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/x11/hs-xmobar
*** Error code 1

Stop.
make: stopped in /usr/ports/x11/hs-xmobar
```

Same happens with trying to compile any other haskell code.

Two options are possible, either I didn't do something right, considering few days of experience with FreeBSD, or haskell got out of sync with the rest of the system.

Is this usual for FreeBSD (I mean should I wait for package fix)? Or there is something I can do to fix the situation?

Please help. Thanks.


----------



## SirDice (Jul 26, 2017)

I don't think the FreeBSD version has anything to do with it as you're building it yourself. I do notice on Portsmon that the last built packages are all the previous version. This port was updated more than 5 months ago so I would expect to see that version in the repositories. But there are no build failures or any other failures being logged. Those are usually a good indication there's something wrong with the port itself. 

http://portsmon.freebsd.org/portoverview.py?category=x11&portname=hs-xmobar


----------



## dpx (Jul 26, 2017)

Thanks SirDice. Xmobar not building is just a effect of haskell not being able to compile any haskell code on 11.1. I do have few very short haskell examples that I use often, so I know they compile well. After running into xmobar problem I tried compiling them and compilation crashes the same way as trying to compile xmobar.

Since haskell code I use (more like a 'script', one file and less than 100 lines of code) has nothing to do with ports, it just shows that haskell doesn't work on 11.1. It was working on 11.0. Alternative explanation is that I didn't upgrade well but both freebsd-update and pkg say everything is up to date.

How do I test this or report further? I'd like to help with any debugging but don't know what to try since I am so fresh on FreeBSD. Also not sure show haskell gets packaged on FreeBSD so I can't check anything on my own. I do programming for living so I can follow any instructions you send this way.

Edit:

This is haskel package that causes problems: http://portsmon.freebsd.org/portoverview.py?category=lang&portname=ghc

Also I didn't built ghc myself, it is installed as a pkg, as a dependency of xmonad.


----------



## tobik@ (Jul 26, 2017)

See PR 220458 for a similar problem. At least one person solved it by rebuilding GCC, so in your case try rebuilding lang/gcc5 and see if that fixes it.


----------



## dpx (Jul 26, 2017)

Hmm, this may be above my skills.

Trying to build lang/gcc5 manually:

```
===>   gcc5-5.4.0_3 depends on file: /usr/local/bin/as - found
===>   gcc5-5.4.0_3 depends on executable: gmake - found
===>   gcc5-5.4.0_3 depends on package: libiconv>=1.14_9 - found
===>   gcc5-5.4.0_3 depends on executable: makeinfo - not found
===>   texinfo-6.4_1,1 depends on executable: help2man - not found
===>   help2man-1.47.4 depends on package: p5-Locale-gettext>=0 - not found
===>   p5-Locale-gettext-1.07 depends on executable: msgfmt - found
===>   p5-Locale-gettext-1.07 depends on package: perl5>=5.24<5.25 - found
===>   p5-Locale-gettext-1.07 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>  Configuring for p5-Locale-gettext-1.07
env: /usr/local/bin/perl5.24.2: No such file or directory
*** Error code 127

Stop.
make[6]: stopped in /usr/ports/devel/p5-Locale-gettext
*** Error code 1

Stop.
make[5]: stopped in /usr/ports/misc/help2man
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/misc/help2man
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/print/texinfo
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/print/texinfo
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/lang/gcc5
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/gcc5
```

I already have perl 5.24.1 installed, it was required to build urxvt.

So I tried force installing package in hope it will fix headers:

```
sudo pkg install -f gcc5
```

Final result is same xmobar compile error as at first message.

So do I need perl 5.24.1 (it was needed for urxvt I think) AND 5.24.2 (required to build gcc5), in order to try to compile any haskell code? I am new here so is it usual to have to keep n versions of the same stuff, even if they only differ in minor version number?

Any idea is welcome. I am systemd refugee and really like how FreeBSD performs (processor is cooler almost 50% than on linux, memory usage is way better, zfs, all amazing). Please tell me that dependency hell like this one is not usual on FreeBSD.

Is there anything I could delete/reinstall to make it all work? I am trying to keep number of packages I need to compile minimal, so far only mutt and xmobar have to be compiled. If I have to compile gcc or ghc that would be bad.


----------



## galbitorix (Jul 31, 2017)

I am having the same issue with GHC ever since upgrading to 11.1 yesterday.

```
> stack setup
The GHC located at /home/user/.stack/programs/x86_64-freebsd/ghc-8.0.2/bin/ghc failed to compile a sanity check
```


```
`gcc' failed in phase `C Compiler'. (Exit code: 1)
```
I have tried multiple different snapshots and recompiling gcc, but nothing has worked yet.


----------



## SirDice (Jul 31, 2017)

dpx said:


> So do I need perl 5.24.1 (it was needed for urxvt I think) AND 5.24.2 (required to build gcc5), in order to try to compile any haskell code?


No, you need to update _everything_ so everything depends on the correct version (Perl 5.24.2 in this case). Updating single packages is bound to cause all sorts of dependency errors. Either update everything or nothing.


----------



## tobik@ (Jul 31, 2017)

lang/gcc5 on HEAD does not install /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed at all after ports r444860. It apparently shouldn't be included in the GCC package and can lead to breakage when FreeBSD headers are updated.

Can someone try deleting /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed and see if that fixes things for them?


----------



## skywhi (Aug 1, 2017)

tobik@ said:


> lang/gcc5 on HEAD does not install /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed at all after ports r444860. It apparently shouldn't be included in the GCC package and can lead to breakage when FreeBSD headers are updated.
> 
> Can someone try deleting /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed and see if that fixes things for them?



Hi everyone, as I was running into the same problem as the OP, I googled a bit, found this bug report (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220411) and this forum thread.

Simply removing the directory did it for me and I could just run xmonad --recompile without any errors afterwards :
`# rm -r /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-fixed
<..>
$ xmonad --recompile
$ startx`

So thank you very much for your help! As I am still pretty new to FreeBSD I don't know what I can do about the bug report, but if there is something I can do I'll gladly help


----------



## SirDice (Aug 2, 2017)

skywhi said:


> As I am still pretty new to freebsd I don't know what I can do about the bug report


If you want you can post the same information you posted here. That'll provide confirmation of the working solution. Responding (or reporting) does require you to sign up though.


----------



## tobik@ (Aug 7, 2017)

The problem has been fixed in ports r447439 in the 2017Q3 ports branch. Quarterly packages have not been rebuilt yet but that should hopefully happen soonish.

As long as your using gcc5-5.4.0_3 you should be good to go and don't need any of the workarounds anymore.


----------

