Skip to content

Commit d762c45

Browse files
Fix assets conversion bug. Add running with docker docs
Using Cython < 3.0.10 leads to the runtime errors on assets conversion. Cython >= 3.0.10 shall be used. Update docker build file and add chapter in documentation about running image with Docker. Issue: SFTtech#1766
1 parent e97617a commit d762c45

File tree

6 files changed

+96
-10
lines changed

6 files changed

+96
-10
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
3939

4040
# Python and Cython requirements
4141
set(PYTHON_MIN_VERSION 3.9)
42-
set(CYTHON_MIN_VERSION 0.29.31)
42+
set(CYTHON_MIN_VERSION 3.0.10)
4343

4444
# CMake policies
4545
foreach(pol

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ Quickstart
127127
make
128128
```
129129

130+
**Alternative approach:**
131+
You can build and run the project using Docker. See [Running with docker](/doc/build_instructions/docker.md) for more details.
132+
130133
* **I compiled everything. Now how do I run it?**
131134
* Execute `cd bin && ./run main`.
132135
* [The convert script](/doc/media_convert.md) will transform original assets into openage formats, which are a lot saner and more moddable.
@@ -145,7 +148,6 @@ To turn them off, use `./bin/run --dont-segfault --no-errors --dont-eat-dog`.
145148
If this still does not help, try our [troubleshooting guide](/doc/troubleshooting.md), the [contact section](#contact)
146149
or the [bug tracker](https://github.com/SFTtech/openage/issues).
147150

148-
149151
Contributing
150152
============
151153

doc/build_instructions/docker.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
### Running with Docker
2+
3+
Docker simplifies the setup process by providing a consistent development environment. It allows you to build and run the project without manually installing dependencies. Currently provided [Dockerfile.ubuntu.2404](../../packaging/docker/devenv/Dockerfile.ubuntu.2404) supports Ubuntu 24.04 as the base operating system.
4+
5+
#### Prerequisites
6+
7+
- **Docker**: Ensure Docker is installed on your machine. Follow the [official documentation](https://docs.docker.com/) for installation instructions.
8+
- **Display Server**: This guide supports both **X11** and **Wayland** display servers for GUI applications.
9+
- **Tested Configuration**: These instructions were tested on Ubuntu 24.04 running on WSL2 on Windows 11.
10+
11+
---
12+
13+
#### Steps to Build and Run
14+
15+
1. **Enable GUI Support**
16+
17+
Depending on your display server, follow the appropriate steps:
18+
19+
- **For X11**:
20+
Allow the Docker container to access your X server:
21+
```bash
22+
xhost +local:root
23+
```
24+
25+
- **For Wayland**:
26+
Allow the Docker container to access your Wayland socket:
27+
```bash
28+
sudo chmod a+rw /run/user/$(id -u)/wayland-0
29+
```
30+
31+
2. **Build the Docker Image**
32+
33+
Build the Docker image using the provided Dockerfile:
34+
```bash
35+
sudo docker build -t openage -f packaging/docker/devenv/Dockerfile.ubuntu.2404 .
36+
```
37+
38+
3. **Run the Docker Container**
39+
40+
Start the Docker container with the appropriate configuration for your display server:
41+
42+
- **For X11**:
43+
```bash
44+
docker run -it \
45+
-e DISPLAY=$DISPLAY \
46+
-v /tmp/.X11-unix:/tmp/.X11-unix \
47+
-v $HOME/.Xauthority:/root/.Xauthority \
48+
--network host openage
49+
```
50+
51+
- **For Wayland**:
52+
```bash
53+
docker run -it \
54+
-e XDG_RUNTIME_DIR=/tmp \
55+
-e QT_QPA_PLATFORM=wayland \
56+
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
57+
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
58+
--user=$(id -u):$(id -g) \
59+
--network host openage
60+
```
61+
62+
4. **Follow the Regular Setup**
63+
64+
Once inside the container, follow the regular setup described in the [Development](../building.md#development) chapter. You can skip dependency installation since the Docker image already includes all required dependencies.
65+
66+
---
67+
68+
#### Notes
69+
70+
- **X11 vs. Wayland**: Ensure you know which display server your system is using. Most modern Linux distributions default to Wayland, but X11 is still widely used.
71+
- **Permissions**: For Wayland, you may need to adjust permissions for the Wayland socket (`/run/user/$(id -u)/wayland-0`) to allow Docker access.
72+
- **GUI Applications**: These configurations enable GUI applications to run inside the Docker container.
73+
74+
---
75+
76+
By following these steps, you can build and run the `openage` project in a
77+
Dockerized environment with support X11 or Wayland display servers.

doc/build_instructions/ubuntu.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22

33
Run the following commands:
44

5-
- `sudo apt-get update`
6-
- `sudo apt-get install g++ cmake cython3 libeigen3-dev libepoxy-dev libfontconfig1-dev libfreetype-dev libharfbuzz-dev libogg-dev libopus-dev libopusfile-dev libpng-dev libtoml11-dev python3-dev python3-mako python3-numpy python3-lz4 python3-pil python3-pip python3-pygments python3-toml qml6-module-qtquick-controls qt6-declarative-dev qt6-multimedia-dev qml6-module-qtquick3d-spatialaudio`
5+
```bash
6+
sudo apt-get update
7+
sudo apt-get install g++ cmake cython3 libeigen3-dev libepoxy-dev libfontconfig1-dev libfreetype-dev libharfbuzz-dev libogg-dev libopus-dev libopusfile-dev libpng-dev libtoml11-dev python3-dev python3-mako python3-numpy python3-lz4 python3-pil python3-pip python3-pygments python3-toml qml6-module-qtquick-controls qt6-declarative-dev qt6-multimedia-dev qml6-module-qtquick3d-spatialaudio
8+
```
79

810
You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
911

10-
# Additional steps for Ubuntu 22.04 LTS
12+
# Additional steps for Ubuntu 22.04 LTS & 24.04 LTS
1113

12-
The available system version of Cython is too old in Ubuntu 22.04. You have to get the correct version
14+
The available system version of Cython is too old in Ubuntu 22.04 & 24.04. You have to get the correct version
1315
from pip:
1416

15-
```
17+
```bash
1618
pip3 install cython --break-system-packages
1719
```
1820

21+
Please note that project requires at least **Cython 3.0.10**.
22+
1923
# Linux Mint Issue
2024
Linux Mint has a [problem with `toml11`](https://github.com/SFTtech/openage/issues/1601), since CMake can't find it. To solve this, download the [toml11.zip](https://github.com/SFTtech/openage/files/13401192/toml11.zip), after, put the files in the `/usr/lib/x86_64-linux-gnu/cmake/toml11` path. (if the `toml11` directory doesn't exist, create it)

doc/building.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Dependency list:
2929

3030
C gcc >=10 or clang >=10
3131
CRA python >=3.9
32-
C cython >=0.29.31
32+
C cython >=3.0.10
3333
C cmake >=3.16
3434
A numpy
3535
A lz4
@@ -161,7 +161,6 @@ The reference package is [created for Gentoo](https://github.com/SFTtech/gentoo-
161161
- Use `make install DESTDIR=/tmp/your_temporary_packaging_dir`,
162162
which will then be packed/installed by your package manager.
163163

164-
165164
### Troubleshooting
166165

167166
- I wanna see compiler invocations

packaging/docker/devenv/Dockerfile.ubuntu.2404

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@ RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y sudo \
3636
qt6-multimedia-dev \
3737
qml6-module-qtquick3d-spatialaudio \
3838
&& sudo apt-get clean \
39-
&& truncate -s 0 ~/.bash_history
39+
&& truncate -s 0 ~/.bash_history
40+
41+
# At least cython >= 3.0.10 < 4.0.0 is required to avoid runtime errors
42+
# TODO: Remove this line once cython is upgraded in Ubuntu 24.04.3 (expected around August 2025)
43+
RUN pip install "cython>=3.0.10,<4.0.0" --break-system-packages

0 commit comments

Comments
 (0)