ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Dec 03, 2020 11:06 pm

All times are UTC




Post new topic Reply to topic  [ 326 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 22  Next
Author Message
 Post subject: Re: ToME 2 maintenance
PostPosted: Fri Jan 29, 2010 5:51 am 
Offline
Spiderkin

Joined: Sat Mar 18, 2006 12:48 pm
Posts: 482
That's a shame. Budswell, could you please try compiling by including the pstdint.h found here:

http://code.google.com/p/baseutils/sour ... /pstdint.h

instead of <stdint.h>? If it works, I'll include and use that instead (it automatically falls back to stdint.h where it's available).

Btw, my goal is to have the CMake build system also support building on Windows, so I basically just need someone to help figure out which compiler switches and such are needed on the VS compiler and CMake should be able to figure out the rest once I tell if to include the main-win.c frontend.

EDIT: Shame about stdint.h, I mean. :)


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Mon Feb 01, 2010 2:24 am 
Offline
Wayist

Joined: Sun Jan 31, 2010 3:55 pm
Posts: 23
Code:
$ make
Scanning dependencies of target lua
[  0%] Building C object src/lua/CMakeFiles/lua.dir/lapi.c.o
[  1%] Building C object src/lua/CMakeFiles/lua.dir/lcode.c.o
...
[ 35%] Generating w_quest.c
[ 36%] Generating w_dun.c
Scanning dependencies of target tome
[ 37%] Building C object src/CMakeFiles/tome.dir/main-gcu.c.o
[ 38%] Building C object src/CMakeFiles/tome.dir/main-x11.c.o
/home/kernigh/park/tome2-tome2/src/main-x11.c:100:22: X11/Xlib.h: No such file or directory
/home/kernigh/park/tome2-tome2/src/main-x11.c:101:23: X11/Xutil.h: No such file or directory
/home/kernigh/park/tome2-tome2/src/main-x11.c:102:24: X11/keysym.h: No such file or directory
/home/kernigh/park/tome2-tome2/src/main-x11.c:103:27: X11/keysymdef.h: No such file or directory
/home/kernigh/park/tome2-tome2/src/main-x11.c:104:23: X11/Xatom.h: No such file or directory
...
/home/kernigh/park/tome2-tome2/src/main-x11.c:3277: error: `ZPixmap' undeclared (first use in this function)
*** Error code 1

Stop in /home/kernigh/park/tome2-tome2/work (line 78 of src/CMakeFiles/tome.dir/build.make).
*** Error code 1

Stop in /home/kernigh/park/tome2-tome2/work (line 79 of CMakeFiles/Makefile2).
*** Error code 1

Stop in /home/kernigh/park/tome2-tome2/work (line 113 of Makefile).
$


This is a day in the life of Kernigh, an OpenBSD user. I try to build ToME, but fail with the above error message, because something forgot to find my X11 header files in /usr/X11R6/include. (OpenBSD clings to an old custom, and thus has X11R7 in /usr/X11R6.)

I have not played ToME for two years. Agrelaa the High-Elf Loremaster was my last character. Agrelaa survived level 35 of the Helcaraxe, when I stopped playing at January 2008. I lost my save file and my ToME executable. I want to start a new character, so I must build another ToME executable.

I came at http://gitorious.org/tome2/tome2, but I had no way to clone the repository. (I have Cvs, Subversion and Mercurial but not Git.) I wanted to download a snapshot of the source code. I clicked "Source tree", then "Download master as tar.gz". I extracted my snapshot from 31 January 2010 into a directory named tome2-tome2, and started an out-of-source build.

Code:
$ cd tome2-tome2
$ mkdir work
$ cd work
$ cmake ..
...
$ make


So I have this error, because something forgot to find my X11 header files in /usr/X11R6/include. I am lucky that this is a CMake project. I know CMake (since the year 2007), so I might fix the listfile.

The top-level CMakeLists.txt invokes FIND_PACKAGE(X11) and then INCLUDE_DIRECTORIES(${X11_INCLUDE_DIRS}). This is a typo, because cmake --help-module FindX11 says to use X11_INCLUDE_DIR (without the S).

I fix the typo, reconfigure and restart the build.

Code:
[ 39%] Building C object src/CMakeFiles/tome.dir/main-sdl.c.o
In file included from /usr/local/include/SDL/SDL_main.h:26,
                 from /usr/local/include/SDL/SDL.h:28,
                 from /home/kernigh/park/tome2-tome2/src/main-sdl.c:29:
/usr/local/include/SDL/SDL_stdinc.h:72:20: iconv.h: No such file or directory
/home/kernigh/park/tome2-tome2/src/main-sdl.c:31:21: SDL_ttf.h: No such file or directory
...
Stop in /home/kernigh/park/tome2-tome2/work (line 113 of Makefile).


This new error happens because the listfile enables the SDL interface of ToME, though I have no SDL_ttf library. The listfile now uses FIND_PACKAGE(SDL_ttf REQUIRED), but the FindSDL_ttf.cmake module (that comes with CMake 2.8.0) ignores the REQUIRED clause. If the module fails to find the library, then nothing happens.

I would install SDL_ttf, but I prefer to teach the listfile to disable the SDL interface if there is no SDL_ttf. I edit the top-level CMakeLists.txt, and reconfigure.

Code:
$ cmake .
-- Found SDL and SDL_image, but not SDL_ttf!
-- Enabled features:
X11
Threads
SDL , not enabled
Curses

-- Configuring done
-- Generating done
-- Build files have been written to: /home/kernigh/park/tome2-tome2/work


There is no way to remove SDL from the list under "Enabled features". My workaround is to put a "not enabled" note. I can now do almost an entire build.

Code:
[ 28%] Generating w_mnster.c
...
[ 92%] Generating w_mnster.c
[ 92%] Building C object src/CMakeFiles/tome.dir/w_mnster.c.o
gcc: /home/kernigh/park/tome2-tome2/work/src/w_mnster.c: No such file or directory
gcc: no input files
*** Error code 1


The build fails after twice generating w_msnter.c, yet failing to find the generated file. This is a familiar problem with custom rules and out-of-source builds. The custom rule wants to put w_mnster.c in the object directory, but the tolua command puts w_mnster.c in the source directory.

I edit src/CMakeLists.txt until I have a rule that seems to work.

Code:
Linking C executable tome
...
ld: warning: libICE.so.9.0, needed by /usr/X11R6/lib/libSM.so.8.0, not found (try using -rpath or -rpath-link)
ld: warning: libXau.so.9.0, needed by /usr/X11R6/lib/libX11.so.11.2, not found (try using -rpath or -rpath-link)
ld: warning: libXdmcp.so.9.0, needed by /usr/X11R6/lib/libX11.so.11.2, not found (try using -rpath or -rpath-link)
ld: warning: libX11.so.11.2, needed by /usr/X11R6/lib/libXext.so.10.0, not found (try using -rpath or -rpath-link)
/usr/X11R6/lib/libX11.so.11.2: undefined reference to `XdmcpWrap'
/usr/X11R6/lib/libX11.so.11.2: undefined reference to `XauGetBestAuthByAddr'
/usr/X11R6/lib/libX11.so.11.2: undefined reference to `XauDisposeAuth'
*** Error code 1


