Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Variants

Reply
 
Thread Tools Display Modes
Old January 8, 2022, 09:36   #1
smbhax
Swordsman
 
Join Date: Oct 2021
Location: WA
Posts: 342
smbhax is on a distinguished road
Compiling Hengband: "fatal error: util.h: No such file or directory"

When compiling Hengband--the latest from the Hengband repo--in Cygwin, following the instructions for Unix here https://github.com/hengband/hengband.../readme-eng.md , I get an error:

Code:
io/uid-checker.cpp:6:10: fatal error: util.h: No such file or directory
    6 | #include "util.h"
If I comment that include line in uid-checker.cpp out, Hengband compiles with no further errors, but running the generated .exe gives a "setuid(): cannot set permissions correctly!" error.

There are a lot of files in the Hengband repo ending with "-util.h," but none named just "util.h." Could this be a typo in uid-checker.cpp, or a missing file?

I'm a noob at this, sorry for the dumb question!
__________________
My Angband videos
smbhax is offline   Reply With Quote
Old January 8, 2022, 20:07   #2
backwardsEric
Swordsman
 
Join Date: Aug 2019
Posts: 434
backwardsEric is on a distinguished road
That looks like a bug. I'd post an issue about it on Hengband's issue list. My guess as to why they haven't seen it when they compile for Linux is that SAFE_SETUID_POSIX somehow isn't set there while it is set on cygwin. Commenting out lines 51 to 53 of src/system/h-config.h (i.e. replace

Code:
  #ifdef _POSIX_SAVED_IDS
    #define SAFE_SETUID_POSIX
  #endif
with

Code:
#if 0
  #ifdef _POSIX_SAVED_IDS
    #define SAFE_SETUID_POSIX
  #endif
#endif
) and recompiling may work around the problem.
backwardsEric is offline   Reply With Quote
Old January 9, 2022, 05:53   #3
smbhax
Swordsman
 
Join Date: Oct 2021
Location: WA
Posts: 342
smbhax is on a distinguished road
Quote:
Originally Posted by backwardsEric View Post
That looks like a bug. I'd post an issue about it on Hengband's issue list. My guess as to why they haven't seen it when they compile for Linux is that SAFE_SETUID_POSIX somehow isn't set there while it is set on cygwin. Commenting out lines 51 to 53 of src/system/h-config.h (i.e. replace

Code:
  #ifdef _POSIX_SAVED_IDS
    #define SAFE_SETUID_POSIX
  #endif
with

Code:
#if 0
  #ifdef _POSIX_SAVED_IDS
    #define SAFE_SETUID_POSIX
  #endif
#endif
) and recompiling may work around the problem.
Thanks for taking a look! Tried that workaround, and the game compiles, but dies with "Fatal Error" when run.

(There's also the odd issue that trying to run ./hengband gives a "is a directory" error; renaming /hengband/Hengband/ to something that is not "Hengband" seems to dodge that (looks like all that's in that directory are vc proj files?), but there's probably a less hacky way to do that.)

I entered the "util.h" compiling error on their repo, and included your comment: https://github.com/hengband/hengband/issues/1971

Update:

They replied almost instantly, fixed my issue title (I'd overlooked it and left it as the Japanese placeholder text, urk), and said they would fix the problem: they've added it to their Alpha 52 milestone. : )
__________________
My Angband videos
smbhax is offline   Reply With Quote
Old January 9, 2022, 13:41   #4
smbhax
Swordsman
 
Join Date: Oct 2021
Location: WA
Posts: 342
smbhax is on a distinguished road
Hourier replied on their git to say
Quote:
I investigated this issue and found that util.h is not used any more.
(quit() was defined in the header once but now it moved to z-util.cpp/h)

So, would you please try to compile Hengband with uid-checker.cpp L3-9 (inclusion of util.h) removed?
This file includes z-util.cpp/h indirectly (uid-checker.cpp => angband.h => z-util.h), so there may be no problem.
I tried that--having reverted the comment to h-config.h--and the program compiled, but attempting to launch it gives "Fatal Error"--which I have reported to them.

Actually, depending on how I try running it, it may say a few different things--I list these in the github issue. For instance, if I try "./hengband" from home/[username]/hengband/ (I have the game and /src/ etc in that folder I made--but I have to rename home/[username]/hengband/Hengband/ to home/[username]/hengband/zHengband/ or something first, otherwise I get "is a directory" : P), it responds with "setuid(): cannot set permissions correctly!"
__________________
My Angband videos

Last edited by smbhax; January 9, 2022 at 16:53.
smbhax is offline   Reply With Quote
Old January 23, 2022, 18:27   #5
backwardsEric
Swordsman
 
Join Date: Aug 2019
Posts: 434
backwardsEric is on a distinguished road
The most recent update to the master branch for Hengband has a change that may fix the problem you saw with escalating/dropping privileges on Cygwin. If you have a chance, it's probably worth trying it out and reporting the results on the issue you filed.

