georgbuechner / dissonance

A command line and keyboard based strategy-game written in c++, where audio-input determines the AI-strategy and lays the seed for the map-generation.
GNU General Public License v3.0
32 stars 3 forks source link

[MacOs] Error opening termin: xterm-256color #29

Closed georgbuechner closed 3 years ago

georgbuechner commented 3 years ago

When running dissonance (starting game) the error Error opening termin: xterm-256color occurs.

I was not able to fix this so far (the linux fix - exporting TERMINFO - is not working.)

georgbuechner commented 3 years ago

Seems like ncurses is only checking ~/.terminfo folder. As (at least in my case) the $TERM variable seems to be set to xterm-256color we need to give ncurses the information for this terminal. In MacOs (at least in my case) the terminfos are stored at /usr/share/terminfo however as already mentioned ncurses does not search this folder, even when exporting terminfo (export TERMINFO=/usr/share/terminfo), which is very strange as exactly the same fix (with a different path: /usr/lib/terminfo) is working for linux. Thus the solution is to copy the terminfo needed to ~/.terminfo

The terminfos are stored in different folders, to avoid huge directories. Thus (in linux) folders with the first characters of possible terminfos are created (1, 2, .., 9, a, A, b, B, ..., z, Z). MacOs however uses Hexadecimal encoding (31, 32 .. 77, 78, 7a) for the first characters. What you need to do is, find the hexadecimal-number for the first character of you $TERM variable, and copy this folder from /usr/share/terminfo to ~/.terminfo.

As I already said, $TERM seems to be set to xterm-256color in most cases, thus I added a step to the Makefile doing the above on make setup for the folder 78 (which is x), with the following command:

sudo cp -r /usr/share/terminfo/78 ~/.terminfo

Also the ~/.terminfo-folder is created on make setup.

So in case your $TERM is not xterm (or anything else starting with a x), you need to finde the corredsponding hexadezimal number and then run sudo cp -r /usr/share/terminfo/[whateveryounumbner] ~/.terminfo once.