Talk:Compiling

From NetHackWiki
Revision as of 00:39, 1 May 2020 by Kahran042 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I tried to download MinGW, and WinRAR said that w32api-3.9.tar within the .tar.gr file under the current section is corrupt. Am I donwloading the wrong file? --71.225.64.232 14:44, 29 April 2007 (UTC)

.tar.gz is not a rar-file. WinZip (at least) knows how to open .tar.gz files. --Paxed 15:15, 29 April 2007 (UTC)
Also, you don't need to download any .tar.gz files; there's a MinGW-5.1.3.exe that you want. --Paxed 15:20, 29 April 2007 (UTC)
Oh, guess I was grabbing the wrong file. Thanks a ton. --71.225.64.232 21:36, 29 April 2007 (UTC)

How do I open Makefile.gcc so I can get NetHack on graphical mode? 69.109.231.64 22:48, 20 May 2007 (UTC)

Makefile.gcc is a plain ASCII text file, you can open it with notepad or any editor of your choice. But you have to make sure your editor uses real tabs (not spaces expanded to tab widths) as makefiles need real tabs. - Progo 05:27, 21 May 2007 (UTC)

OS X

This is my first time ever compiling anything more complicated than "Hello World", and I've never touched the command line outside of Windows before, so I'm sure I'm missing plenty, but the instructions didn't work for me and this is how I fixed it: I spent several hours working out that two lines of

E int FDECL(srandom, (unsigned int));

need to be commented out in system.h to get it to compile.

Also, the given permissions didn't work so I just set all to 777 and they did (...again, noob; correct me if you know better, and the given instructions didn't work on any of these counts). And don't forget to add /usr/games to your $PATH and bash profile. Currently trying to use these instructions to compile SlashEM, too.

-adamlouis[at]gmail.com

PS: Ah! http://nethackwiki.com/wiki/Pkgsrc

Could someone update the Windows section?

MinGW is now at version 5.1.6; the article needs to be updated to reflect this, since the current instructions don't work for 5.1.4 (the earliest still-available version). Dr. 8-Bit 01:28, April 19, 2010 (UTC)

Never mind; it seems I merely forgot to install the make component. Dr. 8-Bit 16:34, May 6, 2010 (UTC)

Windows

I keep getting an error when compiling with tty graphics:

process_begin: CreateProcess(NULL, windres -oo/console.o --include-dir ../sys/winnt -i ../sys/winnt/console.rc, ...) failed
make (e=2): The system cannot find the file specified.
ming32-make: *** [o/console.o] Error 2

Does anyone know what I can do to fix the problem? -Thanks, JDGKruse 04:21, June 1, 2010 (UTC)

Windows

According to source it is also possible to compile with Microsoft Visual C V6.0 SP3 Bulwersator 17:30, 13 December 2010 (UTC)

But is is failing on "..\win\win32\winhack.rc(248) : error RC2135 : file not found: tiles.bmp" anyway... Bulwersator 17:56, 13 December 2010 (UTC)

Windows 7

Do the Windows compile instructions work on Windows 7 with MinGW? --99.239.147.0 21:20, 23 November 2012 (UTC)

Windows 7 MinGW compile failure

Following the directions in the Install.NT:

   1.  It almost goes without saying that you should make sure that your
   tools are set up and running correctly.  That includes ensuring that
   all the necessary environment variables for the compiler environment
   are set correctly.  (Examples: For the Microsoft compiler by
   executing vcvars32.bat, which is probably in the bin directory of 
   your compilers directory tree. For the Borland Makefile, you can 
   simply invoke the Make utility from the Makefile's directory (For 
   the standard Borland compiler installation you can just use the
   explicit path "c:\borland\bcc55\bin\make /f Makefile.bcc".  For the
   GCC Makefile, add <mingw>\bin to your path, where <mingw> is your
   MinGW root directory.)

I did install MinGW but evidently there was a lot I missed. I checked it over again and found out there was a bunch of catalogs and stuff and so I just installed everything, and when I updated the catalog again I found nothing left that wasn't installed.

