Git Product home page Git Product logo

Comments (12)

entrez avatar entrez commented on July 1, 2024 2

It seems like the culprit for the specific error you cited might be this:

BUNDLE = mkdir -p $(HACKDIR)/nethack.app/Contents/MacOS; \
sys/unix/hints/macosx.sh infoplist > $(HACKDIR)/nethack.app/Contents/Info.plist; \
mv $(HACKDIR)/nethack $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
ifdef WANT_SHARE_INSTALL
BUNDLE+= chmod $(GAMEPERM) $(HACKDIR)/nethack.app/Contents/MacOS/nethack;
endif

Probably the instances of 'nethack' there should be replaced by 'xnethack' or maybe by $(GAME), which seems to be used elsewhere in the hints file for similar purposes.

There's a description of the intended contents of the .app directory here:

# $(HACKDIR)/$(GAME).app/
# Contents/
# Frameworks/
# Info.plist
# MacOS/
# $(GAME)
# PkgInfo/
# PlugIns/
# Resources/
# SharedFrameWorks/

I'm not sure how much else of that stuff might need modification... I'd try fixing the specific error you got and then seeing what other issues (if any) crop up after that, at least as a starting point.

from xnethack.

entrez avatar entrez commented on July 1, 2024 1

It's definitely possible to compile xNetHack on and for macOS, I do it regularly (for the TTY and curses windowports, at least). The same instructions for building vanilla NetHack (in sys/unix/NewInstall.unx) should work fine. There's a macOS-specific hints file in sys/unix/hints.

There may be a way to build it as an Xcode project as well. As far as I know that's an option for vanilla NetHack, but I don't have any experience with it (I'm not sure if I'm even using the right terminology there) and I'm not sure if anything about it wouldn't work for xNetHack. I think there's a readme in sys/unix describing that process, too.

from xnethack.

copperwater avatar copperwater commented on July 1, 2024 1

I can confirm it builds on macOS via github's CI which builds on that plus linux and windows, but I don't have a Mac myself to actually run the game on. Based on it generally working fine for qt, the game ought to run fine if compiled.

I agree that sys/unix/NewInstall.unx should be the starting point for how to compile it on Mac. I haven't changed any of that; the build process should be the same as building vanilla NetHack on Mac.

from xnethack.

miguno avatar miguno commented on July 1, 2024

Thanks @entrez. I was able to compile it, with the following process. But some follow-up questions below, as there were some errors.

Dependencies:

  1. Install Qt5 with brew install qt@5. (I tried Qt6, but that didn't work.)
  2. Install Xpm with brew install libxpm.

Then, for xNetHack itself:

  1. Add WANT_WIN_QT5 and QTDIR settings to the top of sys/unix/hints/macOS.370:
# 3. If you set WANT_WIN_QT, you need to
#  A) set QTDIR either here or in the environment to point to the Qt5
#     library installation root.  (Qt2, Qt3, Qt4 will not work)
#  B) set XPMLIB to point to the Xpm library

WANT_WIN_QT5=1
QTDIR=/opt/homebrew/opt/qt@5
  1. Run the described build steps.
$ pwd
~/git/xNetHack
$ make clean
$ (cd sys/unix && sh setup.sh hints/macOS.370)
$ make fetch-Lua && make all
$ make install

This created a folder $HOME/nethackdir/, in which I found an xnethack executable. Running it started xNetHack with a GUI.

FWIW, I was also able to compile the console version by running the build steps against an unmodified sys/unix/hints/macOS.370 file.

Issues

The make install step failed to create the xnethack.app.

Here's are the last few lines of output of make install from my steps described above:

true; sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf /Users/miguno/nethackdir/sysconf; /usr/bin/true  /Users/miguno/nethackdir/sysconf; /usr/bin/true  /Users/miguno/nethackdir/sysconf; chmod 0600 /Users/miguno/nethackdir/sysconf; mkdir -p /Users/miguno/nethackdir/nethack.app/Contents/MacOS; sys/unix/hints/macosx.sh infoplist > /Users/miguno/nethackdir/nethack.app/Contents/Info.plist; mv /Users/miguno/nethackdir/nethack /Users/miguno/nethackdir/nethack.app/Contents/MacOS/nethack; if test -f /Users/miguno/bin/xnethack; then sed -i '' 's;HACKDIR/xnethack;HACKDIR/xnethack.app/Contents/MacOS/xnethack;' /Users/miguno/bin/xnethack ; fi;
mv: rename /Users/miguno/nethackdir/nethack to /Users/miguno/nethackdir/nethack.app/Contents/MacOS/nethack: No such file or directory
You may also want to reinstall the man pages via the doc Makefile.

Also, make install created $HOME/bin/xnethack, which is a launcher file. Attempting to run it results in:

$ ~/bin/xnethack
./xnethack: line 68: /Users/miguno/nethackdir/xnethack.app/Contents/MacOS/xnethack: No such file or directory
./xnethack: line 68: exec: /Users/miguno/nethackdir/xnethack.app/Contents/MacOS/xnethack: cannot execute: No such file or directory

Note the difference between xnethack.app here, and nethack.app in the make install output above. Seems like a naming error in the launcher file, in addition to the actual make install issue?

Questions for you:

  1. What should be in the [x]nethack.app folder for the macOS app? Just the binary that is located under $HOME/nethackdir/xnethack?
  2. Where would I go about fixing this in the build setup? I am not very familiar with the C build toolchain.

from xnethack.

miguno avatar miguno commented on July 1, 2024

Thanks again so much for your quick and effective help, @entrez!

I have fixed the error above in my fork, see the single commit that's different to the latest master of this upstream repository: https://github.com/miguno/xNetHack/commit/fcbd54b2524e0d6bc070d4a49ae4fdaf65dc43de

Let me know if you'd like a pull request for some of that, like the change to sys/unix/hints/macOS.370 (you probably don't want the justfile, though nifty, because you are not using just in this repository).

