Skip to content

Commit 966098d

Browse files
authored
fix(build): accept GCC 12 for CUDA 12 compatibility (#1019)
* fix(build): accept GCC 12 for CUDA 12 compatibility, update docs The supraseal build.sh hard-required GCC 13, creating an impossible build situation for CUDA 12.0–12.5 users (nvcc rejects GCC 13, but build.sh rejects GCC 12). The supraseal codebase only uses C++17 features — no GCC 13-specific code. The GCC 13 requirement was a CI environment decision (Ubuntu 24.04 default), not a code requirement. Changes: - build.sh: accept both GCC 12 and GCC 13, prefer 13 then fall back to 12 - supraseal.md: document CUDA/GCC version pairing requirements - installation.md: update dependency notes for GCC 12/13 and CUDA versions CUDA / GCC compatibility (per NVIDIA docs): CUDA 12.0–12.5 → GCC up to 12.x CUDA 12.6+ → GCC up to 13.2 CUDA 13.0+ → GCC 13+ * docs: fix wording — batch sealing (not supraseal) in build note title
1 parent 0d3f1c6 commit 966098d

File tree

3 files changed

+85
-49
lines changed

3 files changed

+85
-49
lines changed

documentation/en/installation.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,15 @@ You will need the following software installed to install and run Curio.
5353
Building Curio requires some system dependencies, usually provided by your distribution.
5454

5555
{% hint style="warning" %}
56-
**Note (batch sealing now builds by default on Linux):** Curios Linux build chain now always builds `extern/supraseal` as part of the normal `make deps/build` flow. This means **building Curio on Linux requires batch sealing build dependencies**, including:
56+
**Note (batch sealing now builds by default on Linux):** Curio's Linux build now compiles `extern/supraseal` as part of the standard `make build` flow (needed for SnapDeals fast TreeR and batch sealing). This adds the following build requirements:
5757
58-
- CUDA Toolkit **13.x or newer** (needs `nvcc`, even if you won’t run batch sealing at runtime)
59-
- GCC **13** toolchain (`gcc-13` / `g++-13`)
60-
- Python venv tooling (`python3-venv`) and common build tools (`autoconf`, `automake`, `libtool`, `nasm`, `xxd`, etc.)
58+
- **CUDA Toolkit 12.x or later** (`nvcc` must be in PATH)
59+
- **GCC 12 or 13** — pick the version your CUDA toolkit supports:
60+
- CUDA 12.0–12.5 → `gcc-12`/`g++-12`
61+
- CUDA 12.6+ or 13+ → `gcc-13`/`g++-13`
62+
- Python venv tooling (`python3-venv`) and build tools (`autoconf`, `automake`, `libtool`, `nasm`, `xxd`)
6163
62-
If you’re troubleshooting whether your machine can run the **fast TreeR** path used by SnapDeals, run:
63-
64-
```bash
65-
curio test supra system-info
66-
```
64+
To skip the supraseal build (e.g. if you don't have CUDA), use: `make build FFI_USE_OPENCL=1` or `make build DISABLE_SUPRASEAL=1`
6765
{% endhint %}
6866

6967
Arch:
@@ -72,15 +70,14 @@ Arch:
7270
sudo pacman -Syu opencl-icd-loader gcc git jq pkg-config opencl-headers hwloc libarchive nasm xxd python python-pip python-virtualenv
7371
# For batch sealing builds (SnapDeals fast TreeR / batch sealing toolchain):
7472
sudo pacman -Syu cuda
75-
# GCC 13 may be required depending on your supraseal version; install via your distro/AUR as appropriate.
73+
# GCC 12 or 13 required — pick based on your CUDA version (see note above).
7674
```
7775

78-
Ubuntu 24.04 / Debian:
76+
Ubuntu/Debian:
7977

8078
```shell
8179
sudo apt install -y \
8280
mesa-opencl-icd ocl-icd-opencl-dev \
83-
gcc-13 g++-13 \
8481
git jq pkg-config curl clang build-essential hwloc libhwloc-dev wget \
8582
python3 python3-dev python3-pip python3-venv \
8683
autoconf automake libtool \
@@ -90,8 +87,14 @@ sudo apt install -y \
9087
libgmp-dev libconfig++-dev \
9188
&& sudo apt upgrade -y
9289
93-
# CUDA Toolkit (batch sealing build requirement; needs nvcc)
94-
# Install via NVIDIA’s CUDA repository packages for your distro, or use `cuda-toolkit` packages if available.
90+
# GCC 12 or 13 — pick based on your CUDA version:
91+
# CUDA 12.0–12.5: sudo apt install gcc-12 g++-12
92+
# CUDA 12.6+/13+: sudo apt install gcc-13 g++-13
93+
# On older Ubuntu (e.g. 20.04) you may need the toolchain PPA:
94+
# sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update
95+
96+
# CUDA Toolkit (needed for GPU proving and supraseal build; nvcc must be in PATH)
97+
# Install via NVIDIA's CUDA repository for your distro.
9598
```
9699

97100
Fedora:
@@ -131,7 +134,7 @@ wget -c https://go.dev/dl/go1.24.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /us
131134
```
132135

133136
{% hint style="info" %}
134-
Youll need to add `/usr/local/go/bin` to your path. For most Linux distributions you can run something like:
137+
You'll need to add `/usr/local/go/bin` to your path. For most Linux distributions you can run something like:
135138
136139
```shell
137140
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc
@@ -258,13 +261,13 @@ This should output something like:
258261
/Library/Developer/CommandLineTools
259262
```
260263

261-
If this command returns a path, then you have Xcode already installed! You can [move on to installing dependencies with Homebrew](installation.md#homebrew). If the above command doesnt return a path, install Xcode:
264+
If this command returns a path, then you have Xcode already installed! You can [move on to installing dependencies with Homebrew](installation.md#homebrew). If the above command doesn't return a path, install Xcode:
262265
263266
```shell
264267
xcode-select --install
265268
```
266269
267-
Next up is installing Curios dependencies using Homebrew.
270+
Next up is installing Curio's dependencies using Homebrew.
268271

269272
### **Homebrew**
270273

documentation/en/supraseal.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Curio’s web UI exposes this as the **CC Scheduler** page/tab.
3434
* NVMe drives with high IOPS (10-20M total IOPS recommended)
3535
* GPU for PC2 phase (NVIDIA RTX 3090 or better recommended)
3636
* 1GB hugepages configured (minimum 36 pages)
37-
* Ubuntu or compatible Linux distribution (**gcc-13 required**, doesn't need to be system-wide)
37+
* Ubuntu or compatible Linux distribution (**GCC 12 or 13 required**, doesn't need to be system-wide)
3838
* At least 256GB RAM, ALL MEMORY CHANNELS POPULATED
3939
* Without **all** memory channels populated sealing **performance will suffer drastically**
4040
* NUMA-Per-Socket (NPS) set to 1
@@ -132,11 +132,23 @@ Check that `HugePages_Free` is equal to 36, the kernel can sometimes use some of
132132

133133
### Dependencies
134134

135-
CUDA 12.x is required, 11.x won't work. The build process depends on GCC 13.x system-wide or `gcc-13`/`g++-13` installed locally.
135+
CUDA 12.x or later is required (11.x won't work). The build process requires **GCC 12 or 13**system-wide or as `gcc-12`/`g++-12` (or `gcc-13`/`g++-13`) installed locally.
136136

137-
* On Arch install GCC 13 via your distro/AUR as appropriate
138-
* On Ubuntu/Debian install `gcc-13` and `g++-13` packages
137+
{% hint style="warning" %}
138+
**CUDA / GCC compatibility:** Your CUDA toolkit version determines which GCC it supports as a host compiler:
139+
* **CUDA 12.0–12.5:** supports GCC up to 12.x only → use `gcc-12`/`g++-12`
140+
* **CUDA 12.6+:** supports GCC up to 13.2 → either GCC 12 or 13 works
141+
* **CUDA 13.0+:** supports GCC 13+ → use `gcc-13`/`g++-13`
142+
143+
If you get nvcc errors about unsupported compiler versions, check your CUDA/GCC pairing.
144+
{% endhint %}
145+
146+
* On Arch install GCC 12 or 13 via your distro/AUR as appropriate
147+
* On Ubuntu/Debian install `gcc-12` and `g++-12` (or `gcc-13`/`g++-13`)
139148
```shell
149+
# For CUDA 12.0–12.5:
150+
sudo apt install gcc-12 g++-12
151+
# For CUDA 12.6+ or CUDA 13+:
140152
sudo apt install gcc-13 g++-13
141153
```
142154
* In addtion to general build dependencies (listed on the [installation page](installation.md)), you need `libgmp-dev` and `libconfig++-dev`

extern/supraseal/build.sh

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Copyright Supranational LLC
44

55
set -e
6-
set -x
76

87
SECTOR_SIZE="" # Compile for all sector sizes
98
while getopts r flag
@@ -13,38 +12,57 @@ do
1312
esac
1413
done
1514

16-
# Function to check GCC version - enforces GCC 13 for compatibility
15+
# Function to check GCC version - requires GCC 12 or 13 for C++17 compatibility.
16+
# The supraseal codebase uses C++17 features supported by both GCC 12 and 13.
17+
# CUDA toolkit compatibility determines which GCC version works with nvcc:
18+
# - CUDA 12.0–12.5: supports GCC up to 12.x (nvcc rejects GCC 13)
19+
# - CUDA 12.6+: supports GCC up to 13.2
20+
# - CUDA 13.0+: supports GCC 13+
21+
# We accept both and let nvcc validate the pairing via -ccbin.
1722
check_gcc_version() {
1823
local gcc_version=$(gcc -dumpversion | cut -d. -f1)
19-
local target_gcc_version=13
20-
21-
# Check if default GCC is version 13
22-
if [ "$gcc_version" -eq "$target_gcc_version" ]; then
24+
25+
# Accept system GCC 12 or 13 directly
26+
if [ "$gcc_version" -ge 12 ] && [ "$gcc_version" -le 13 ]; then
2327
echo "Using GCC $gcc_version"
2428
return 0
2529
fi
26-
27-
# If not GCC 13, try to find and use gcc-13
28-
if command -v gcc-13 &> /dev/null && command -v g++-13 &> /dev/null; then
29-
echo "Setting CC, CXX, and NVCC_PREPEND_FLAGS to use GCC 13 for compatibility."
30-
export CC=gcc-13
31-
export CXX=g++-13
32-
export NVCC_PREPEND_FLAGS="-ccbin /usr/bin/g++-13"
33-
return 0
34-
fi
35-
36-
# GCC 13 not found
37-
echo "Error: GCC 13 is required but not found."
38-
echo "Current GCC version: $gcc_version"
39-
echo "Please install GCC 13:"
40-
echo " On Ubuntu/Debian: sudo apt-get install gcc-13 g++-13"
41-
echo " On Fedora: sudo dnf install gcc-13 gcc-c++-13"
30+
31+
# System GCC is outside 12-13 range; try to find gcc-13 or gcc-12
32+
for v in 13 12; do
33+
if command -v gcc-$v &> /dev/null && command -v g++-$v &> /dev/null; then
34+
echo "Setting CC, CXX, and NVCC_PREPEND_FLAGS to use GCC $v."
35+
export CC=gcc-$v
36+
export CXX=g++-$v
37+
export NVCC_PREPEND_FLAGS="-ccbin /usr/bin/g++-$v"
38+
return 0
39+
fi
40+
done
41+
42+
# Neither found
43+
echo ""
44+
echo "=========================================="
45+
echo "ERROR: GCC 12 or 13 is required but not found."
46+
echo "=========================================="
47+
echo ""
48+
echo " Current GCC version: $gcc_version"
49+
echo ""
50+
echo " Please install GCC 12 or 13:"
51+
echo " Ubuntu/Debian: sudo apt-get install gcc-13 g++-13"
52+
echo " or: sudo apt-get install gcc-12 g++-12"
53+
echo " Fedora: sudo dnf install gcc-13 gcc-c++-13"
54+
echo " or: sudo dnf install gcc-12 gcc-c++-12"
55+
echo ""
56+
echo " On older Ubuntu (e.g. 20.04), you may need the toolchain PPA first:"
57+
echo " sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update"
58+
echo ""
4259
exit 1
4360
}
4461

4562
# Call the function to check GCC version
4663
check_gcc_version
4764

65+
# Enable trace logging after the GCC check so error messages are readable
4866
set -x
4967

5068
CC=${CC:-cc}
@@ -79,13 +97,16 @@ VENV_DIR="$(pwd)/.venv"
7997
if [ ! -d "$VENV_DIR" ] || [ ! -f "$VENV_DIR/bin/activate" ]; then
8098
echo "Creating Python virtual environment..."
8199
if ! python3 -m venv "$VENV_DIR"; then
82-
echo "Error: python3-venv is required but not available."
83-
echo "Please install it:"
84-
echo " On Ubuntu/Debian: sudo apt-get install python3-venv"
85-
echo " On Fedora: sudo dnf install python3-virtualenv"
100+
PY_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || echo "3")
101+
echo ""
102+
echo "=========================================="
103+
echo "ERROR: python3-venv is required but not available."
104+
echo "=========================================="
105+
echo ""
106+
echo " Ubuntu/Debian: sudo apt-get install python3-venv"
107+
echo " (on older Ubuntu, use: sudo apt-get install python${PY_VER}-venv)"
108+
echo " Fedora: sudo dnf install python3-virtualenv"
86109
echo ""
87-
echo "Or if you prefer, you can install dependencies manually:"
88-
echo " pip3 install --user meson ninja pyelftools"
89110
exit 1
90111
fi
91112
fi

0 commit comments

Comments
 (0)