This only means that FindX11.cmake (which comes with CMake 2.8.0) is not compatible with my OpenBSD system. For now, my workaround is to insert an -L/usr/X11R6/lib in the command line. I edit to CMakeCache.txt, changing

Code:
//Path to a library.
X11_SM_LIB:FILEPATH=/usr/X11R6/lib/libSM.so.8.0


to

Code:
//Path to a library.
X11_SM_LIB:FILEPATH=-L/usr/X11R6/lib;/usr/X11R6/lib/libSM.so.8.0


which is a temporary fix for the moment. I reconfigure and rebuild.

Code:
[100%] Built target tome
$


I now have an actual tome executable, so I try to run it.

Code:
$ cd ..
$ work/src/tome


The window appears, then disappears. I try work/src/tome -mgcu, but the program appears, draws the title screen, then disappears. My ToME executable always exits (with status 0) soon after start.

Code:
$ gdb work/src/tome
GNU gdb 6.3
...
(gdb) run
...
Program received signal SIGSEGV, Segmentation fault.
0x01a4ee80 in lua_tonumber ()
(gdb) continue
Continuing.

Program exited normally.
(gdb)


gdb reveals that ToME segfaults. The ToME crash handler disguises the segfault as a normal exit, but gdb reveals the signal.

This segfault seems too familiar. More than four years ago, at 29 May 2006, I wrote BugReport615 on the wiki. I now read my own bug report, and wonder if the same fix would work now.

