Hi all,
I’m trying to compile the ancient version 0.18.2 on more recent Linux versions, but I’m running into problems, and since I’m not a C++ programmer at all, it’s got me stumped. I’ve even tried spinning up older Linux releases like Debian 10 to compile there, since I would assume the various libraries are also older. This is me just doing a full install using the directions in the INSTALL file. I’m also looking at the versions in the submodules, maybe there’s newer stuff in there screwing up the build? I notice that each release just refers to the latest submodule release, which might not be a good strategy going forward, even if that code doesn’t change.
I’m also looking to compile just the console version, no tiles or anything like that. Any hint or suggestions on what I should do would be helpful.
john@clarence-home:~/tmp/crawl/crawl-ref/source$ make
If you experience any problems building Crawl, please take a second look
at INSTALL.txt: the solution to your problem just might be in there!
rebuilding crawl: new build flags or prefix
TRACK_CFLAGS = x86_64-linux-gnu-gcc x86_64-linux-gnu-g++ -O2 -pipe -Wall -Wformat-security -Wundef L
OLD_CFLAGS = #EOL
util/art-data.pl
Generating art-data.h
Generating art-enum.h
Generating dc-unrand.txt
Generating tiledef-unrand.cc
GEN config.h
GEN mon-mst.h
make -C rltiles all ARCH=x86_64-linux-gnu TILES=
make[1]: Entering directory ‘/home/john/tmp/crawl/crawl-ref/source/rltiles’
rebuilding tilegen: new build flags or prefix
HOSTCXX tool/tile_colour.o
HOSTCXX tool/tile.o
tool/tile.cc: In member function ‘void tile::copy(const tile&)’:
tool/tile.cc:294:76: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of ty]
memcpy(m_pixels, img.m_pixels, m_width * m_height * sizeof(tile_colour));
^
In file included from tool/tile.h:4,
from tool/tile.cc:1:
tool/tile_colour.h:28:7: note: ‘class tile_colour’ declared here
class tile_colour
^~~~~~~~~~~
HOSTCXX tool/tile_page.o
HOSTCXX tool/tile_list_processor.o
HOSTCXX tool/main.o
HOSTLINK tool/tilegen.elf
GEN tiledef-main.h
GEN tiledef-dngn.h
GEN tiledef-floor.h
GEN tiledef-wall.h
GEN tiledef-feat.h
GEN tiledef-player.h
GEN tiledef-gui.h
GEN tiledef-icons.h
make[1]: Leaving directory ‘/home/john/tmp/crawl/crawl-ref/source/rltiles’
CXX ability.o
In file included from ability.cc:28:
describe.h:57:36: error: ‘function’ has not been declared
bool describe_item(item_def &item, function<void (string&)> fixup_desc = nullptr);
^~~~~~~~
^~~~~~~~
describe.h:57:44: error: expected ‘,’ or ‘…’ before ‘<’ token
bool describe_item(item_def &item, function<void (string&)> fixup_desc = nullptr);
^
In file included from directn.h:10,
from ability.cc:29:
mon-info.h:372:9: error: ‘function’ does not name a type; did you mean ‘union’?
typedef function<vector (const monster_info& mi)> (desc_filter);
^~~~~~~~
union
In file included from ability.cc:29:
directn.h:55:5: error: ‘desc_filter’ does not name a type; did you mean ‘message_filter’?
desc_filter get_desc_func; // Function to add relevant descriptions
^~~~~~~~~~~
message_filter
directn.h:94:5: error: ‘desc_filter’ does not name a type; did you mean ‘message_filter’?
desc_filter get_desc_func;
^~~~~~~~~~~
message_filter
directn.h: In constructor ‘direction_chooser_args::direction_chooser_args()’:
directn.h:109:9: error: class ‘direction_chooser_args’ does not have any field named ‘get_desc_func’
get_desc_func(nullptr),
^~~~~~~~~~~~~
In file included from monster.h:6,
from env.h:8,
from dungeon.h:14,
from ability.cc:30:
spl-util.h: At global scope:
spl-util.h:97:9: error: ‘function’ does not name a type; did you mean ‘union’?
typedef function<int (coord_def where)> cell_func;
^~~~~~~~
union
spl-util.h:98:9: error: ‘function’ does not name a type; did you mean ‘union’?
typedef function<int (monster* mon)> monster_func;
^~~~~~~~
union
spl-util.h:103:24: error: ‘cell_func’ was not declared in this scope
int apply_area_visible(cell_func cf, const coord_def& where);
^~~~~~~~~
spl-util.h:103:24: note: suggested alternative: ‘cloud_func’
int apply_area_visible(cell_func cf, const coord_def& where);
^~~~~~~~~
cloud_func
I haven’t tried this specific thing but I’d guess what could be happening here is that this code needs a specific c++ standard version to compile, maybe exactly c++11?. function should be defined in modern-ish c++ with #include <functional> but maybe it was happening in a different way back then. I’m not 100% sure which standard 0.18 would be on, but it does still compile on servers with c++11, so try forcing -std=c++11 somehow? (This will require editing the Makefile I think, add it to CFLAGS perhaps.)
so now I’m trying to spin up docker to try and run compiles inside there. God that’s sucking big time too. I’ve been looking at other threads on this as well, like this one:
Blech, my initial patch was corrupted when I pasted it in here. The basic idea was to just put an:
#include
into AppHdr.h, but I did re-work the patch to just put it into all the various .cc files which needed it. Some needed it earlier, some later. Quite annoying .
For domino.h I needed to add
#include
at the end of all the other <> incoludes.
but now it still blows up on me when I go down a level, I get a crash like this:
#####.##/home/john/.crawl/…/dat/des/portals/bailey.des:368: Couldn’t find a map for bailey_axe
so I’m obviously in a strange state here. I thought I had purged all the various crawl newer version files and such, but who knows? Time to chase this down some more with better debugging.
This is version 0.18.2 with my patches, on Debian 11 bullseye. using gcc 10.2.1 and now trying to compile using clang:
export GCC=clang
export GXX=clang++
make -j 16
$ ./crawl --version
Crawl version 0.18.3
Save file version 34.169
Compiled with GCC 10.2.1 20210110 on Sep 5 2023 at 17:15:24
Build platform: x86_64-linux-gnu
Platform: x86_64-linux-gnu
CFLAGS: -O2 -pipe -Wall -Wformat-security -Wundef -Wno-array-bounds -Wno-format-zero-length -Wmissing-declarations -Wredundant-decls -Wno-parentheses -Wwrite-strings -Wshadow -pedantic -Wuninitialized -Iutil -I. -isystem /usr/include/lua5.1 -Irltiles -DWIZARD -DASSERTS -DCLUA_BINDINGS -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
LDFLAGS: -rdynamic -fuse-ld=gold -O2
Possibly this could be worth backporting. I’d guess that it’s entirely possible to spin up a vm/docker instance with that old gcc version, but at this point you’d have to go back very far or do it explicitly.
Edit: also, if you are still getting the bailey error, you should reset the des cache (which I couldn’t 100% say where it is on linux, but near wherever your saves are).
I have backported the two commits I found as well as a macos-specific build fix to stone_soup-0.18 as a sort of proof of concept. I haven’t actually tested this on gcc (if anyone does, feel free to update this thread), but I have verified that console builds and runs on relatively current macos in clang.
(The contribs have definitely been updated since then, so I suspect that local tiles is unlikely to build without a bunch more work. Webtiles builds but crashes immediately; I’d guess this is mac-specific though.)