The problem with the executable name clashing with the directory for the Visual Studio project files when the file system is case-insensitive is still there. Easiest workaround is likely to move the Hengband directory to another name before building.
backwardsEric is offline   Reply With Quote
Old January 23, 2022, 20:24   #6
smbhax
Swordsman
 
Join Date: Oct 2021
Location: WA
Posts: 342
smbhax is on a distinguished road
Quote:
Originally Posted by backwardsEric View Post
The most recent update to the master branch for Hengband has a change that may fix the problem you saw with escalating/dropping privileges on Cygwin. If you have a chance, it's probably worth trying it out and reporting the results on the issue you filed.

The problem with the executable name clashing with the directory for the Visual Studio project files when the file system is case-insensitive is still there. Easiest workaround is likely to move the Hengband directory to another name before building.
Thanks! Looks like you've got that and the uid-checker thing fixed very neatly, the game runs now. =))))
__________________
My Angband videos
smbhax is offline   Reply With Quote
Old January 27, 2022, 20:08   #7
Gwarl
Knight
 
Join Date: Jan 2017
Posts: 960
Gwarl will become famous soon enough
Managed to compile 3.0.0Alpha51 on my local machine, but when I try it on the angband.live server I run into this:

Quote:
In file included from /usr/include/c++/8/memory:80,
from ./stdafx.h:9,
from <command-line>:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::enable_if<std::is_convertible<_Up (*)[], _Tp (*)[]>::value>::type std::default_delete<_Tp []>:perator()(_Up*) const [with _Up = object_type; _Tp = object_type; typename std::enable_if<std::is_convertible<_Up (*)[], _Tp (*)[]>::value>::type = void]’:
/usr/include/c++/8/bits/unique_ptr.h:537:17: required from ‘std::unique_ptr<_Tp [], _Dp>::~unique_ptr() [with _Tp = object_type; _Dp = std::default_delete<object_type []>]’
./store/store-util.h:49:42: required from here
/usr/include/c++/8/bits/unique_ptr.h:113:16: error: invalid application of ‘sizeof’ to incomplete type ‘object_type’
static_assert(sizeof(_Tp)>0,
^~~~~~~~~~~
Makefile:4988: recipe for target 'birth/character-builder.o' failed
I'm pretty stumped
Gwarl is offline   Reply With Quote
Old January 27, 2022, 20:54   #8
smbhax
Swordsman
 
Join Date: Oct 2021
Location: WA
Posts: 342
smbhax is on a distinguished road
I didn't run into anything like that either when compiling it on my own machine. Some difference in the compiler you're using on live? I hope you can get it working, it would definitely be nice to see there. : )
__________________
My Angband videos
smbhax is offline   Reply With Quote
Old January 27, 2022, 23:15   #9
backwardsEric
Swordsman
 
Join Date: Aug 2019
Posts: 434
backwardsEric is on a distinguished road
Gwarl, I didn't encounter any problems compiling it on Debian bullseye (Debian's version of gcc 10.2.1 was the compiler). From GitHub's logs for Hengband's Actions, they're successfully compiling it on Ubuntu 20.04 LTS using clang-11 or gcc (gcc version is either 10.3 or 9.3 according to GitHub's summary of the installed software for the Ubuntu runner).

Did you try adding

Code:
#include "system/object-type-definition.h"
to src/birth/character-builder.cpp? That might be enough to satisfy unique_ptr's use of sizeof().
backwardsEric is offline   Reply With Quote
Old January 28, 2022, 01:33   #10
Gwarl
Knight
 
Join Date: Jan 2017
Posts: 960
Gwarl will become famous soon enough
Thanks, that fixed it. I got a couple of other files needing the same fix, now I've run into this

Quote:
knowledge/knowledge-items.cpp: In function �KIND_OBJECT_IDX collect_objects(int, KIND_OBJECT_IDX*, BIT_FLAGS8)’:
knowledge/knowledge-items.cpp:144:27: error: �reduce’ is not a member of �std’
auto k = std::reduce(std::begin(k_ref.chance), std::end(k_ref.chance), 0);
^~~~~~
knowledge/knowledge-items.cpp:144:27: note: suggested alternative: �deque’
auto k = std::reduce(std::begin(k_ref.chance), std::end(k_ref.chance), 0);
^~~~~~
deque
Makefile:4988: recipe for target 'knowledge/knowledge-items.o' failed
I suspect the compiler is too old, it's gcc 8.4 which is the latest available in the apt repositories available. Is there anything else I can try besides setting up a newer version?
Gwarl is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting "error!! is this really character dump?" TheQuest Variants 4 July 20, 2017 11:31
3.5 key map error "x" Ingwe Ingweron Development 1 January 4, 2014 03:29
Compiling a "Windows Console" version Dean Anderson Development 34 December 3, 2010 23:00
Lua "obsolete file error", blargh Therem Harth ToME 4 July 4, 2010 14:02
help with compile error (and "const") will_asher Development 4 August 3, 2009 23:35


All times are GMT +1. The time now is 20:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.