mrichards42 / xword

Cross-platform crossword solving
https://mrichards42.github.io/xword/
GNU General Public License v3.0
42 stars 13 forks source link

Request: recipe and specs for building on linux #211

Closed edsantiago closed 9 months ago

edsantiago commented 9 months ago

I've been trying off and on to build this for several months, with no luck. Ubuntu, Fedora, using distro wxgtk (3.2) and build-wxwidgets (3.1.3), gcc and clang, I can no longer remember everything I've tried. (And yes, of course I've been using @jpd236's linux branch all this time, since before it merged).

First symptom is a ton of towlower() errors, easily fixed by adding #include <cwctype> to puz/puzstring.cpp. Subsequent error is

../../puz/puzstring.cpp:194:14: error: explicit qualification in declaration of 'bool puz::can_encode_puz(const string_t&)'
  194 | PUZ_API bool puz::can_encode_puz(const string_t & str) {
      |              ^~~
make[1]: *** [puz.make:213: obj/Debug/puz/puzstring.o] Error 1

Request for anyone who has done a successful Linux build: could you please post your environment (distro, compiler, libraries, and their versions) and (bonus) a recipe of commands to run?

FWIW this is my Containerfile

FROM docker.io/library/ubuntu:23.10
ENV DISPLAY=:0.0
RUN apt update && apt-get -y --no-install-recommends install gcc g++ libgtk-3-dev curl bzip2 patch make zlib1g-dev liblua5.1-0-dev libexpat-dev libcurl4-nss-dev ca-certificates
COPY . /home/xword
WORKDIR /home/xword

...and this is the latest I've tried running (via podman run -it):

# ./build-wxwidgets.sh 3.2.0 Release
# ./premake5-linux --wx-config=/root/wx*/bin/wx-config --wx-config-release=/root/wx*/bin/wx-config --wx-prefix=/root/wx* gmake
# cd build/gmake && make
...barfs, see above

Thanks in advance.

jpd236 commented 9 months ago

It's been a long time since I looked at this. But I was last able to get someone on a working build at https://github.com/mrichards42/xword/issues/126.

can_encode_puz was added in July 2021 (here), whereas the successful build in that bug was in 2020. So this may be a legitimate Linux-specific issue that my patch doesn't cover, rather than a build environment issue. At a glance, you may just need to remove the puz:: from that line (ref) - there's some evidence that Windows doesn't care about this but Linux does.

Otherwise, I think you have the right idea - I've had luck with Ubuntu (the linked user used 20.04)'s standard build chain and wxWidgets 3.1.5 built from source using build-wxwidgets.sh as a foundation. After building, the executable is in bin/Debug/XWord, and some manual tweaks to the directory structure are needed per the "Fix the Linux build." commit description.

I don't have a Linux machine handy at the moment to test again myself, but hopefully that gives something to go on?

edsantiago commented 9 months ago

Thank you! Your hints got me past the hump. I now have a working container image build, which I've used on yesterday's AV Club crossword.

I took the liberty of submitting a PR against your fork: https://github.com/jpd236/xword/pull/1. No need to accept it; I'm just doing so because it might be helpful to other Linux people down the road. Again, many thanks.