from xnethack.

copperwater avatar copperwater commented on July 1, 2024

Pull requests are always greatly appreciated, especially if it's mostly just dumb overlooks like not renaming "nethack" to "xnethack". The justfile looks well constructed, but yeah, I don't want to add a soft dependency on it for mac users (and it's just wrapping up make all/install commands anyway which the devteam's install docs contain instructions for).

from xnethack.

miguno avatar miguno commented on July 1, 2024

Ok, I can do a pull request for the rename.

Quick questions:

  1. If the functionality itself is useful for this repository, I can turn the justfile into a bash script, if that would be an option to get it included for other macOS users that want a one-click install option.

  2. I decided to change the default nethackdir for xNetHack to xnethackdir. This way it is consistent with xnethack (vs. nethack), and it makes it easier and safer to co-install xNetHack alongside the vanilla https://github.com/NetHack/NetHack (e.g., no risk to overwrite one's NetHack installation in ~/nethackdir while re-installing xNetHack). However, changing such a default setting is probably a more far-reaching change for this repository, and might go against the intuition of long-time xNetHack/NetHack users (which I am not, so I can't speak from experience). It might also cause merge conflicts in the future when xNetHack is syncing its code base with vanilla NetHack, if NetHack were to make non-trivial changes to that part of the code base.

Let me know if there's an interest in (1) and/or (2), and I can add that to the pull request, too.

from xnethack.

miguno avatar miguno commented on July 1, 2024

Regarding 2) above: Or let me rephrase. How should a user go about co-installing nethack and xnethack?

My intuition was that the differences between the two mean they cannot share the same local data files (eg, save files). Hence I thought separating the install directories is the best approach, and I couldn’t spot a better option than changing the nethackdir location.

I did come across a -d CLI option to point [x]nethack to a different HACKDIR on launch, but that does not solve the problem of xNetHack overwriting NetHack‘s default installation directory during its own installation because they use the same paths.

from xnethack.

copperwater avatar copperwater commented on July 1, 2024

Yes, xnethackdir would be the correct place to put xNetHack data files, since they have no compatibility (or more accurately no guarantee of it) with vanilla NetHack data files. It's already set up that way on Linux. Consider this the growing pains of the first time it's tried to be installed alongside vanilla NetHack on Mac (apparently? It surprises me that entrez hasn't yet run into such a problem, since he has a vanilla build).

This does cause merge conflicts down the line but they're the trivial sort and I already deal with them for Linux and Windows, so that's not really a big deal.

Also, I don't think this is the case, but if the game is trying to read from .nethackrc rather than .xnethackrc then that should be changed as well (won't have a fun time with both NetHack and xNetHack installed if they are trying to read the same single config file!)

Expediting ease of install is a good thing, so a one-command bash script would be a good addition provided it is discoverable.

from xnethack.

entrez avatar entrez commented on July 1, 2024

I'm glad you were able to get it working! One other NetHack vs xNetHack thing I see in there is some of the plist lines in sys/unix/hints/macosx.sh; those still seem to have the app's name as NetHack. I don't know what difference that actually makes, though.

It surprises me that entrez hasn't yet run into such a problem, since he has a vanilla build

I always build NetHack variants (and NetHack itself) inside their respective source trees rather than really installing them, so I haven't run into any of these problems before. To be honest, I didn't even know there was a built-in way to make an xNetHack.app...

from xnethack.

miguno avatar miguno commented on July 1, 2024

Pull request is up at #63.

@copperwater wrote:

This does cause merge conflicts down the line but they're the trivial sort and I already deal with them for Linux and Windows, so that's not really a big deal.

Ack.

Also, I don't think this is the case, but if the game is trying to read from .nethackrc rather than .xnethackrc then that should be changed as well (won't have a fun time with both NetHack and xNetHack installed if they are trying to read the same single config file!)

The game is already reading from ~/.xnethackrc. Discovered it yesterday after my settings in ~/.nethackrc weren't applied. ;-)

Expediting ease of install is a good thing, so a one-command bash script would be a good addition provided it is discoverable.

Included in pull request.

@entrez wrote:

I'm glad you were able to get it working! One other NetHack vs xNetHack thing I see in there is some of the plist lines in sys/unix/hints/macosx.sh; those still seem to have the app's name as NetHack. I don't know what difference that actually makes, though.

Yes, there are several NetHack references still in sys/unix/hints/macosx.sh. I deliberately made only minimal changes there, as (1) changing some references would break xNetHack given its current code base, e.g., some are references to NetHack code files that were not renamed in xNetHack and (2) I don't know how to test and verify these additional changes.

Thanks both of you for the help, and thanks for maintaining xNetHack (and NetHack)!

from xnethack.

miguno avatar miguno commented on July 1, 2024

Closing this issue because it was answered. (Pull request still open.)

from xnethack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.