Skip to content

Commit 4d7266c

Browse files
fntlnzclaude
andauthored
claude instructions on how to patch criu (#9)
* chore: add .worktrees/ to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: claude instructions on how to patch criu --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 21862ac commit 4d7266c

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ _CPack_Packages
66
.idea/
77
*.swp
88
*.swo
9+
.worktrees/

CLAUDE.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,43 @@ sudo cmake --install build
2727
cpack --config build/CPackConfig.cmake --verbose -B dist -G STGZ
2828
```
2929

30+
### Patching CRIU
31+
32+
We are patching criu with the patches in the `patches/` folder.
33+
From time to time we will need to update the CRIU version in our CMakeLists.txt.
34+
35+
To make sure that everything works, you can clone criu in `/tmp/criu` via
36+
37+
```bash
38+
git clone https://github.com/checkpoint-restore/criu.git /tmp/criu
39+
```
40+
41+
Then ask the user which version they want to try to update criu-static to.
42+
43+
Once you have done that change the git commit to the version that the user wants to test.
44+
45+
Now apply the patches in `patches` one by one making sure that criu builds.
46+
47+
To build criu, however you have to first obtain all the dependencies, but not any dependency. You want
48+
the same dependencies that criu-static uses. criu-static patches criu to use CFLAGS and LDFLAGS
49+
and other env variables instead of pkg-cinfig, you can inspect what it does by checking `CMakeLists.txt`
50+
That `CMakeLists.txt` will output the env vars you have to use, it will become something like (paths might be wrong, double check, this was in a devcontainer!)
51+
52+
```bash
53+
export CFLAGS="-I/workspaces/criu-static/build/protobuf-c-install/include -DCONFIG_HAS_NFTABLES_LIB_API_1 -I/workspaces/criu-static/build/protobuf-install/include -I/workspaces/criu-static/build/libnet-install/include -D_BSD_SOUR
54+
CE -D_DEFAULT_SOURCE -DHAVE_NET_ETHERNET_H -I/workspaces/criu-static/build/libnl-install/include -I/workspaces/criu-static/build/libnl-install/include/libnl3 -I/workspaces/criu-static/build/libcap-install/include -I/workspaces/criu-static/build/libaio-insta
55+
ll/include -I/workspaces/criu-static/build/zlib-install/include -I/workspaces/criu-static/build/libnftables-install/include -I/workspaces/criu-static/build/libnftnl-install/include -I/workspaces/criu-static/build/libmnl-install/include -I/workspaces/criu-st
56+
atic/build/util-linux-install/include -I/workspaces/criu-static/build/libintl-install/include"
57+
export LDFLAGS="-static -L/workspaces/criu-static/build/protobuf-c-install/lib -lprotobuf-c -L/workspaces/criu-static/build/protobuf-install/lib -lprotobuf -L/workspaces/criu-static/build/libnet-install/lib -lnet -L/workspa
58+
ces/criu-static/build/libnl-install/lib -lnl-3 -L/workspaces/criu-static/build/libcap-install/lib -lcap -L/workspaces/criu-static/build/libaio-install/lib -laio -L/workspaces/criu-static/build/zlib-install/lib -lz -L/workspaces/criu-static/build/libnftables
59+
-install/lib -lnftables -L/workspaces/criu-static/build/libnftnl-install/lib -lnftnl -L/workspaces/criu-static/build/libmnl-install/lib -lmnl -L/workspaces/criu-static/build/util-linux-install/lib -luuid -L/workspaces/criu-static/build/libintl-install/lib -
60+
lintl"
61+
```
62+
63+
plus all other env vars like CONFIG_AMDGPU, STATIC_PLUGINS, CUDA_PLUGIN_LIBCAP_CFLAGS but double check the cmake file to see what you have to pass.
64+
65+
66+
3067
### Alternative presets
3168
- `static-debug` - Debug build with debug symbols
3269
- `static-release` - Release build (default, optimized)
@@ -72,4 +109,4 @@ The build enables static plugins (STATIC_PLUGINS=y) and specifically compiles th
72109

73110
### License Management
74111

75-
The build system automatically tracks all dependency licenses and consolidates them into `THIRD-PARTY-LICENSES.txt` for distribution compliance.
112+
The build system automatically tracks all dependency licenses and consolidates them into `THIRD-PARTY-LICENSES.txt` for distribution compliance.

0 commit comments

Comments
 (0)