Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/include/term.h breaks builds #2919

Open
yobson opened this issue Sep 2, 2022 · 3 comments
Open

/usr/include/term.h breaks builds #2919

yobson opened this issue Sep 2, 2022 · 3 comments
Labels

Comments

@yobson
Copy link

yobson commented Sep 2, 2022

Hello!

I'm currently bringing GHC up for omni os, but it will not compile due to issues with term.h

Take the following c program:

#include <term.h>
#include <stdio.h>

int main() {
	return 0;
}

We run gcc test.c

Expected Result

We get a rather boring a.out file

What happens:

In file included from test.c:1:
/usr/include/term.h:1055:9: error: unknown type name 'bool'
 1055 |         bool    init;           /* TRUE if pair was initialized */
      |         ^~~~
/usr/include/term.h:1081:9: error: unknown type name 'SGTTY'
 1081 |         SGTTY   Ottyb,          /* original state of the terminal */
      |         ^~~~~
/usr/include/term.h:1102:9: error: unknown type name 'chtype'
 1102 |         chtype  sgr_mode;               /* current phys. graphic rendition */
      |         ^~~~~~
/usr/include/term.h:1103:9: error: unknown type name 'chtype'
 1103 |         chtype  sgr_faked;              /* attributes faked by vidputs */
      |         ^~~~~~
/usr/include/term.h:1113:9: error: unknown type name 'bool'
 1113 |         bool            funckeystarter[0400];
      |         ^~~~
/usr/include/term.h:1115:9: error: unknown type name 'bool'
 1115 |         bool            _fl_rawmode,    /* in cbreak(=1) or raw(=2) mode */
      |         ^~~~
/usr/include/term.h:1121:9: error: unknown type name 'chtype'
 1121 |         chtype                          /* a place to put stuff ungetch'ed */
      |         ^~~~~~
/usr/include/term.h:1129:9: error: unknown type name 'chtype'
 1129 |         chtype          *_acsmap;       /* map of alternate char set chars */
      |         ^~~~~~
/usr/include/term.h:1132:9: error: unknown type name 'chtype'
 1132 |         chtype          bit_vector;
      |         ^~~~~~
/usr/include/term.h:1136:9: error: unknown type name 'chtype'
 1136 |         chtype          check_turn_off;
      |         ^~~~~~
/usr/include/term.h:1137:9: error: unknown type name 'chtype'
 1137 |         chtype          non_faked_mode;
      |         ^~~~~~
/usr/include/term.h:1229:32: error: expected ')' before 'int'
 1229 |                 vidputs(chtype, int (*)(char)), vidattr(chtype);
      |                                ^~~~
      |                                )

I'm guessing that this isn't expected behaviour because GHC hits the exact same error!

All the best

James

@citrus-it
Copy link
Member

Hi, the program works if you also include <curses.h> before <term.h> so a similar patch to GHC might work.

% cat c.c
#include <curses.h>
#include <term.h>
#include <stdio.h>

int main() {
        return 0;
}

% gcc c.c

I don't know whether term.h should automatically be including that, maybe somebody else has an idea.

@yobson
Copy link
Author

yobson commented Sep 4, 2022

Thanks! I'll look and see if I can work out what's going on with ghc then!

@stale
Copy link

stale bot commented Nov 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants