Ticket #2941 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

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

Reported by: duncan Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 6.8.3
Keywords: Cc: judahj
Operating System: Solaris Architecture: sparc
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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.

Change History

Changed 4 years ago by judahj

  • cc judahj added

Changed 4 years ago by simonmar

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to fixed

Fixed in 6.10.1, because we don't #include anything in .hc files. I knew it was a good idea to do that!

Note: See TracTickets for help on using tickets.