Skip to content

HsBase.h includes termios.h which prevents us including curses.h on solaris

Every .hc file includes HsBase.h from the base package.

Unfortunately on Solaris something that this header defines or includes makes curses.h invalid.

#include "HsBase.h"

#include <curses.h>
#include <term.h>

int main () { return 0; }

Gives us:

GHCDIR=/opt/ghc/lib/ghc-6.8.3
gcc -c foo.c -I${GHCDIR}/include -I${GHCDIR}/lib/base-3.0.2.0/include
In file included from foo.c:5:
/usr/include/term.h:1060: error: field ‘Ottyb’ has incomplete type
/usr/include/term.h:1061: error: field ‘Nttyb’ has incomplete type

whereas if we omit #include "HsBase.h" from foo.c then it compiles fine.

If we narrow this down a bit we find that it's because we cannot compile this file:

#include <termios.h>

#include <curses.h>
#include <term.h>

int main () { return 0; }

That is, if we include termios.h before curses.h

The reason is that curses.h has:

#ifndef VINTR
#include <termio.h>
#endif /* VINTR */
typedef struct termio SGTTY;
typedef struct termios SGTTYS;

and termios.h defines VINTR, however it is termio.h that defines struct termio. Hence the SGTTY typedef is undefined, or incomplete in C parlance.

If we instead do:

#include <curses.h>
#include <term.h>

#include <termios.h>

int main () { return 0; }

Then it compiles fine. Indeed if we edit the .hc file that originally tickled this bug to put the includes in the other order then it all works fine.

The nearest reports elsewhere on the net that I've found are: http://www.nabble.com/Can't-build-pl-5.6.63-td20943886.html http://www.nabble.com/minor-build-issue-with-5.6.61-on-Solaris-10-6-06-td19698590.html

This bug prevents the terminfo package from building on Solaris. In turn that blocks haskeline and ghci-haskeline. So it's a blocker for ghc adopting haskeline on Solaris at the moment. That blocker may go away if we get -fasm working and drop support for -fvia-C.

Trac metadata
Trac field Value
Version 6.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information