NetHack 编译错误怎么解决
nethack吧
全部回复
仅看楼主
level 2
如题,在 MacOSX 上面编译 NetHack 3.6.7 源码(https://www.nethack.org/v367/download-src.html),根据文档(/sys/unix/install.unx),走到第六步,在 /src 下用 make 指令编译,遇到了 error:
touch ../src/config.h-t
cc -O -I../include -c monst.c
In file included from monst.c:6:
In file included from ../include/config.h:581:
In file included from ../include/global.h:9:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:68:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:309:39: error: too few arguments provided to function-like macro invocation
#if __has_attribute(warn_unused_result)
^
In file included from monst.c:6:
In file included from ../include/config.h:581:
In file included from ../include/global.h:136:
In file included from ../include/unixconf.h:320:
../include/system.h:358:12: warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
E unsigned sleep();
^
void
1 warning and 1 error generated.
make: *** [monst.o] Error 1
该怎么解决?本人 NetHack 萌新,英语又不好,可能漏看了文档的某些内容,导致编译错误。:(
求大神解决。
2023年10月15日 03点10分 1
level 11
谷歌搜一下那个error,如果没有去stack overflow上问问
2023年10月15日 05点10分 2
好像确实有相关内容,今天晚上看看[呵呵]
2023年10月15日 06点10分
level 6
Fix glibc 2.34 build issue · be11ng/nethack-el@fccf205
https://github.com/be11ng/nethack-el/commit/fccf2057d282e6de788d865587b0932b35ca616a
为了防止 gcc 的某个警告所以把 warn_unused_result redefine 成空了。但是 mac xcode 自带的应该是 clang 所以出了点小问题,你大概可以手动编辑 include/tradstdc.h 里搜索 warn_unused_result 把两行 #define 给删除掉大概可以。
这个 commit 里说这个问题说是 3.6 后来也修复了,可以去 nethack 仓库查看,3.7 也是修复了这个问题,你可以选择直接编译 3.7,虽然说是 WIP 但是实际上很多人都已经在玩 3.7 比如 hardfought 用户在玩原版的时候基本都是玩 3.7 的,基本上没有遇到过 bug。
如果确实只想要 3.6.7 的话也感觉可能没必要自己编译,看了看 brew install nethack 的版本应该就是 3.6.7,不过也不清楚你是不是因为 M1 有什么说法 brew 自带的没法用还是怎么样,不太懂苹果生态。
并且你可以尝试在线游玩 nethack,尝试 ssh [email protected] 或者 ssh [email protected] 进行在线游玩,可以多设备连上玩同一个存档,可以遇到别人的 bones 并且数据在网上记录好交流且防作弊,比如 https://nethackscoreboard.org/ ,nao 是 3.6.7 版本的,hardfought 有 3.7 以及一众 variants,推荐 hardfought。
2023年10月16日 05点10分 3
第一次brew下载的时候错误了,所以想编译,现在重新下好了,感谢
2023年10月21日 00点10分
1