Experimental build on mac is broken

can someone with a mac please try building the latest version from github? I need help to figure out if it is just me or the result of a recent change.

The make command looks something like this:

make NATIVE=osx RELEASE=1 LDFLAGS=’ -L/usr/lib -lncurses -liconv -F/System/Library/Frameworks/ -framework CoreFoundation -framework Cocoa /usr/local/Cellar/gettext/0.18.2/lib/libgettextpo.a /usr/local/Cellar/gettext/0.18.2/lib/libasprintf.a /usr/local/Cellar/gettext/0.18.2/lib/libintl.a’ CXXFLAGS=’-O3 -I/usr/local/opt/gettext/include’

I had to manually add LDFLAGS and CXXFLAGS, not sure how to avoid that. When trying to run the game, I get:

$ ./cataclysm
Segmentation fault: 11

Any help is much appreciated.

EDIT: for now I have gone back to an October 1st build, which works fine.


We have a memory problem somewhere. The experimental build compiles, but when run, it segfaults before ever showing the splash screen. I’ve tried starting fresh to make sure that save files are not an issue, but no luck.

Build command follows the instructions exactly:
make clean &&
export CXXFLAGS=’-I/usr/local/opt/gettext/include’ &&
export LDFLAGS=’-L/usr/local/Cellar/gettext/0.18.2/lib/’ &&

Is there a good way to track it down to a specific commit? Does someone have a script or good tips on using git to debug? I think it would take hours to manually find commit hashes, fetch them, build, and test. I know the Oct. 1 build works. I know the Oct 8 build fails.

Also, can anyone reproduce this? Build curses version, run ./cataclysm.

There’s a MAGICAL git command called bisect:
From your working directory, do
git bisect start
git bisect bad
(marks current commit as bad)
git bisect good
The SHA1 is that long number displayed with the commit when you do git log, like:
commit 39f8955f1dfb73415a8a8b7e9bbb46703795db7a
After you have both a good and bad commit marked, it will check out a commit in the middle.
Compile and test it.
If good:
git bisect good
if bad:
git bisect bad
If some DIFFERENT bug keeps you from checking for the bug you’re looking for:
git bisect skip
It will keep checking out commits for you to test until it finds the first bad commit, or you skip every commit in a range.

Wow, bisect is awesome. Thanks, Kevin. And the winner is:

Cataclysm-DDA ((no branch))$ git bisect bad
51af914b18b153c38d487d8a8d066d7133743d4b is the first bad commit
commit 51af914b18b153c38d487d8a8d066d7133743d4b
Author: C0DEHERO codehero@nerdpol.ch
Date: Sat Oct 5 11:34:48 2013 -0400

Added tileset option to the option menu. The options will be populated dynamically with the tilesets in gfx/. Tilesets should be in their own folder and should have a tileset.tif. Examples of those tileset.tif are in the tileset folders in gfx/

:100644 100644 2aa1d1c68a536b2aa41ef6dabd10631741ea5192 b96cb1ae387e9ba4b018e2c76ea7a4a7d28b7758 M cata_tiles.cpp
:100644 100644 7c001b66a56b734f1969daf9f5523c30c68f9ec3 e800dc4146b3421a68465abf245d978293036aaf M cata_tiles.h
:040000 040000 c73e803cfa62d78d6246c6f6018eb6edb20c45d6 6bf3848be7b7b4d2df4b18f34e79fde67ed60d01 M data
:040000 040000 ca212df6f758a8283e9e6748880701d5b10754db e14e0a695c4cf44efbd5c4e2cf58b06b1fa3ef5b M gfx
:100644 100644 48f82b30bc2b7cf86daa3da2684d7ff9093af29c cb5c87f08b26201c0a54541d24d798be60fc9507 M options.cpp
:100644 100644 6ca21223a04d7669b46e39eee30dd391f0b73a3a c778ceb1b60ff944758bbc7af6d450a1c86a3ea6 M options.h
:100644 100644 6102b34964a786711f7eaad263b6d96ee8b44e29 4255525eafc1b6d94651c07032bd8eda83f20a2c M sdltiles.cpp

So where do we go from here? I was looking at the commit, and a big chunk of it is reading in filenames. I wonder if the approach used is Windows specific somehow. Or it could be that there is some sort of implicit assumption that SDL is being used that causes a break in the non-SDL version.

Anyone see what’s going on? Thanks in advance!

EDIT: I figured out how to use gdb a little. Here is the backtrace:

(gdb) backtrace
#0 0x00007fff8a736162 in closedir ()
#1 0x00000001001a8b5a in file_finder::get_files_from_path (extension=@0x7fff5fbfa4f8, root_path=@0x7fff5fbfa4f0, recursive_search=true) at file_finder.cpp:73
#2 0x000000010084182c in get_tileset_names (dir_path=@0x7fff5fbfb738) at options.cpp:851
#3 0x00000001008447ef in initOptions () at options.cpp:315
#4 0x00000001004b38cb in main (argc=0, argv=0x7fff5fbff978) at main.cpp:66

EDIT2: stepping through

68 subdir = opendir(subpath.c_str());
69 if (subdir)
73 closedir(subdir);

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff8a736162 in closedir ()

The function successfully crawls Deon’s and Hoder’s tilesets. It dies when it gets to the end. It looks like subdir is an empty pointer:
(gdb) p subdir
$1 = (DIR *) 0x0

Thus the segfault.


I think this was a simple fix. PR is here