I just want to try and compile it before I dink around with the source code so I skipped ahead to step 5 (after running the NHSetup.bat in the /sys/winnt directory):

   5.  Now that everything is set up, change your current directory to src.

And I went with...

   For GCC:
       mingw32-make -f Makefile.gcc install

Just for no reason I tried it without the install parameter and it did a lot of things but eventually I ended up right back where I am now. When I ran it with the install parameter and I get this:

   C:\nethack-3.4.3\src>mingw32-make -f Makefile.gcc install
   creating directory o
   gcc -c -mms-bitfields -I../include  -g -DWIN32CON -oo/makedefs.o ../util/makedefs.c
   gcc -c -mms-bitfields -I../include  -g -DWIN32CON -DDLB   -oo/monst.o  ../src/monst.c
   gcc -c -mms-bitfields -I../include  -g -DWIN32CON -DDLB   -oo/objects.o  ../src/objects.c
   ..\util\makedefs -v
   Makefile.gcc:655: recipe for target '../include/date.h' failed
   mingw32-make: *** [../include/date.h] Error -1073741819

I looked at the makefile but I wasn't really able to get anything out of it (I'm really, REALLY new with this kind of low-level stuff). Also, I noticed that the date.h file was empty, and that in the makefile (Makefile.gcc) it says that it gets created on every compile... so what's happening? Why is it failing like this without even changing anything? What am I doing wrong?

--96.2.52.79 20:26, 4 August 2014 (UTC)Will

ubuntu

This is how I got Nethack to compile on my Linux Mint system, which is based on Ubuntu

Make all gave an error message that curses.h was missing. To fix that, I had to

sudo apt-get libncurses5-dev

After building the source, I tried executing nethack as a non-root user. It couldn't write to the records or open a system file. I had to edit hints/linux. I had to define COMPRESS and COMPRESS_EXTENSION becuse it uses a different gzip. I had to define the user "games" and group "games" and set the chmod permission octets for folders and files. I also changed the paths where the game would be installed. Then I had to add my user to the games group and reboot.

This is a diff of my hints/linux file that worked.

diff --git a/sys/unix/hints/linux b/sys/unix/hints/linux
index 1d9c455..639ad27 100644
--- a/sys/unix/hints/linux
+++ b/sys/unix/hints/linux
@@ -9,13 +9,15 @@
# for Ubuntu dapper.
-#PREFIX=/usr
-PREFIX=$(wildcard ~)/nh/install
-HACKDIR=$(PREFIX)/games/lib/$(GAME)dir
+PREFIX=/usr
+#PREFIX=$(wildcard ~)/nh/install
+HACKDIR=$(PREFIX)/lib/games/nethack
SHELLDIR = $(PREFIX)/games
INSTDIR=$(HACKDIR)
VARDIR = $(HACKDIR)
+GAMEUID = games
+GAMEGRP = games


POSTINSTALL=cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP)  $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
@@ -49,9 +51,9 @@ WINLIB = $(WINTTYLIB) $(WINCURSESLIB)
WINTTYLIB=-lcurses
-CHOWN=true
-CHGRP=true
+CHOWN=chown
+CHGRP=chgrp

 VARDIRPERM = 0755
-VARFILEPERM = 0600
-GAMEPERM = 0755
+VARFILEPERM = 0664
+GAMEPERM = 2755

--Maddoxej (talk) 16:31, 28 July 2019 (UTC)

Compiling with GUI

How do you compile the Windows GUI version via the makefile rather than using Visual C (3.6.4)? What needs to be changed in the makefile and/or the other provided files? -SuperJedi224 (talk) 12:07, 17 January 2020 (UTC)

Compiling older versions

Recently, I was feeling nostalgic and wanted to play 3.0.8, since it was the first version I ever played, so I downloaded the source, but I don't know how to compile it. Is there a guide for that anywhere? --Kahran042 (talk) 00:39, 1 May 2020 (UTC)