I edit src/lua/lapi.c, by my own instructions in the bug report four years ago, and rebuild.

The game seems to work now. "Art thou an adventurer, One who passes through the waterfalls we call danger to find the true nature of the legends beyond them? If this is so, then seeketh me."

I defer the creation of a character until later, after I will review some spoilers.

Here follows the diff of my changes.

Code:
--- CMakeLists.txt.orig   Mon Jan 18 16:13:46 2010
+++ CMakeLists.txt   Sun Jan 31 18:40:07 2010
@@ -27,7 +27,7 @@
 IF(X11_FOUND)
   # Add X11 flags/options
   ADD_DEFINITIONS(-DUSE_X11)
-  INCLUDE_DIRECTORIES(${X11_INCLUDE_DIRS})
+  INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
   SET(LIBS ${LIBS} ${X11_LIBRARIES})
 ENDIF()
 
@@ -36,21 +36,27 @@
 #
 FIND_PACKAGE(SDL)
 IF(SDL_FOUND)
-  # Add SDL flags/options
-  ADD_DEFINITIONS(-DUSE_SDL)
-  INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
-  SET(LIBS ${LIBS} ${SDL_LIBRARY})
-  # SDL_image is also required
-  FIND_PACKAGE(SDL_image REQUIRED)
-  IF(SDLIMAGE_FOUND)
-    INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
-    SET(LIBS ${LIBS} ${SDLIMAGE_LIBRARY})
-  ENDIF()
-  # SDL_ttf is also required
-  FIND_PACKAGE(SDL_ttf REQUIRED)
-  IF(SDLTTF_FOUND)
-    INCLUDE_DIRECTORIES(${SDLTTF_INCLUDE_DIR})
-    SET(LIBS ${LIBS} ${SDLTTF_LIBRARY})
+  # the SDL port also requires SDL_image and SDL_ttf
+  FIND_PACKAGE(SDL_image)
+  FIND_PACKAGE(SDL_ttf)
+  IF(SDLIMAGE_FOUND AND SDL_TTF_FOUND)
+    # Add SDL flags/options
+    ADD_DEFINITIONS(-DUSE_SDL)
+    INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR}
+      ${SDLIMAGE_INCLUDE_DIR} ${SDLTTF_INCLUDE_DIR})
+    SET(LIBS ${LIBS}
+      ${SDLIMAGE_LIBRARY} ${SDLTTF_LIBRARY} ${SDL_LIBRARY})
+  ELSE()
+    # proceed without enabling the SDL port
+    IF(SDLIMAGE_FOUND)
+      MESSAGE(STATUS "Found SDL and SDL_image, but not SDL_ttf!")
+    ELSEIF(SDLTTF_FOUND)
+      MESSAGE(STATUS "Found SDL and SDL_ttf, but not SDL_image!")
+    ELSE()
+      MESSAGE(STATUS "Found SDL, but not SDL_image nor SDL_ttf!")
+    ENDIF()
+    # add info about finding but not enabling SDL
+    SET_FEATURE_INFO(SDL "not enabled")
   ENDIF()
 ENDIF()
 
--- src/CMakeLists.txt.orig   Mon Jan 18 16:13:46 2010
+++ src/CMakeLists.txt   Sun Jan 31 19:57:03 2010
@@ -5,7 +5,9 @@
 MACRO(TOLUA_FILE MODULE_NAME OUTPUT_FILE_NAME)
   ADD_CUSTOM_COMMAND(
     OUTPUT ${OUTPUT_FILE_NAME}
-    COMMAND tolua -n ${MODULE_NAME} -o ${CMAKE_CURRENT_SOURCE_DIR}/${OUTPUT_FILE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}.pkg
+    COMMAND tolua -n ${MODULE_NAME}
+      -o ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE_NAME}
+      ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}.pkg
     DEPENDS tolua ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}.pkg
     )
   SET_SOURCE_FILES_PROPERTIES("${OUTPUT_FILE_NAME}" PROPERTIES GENERATED TRUE)
@@ -23,7 +25,8 @@
 TOLUA_FILE(dungeon w_dun.c)
 
 # tome executable
-INCLUDE_DIRECTORIES(lua)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lua)
 ADD_EXECUTABLE(tome main-gcu.c main-x11.c main-xaw.c main-sdl.c
   z-rand.c z-util.c z-form.c z-virt.c z-term.c z-sock.c
   variable.c tables.c plots.c util.c cave.c dungeon.c
--- src/lua/lapi.c.orig   Mon Jan 18 16:13:46 2010
+++ src/lua/lapi.c   Sun Jan 31 20:54:18 2010
@@ -40,12 +40,17 @@
 
 
 static TObject *luaA_indexAcceptable (lua_State *L, int index) {
-  if (index >= 0) {
+  if (index == 0) {
+    return NULL;
+  } else if (index > 0) {
     TObject *o = L->Cbase+(index-1);
     if (o >= L->top) return NULL;
     else return o;
+  } else {
+    TObject *o = L->top+index;
+    if (o < L->Cbase) return NULL;
+    else return o;
   }
-  else return L->top+index;
 }
 
 


If I ever download a later snapshot, and I want to build another ToME executable, then I need to make all changes in the above diff, and also use my -L/usr/X11R6/lib workaround.

This was the day in the life of an OpenBSD user in the adventure to overcome the troubles of portability, to build the Troubles Of Middle-Earth.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Tue Feb 02, 2010 8:07 pm 
Offline
Uruivellas

Joined: Tue Dec 13, 2005 12:35 am
Posts: 709
Okay, I get this when building with cmake:

Code:
gcc: /home/proteus/Games/tome2/w_mnster.c: No such file or directory
gcc: no input files
make[2]: *** [CMakeFiles/tome.dir/w_mnster.o] Error 1
make[1]: *** [CMakeFiles/tome.dir/all] Error 2
make: *** [all] Error 2


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Thu Feb 04, 2010 9:58 am 
Offline
Spiderkin

Joined: Sat Mar 18, 2006 12:48 pm
Posts: 482
Kernigh, all your fixes have been pushed to the repo. Thank you very much for all the hard work.

Just out of curiousity: Do you know if anyone has submitted a bug report for the -L switch problem with FindX11.cmake on OpenBSD? I don't think I'm going to try to carry around workarounds for such things in the CMake files in the ToME repo, but if this isn't like to get fixed upstream, then I'd be happy to add a little note to building.txt for now.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Thu Feb 04, 2010 9:59 am 
Offline
Spiderkin

Joined: Sat Mar 18, 2006 12:48 pm
Posts: 482
Lord Estraven, did you do an out-of-source build? (I'm guessing that is the case from the error message.)

If so, this was broken (as Kernigh also noted), but has been fixed as a few minutes ago.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Fri Feb 05, 2010 1:23 am 
Offline
Wayist

Joined: Sun Jan 31, 2010 3:55 pm
Posts: 23
AnonymousHero wrote:
Just out of curiousity: Do you know if anyone has submitted a bug report for the -L switch problem with FindX11.cmake on OpenBSD? I don't think I'm going to try to carry around workarounds for such things in the CMake files in the ToME repo, but if this isn't like to get fixed upstream, then I'd be happy to add a little note to building.txt for now.


I look around the CMake bug tracker, but see no such bug report. I have not yet added a bug report, but I might later write a bug report. Upstream has fixed other bugs (like bug 3470), so they might fix this bug.

In building.txt, you might want to say what minimum version of CMake to use, and where to get it (http://www.cmake.org/cmake/resources/software.html). This will warn anyone who tries to use the OpenBSD package of CMake 2.4.8 with your 2.6 listfile.

I found an easier way to insert the -L/usr/X11R6/lib. The note for OpenBSD might say:

Code:
Compiling on OpenBSD
====================

As of February 2010, the OpenBSD package cmake-2.4.8p2 is too old for
building ToME. You may need to compile a newer version of CMake.

If you have X11, then a bug in CMake may cause a linker error when
linking the 'tome' executable. As a workaround, set the environment
variable LDFLAGS=-L/usr/X11R6/lib when running CMake. Example:

       $ env LDFLAGS=-L/usr/X11R6/lib cmake .
       $ make

The SDL frontend also requires these packages: sdl-image, sdl-ttf


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Fri Feb 05, 2010 5:06 pm 
Offline
Spiderkin

Joined: Sat Mar 18, 2006 12:48 pm
Posts: 482
I've added your notes to building.txt. Thanks for the copy.

EDIT: Ugh, I just noticed I forgot to credit you in the commit message. Sorry about that.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Mon Feb 08, 2010 6:05 pm 
Offline
Uruivellas

Joined: Tue Dec 13, 2005 12:35 am
Posts: 709
So... when do we get binary releases? :wink:


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Tue Feb 09, 2010 6:58 pm 
Offline
Spiderkin

Joined: Sat Mar 18, 2006 12:48 pm
Posts: 482
Are you still having trouble compiling?

Re: Binary releases: I don't really think binary releases make much sense of *nix and I don't have any way to compile on Windows :(.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Thu Feb 11, 2010 2:46 am 
Offline
Uruivellas

Joined: Tue Dec 13, 2005 12:35 am
Posts: 709
No problem compiling on *nix, it's just that Windows builds would be nice. (Especially seeing as Linux is becoming a real bugfest...)


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Sun Mar 07, 2010 10:39 pm 
Offline

Joined: Mon Mar 01, 2010 6:59 pm
Posts: 1
Hi

The Windows build from GIT repository is available here tome-2.3.8-git-win32.zip. Have fun, but keep in mind that is GIT build = UNTESTED. You have been warned.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Sat Mar 20, 2010 7:26 am 
Offline
Spiderkin

Joined: Sat Mar 18, 2006 12:48 pm
Posts: 482
Just though I'd mention it here: I've pushed an update to the build system which should allow anyone to build on Windows with MinGW (thanks to wino45 for doing most of the work).


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Wed Mar 31, 2010 11:22 pm 
Offline
Reaper

Joined: Mon Jan 22, 2007 6:31 pm
Posts: 1534
Location: East of the sun, west of the moon
just thought I would mention it here: building this on windows is fiendishly difficult, I have been trying for an hour or so, still got nothing to show for it... there is no really saying, you need to get cmake, etc, nor where to start building from, nor how to go about building it (your 2 lines of "how to" dont help much).

albeit, I have *never* compiled on windows before, only done it on unix/linux, so I dont know what I am doing.

_________________
Oliphant am I, and I never lie.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Wed Mar 31, 2010 11:27 pm 
Offline
Reaper

Joined: Wed Dec 12, 2007 12:21 am
Posts: 2257
Location: New Zealand
Go hereto compile on Windows...

Needs a bit of faffing around, but it is doable!

_________________
Regards

Jon.


Top
 Profile  
 
 Post subject: Re: ToME 2 maintenance
PostPosted: Thu Apr 01, 2010 2:31 am 
Offline
Reaper

Joined: Mon Jan 22, 2007 6:31 pm
Posts: 1534
Location: East of the sun, west of the moon
thanks, will try that later. (busy atm, hence, why I am on here... or rather, why am I on here...)

_________________
Oliphant am I, and I never lie.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 326 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 22  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group