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

Issues building on macOS Monterey (and workarounds) #77

Open
yamamushi opened this issue Jul 10, 2022 · 1 comment
Open

Issues building on macOS Monterey (and workarounds) #77

yamamushi opened this issue Jul 10, 2022 · 1 comment

Comments

@yamamushi
Copy link

I cloned this repository and tried the setup instructions from https://nethackwiki.com/wiki/SlashTHEM#Compiling_in_Mac_OSX

However I ran into two errors that I was able to fix, not sure about whether or not these should be made into a PR or not but I'd be happy to do it if these fixes are proper (my C is rusty):

The first error was:

dungeon.c:2481:12: error: implicitly declaring library function 'toupper' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
                buf[i] = toupper(buf[i]);
                         ^
dungeon.c:2481:12: note: include the header <ctype.h> or explicitly provide a declaration for 'toupper'

I resolved this by following the suggestion and adding #include <ctype.h> to src/dungeon.c.

The second error I hit was:

cc -O -I../include -c ../sys/share/ioctl.c
../sys/share/ioctl.c:110:9: error: implicit declaration of function 'ioctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (ioctl(fileno(stdin), (int)TIOCGWINSZ, (char *)&ttsz) != -1) {
        ^
1 error generated.

I resolved this by appending -Wno-implicit-function-declaration to the CFLAGS in src/Makefile:

CFLAGS = -O -I../include -Wno-implicit-function-declaration

I then updated GAMEUID and GAMEGRP in the root Makefile to my username and staff as the group accordingly, which allowed the game to be installed correctly.

However, one last issue is that if I run /usr/local/slashthemdir/slashthem, I get the perm bug error:

Cannot open file perm. This is a program bug.
Waiting for release of fcntl lock on perm. (9 retries left).
Waiting for release of fcntl lock on perm. (8 retries left).
Waiting for release of fcntl lock on perm. (7 retries left).
Waiting for release of fcntl lock on perm. (6 retries left).
Waiting for release of fcntl lock on perm. (5 retries left).
Waiting for release of fcntl lock on perm. (4 retries left).
Waiting for release of fcntl lock on perm. (3 retries left).
Waiting for release of fcntl lock on perm. (2 retries left).
Waiting for release of fcntl lock on perm. (1 retries left).
Waiting for release of fcntl lock on perm. (0 retries left).
I give up.  Sorry.
Some other process has an unnatural grip on perm.

Hit space to continue:

I can work around this by creating a "perm" file with 644 permissions in whatever my current working directory is, and the game will launch without issue. So it appears to only be looking for that file in the current directory, instead of /usr/local/slashthemdir/ or even ~/slashthemdir. Is there something I can do to fix that particular issue? I'd rather not have a random "perm" file sitting around my home directory :)

@gebulmer
Copy link
Contributor

the header for ioctl is <sys/ioctl.h>, I think the preprocessor mess near the top of sys/share/ioctl.c are a bit of a mess and don't quite check what to do for macos properly

I suspect that's probably a running theme throughout and why toupper isn't declared either

depending which makefile you used there should be a shell script as well (in I think /usr/local/bin/slashthem maybe?) which sets the environment variables to point at the directory with perm in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants