Skip to content

Commit df5b15f

Browse files
ci: add LoongArch cross-compile build
Signed-off-by: 吴小白 <[email protected]>
1 parent 803f8ba commit df5b15f

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

.github/workflows/build-linux-cross.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,118 @@ jobs:
231231
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
232232
233233
cmake --build build --config Release -j $(nproc)
234+
235+
debian-13-loongarch64-cpu-cross:
236+
runs-on: ubuntu-24.04
237+
container: debian@sha256:653dfb9f86c3782e8369d5f7d29bb8faba1f4bff9025db46e807fa4c22903671
238+
239+
steps:
240+
- uses: actions/checkout@v4
241+
- name: Setup LoongArch
242+
run: |
243+
rm -f /etc/apt/sources.list.d/*
244+
cat << EOF | tee /etc/apt/sources.list.d/debian-ports.list
245+
deb http://snapshot.debian.org/archive/debian/20250515T202920Z/ trixie main
246+
EOF
247+
( echo 'quiet "true";'; \
248+
echo 'APT::Get::Assume-Yes "true";'; \
249+
echo 'APT::Install-Recommends "false";'; \
250+
echo 'Acquire::Check-Valid-Until "false";'; \
251+
echo 'Acquire::Retries "5";'; \
252+
) > /etc/apt/apt.conf.d/99snapshot-repos
253+
254+
apt-get update
255+
apt-get install -y ca-certificates debian-ports-archive-keyring git zip
256+
dpkg --add-architecture loong64
257+
258+
# Add arch-specific repositories for non-amd64 architectures
259+
cat << EOF | tee /etc/apt/sources.list.d/loong64-ports.list
260+
deb [arch=loong64] http://snapshot.debian.org/archive/debian-ports/20250515T194251Z/ sid main
261+
EOF
262+
263+
apt-get update || true ;# Prevent failure due to missing URLs.
264+
265+
apt-get install -y --no-install-recommends \
266+
build-essential \
267+
cmake \
268+
gcc-14-loongarch64-linux-gnu \
269+
g++-14-loongarch64-linux-gnu \
270+
libcurl4-openssl-dev:loong64
271+
272+
- name: Build
273+
run: |
274+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
275+
-DGGML_OPENMP=OFF \
276+
-DLLAMA_BUILD_EXAMPLES=ON \
277+
-DLLAMA_BUILD_TOOLS=ON \
278+
-DLLAMA_BUILD_TESTS=OFF \
279+
-DCMAKE_SYSTEM_NAME=Linux \
280+
-DCMAKE_SYSTEM_PROCESSOR=loongarch64 \
281+
-DCMAKE_C_COMPILER=loongarch64-linux-gnu-gcc-14 \
282+
-DCMAKE_CXX_COMPILER=loongarch64-linux-gnu-g++-14 \
283+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
284+
-DCMAKE_FIND_ROOT_PATH=/usr/lib/loongarch64-linux-gnu \
285+
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
286+
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
287+
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
288+
289+
cmake --build build --config Release -j $(nproc)
290+
291+
debian-13-loongarch64-vulkan-cross:
292+
runs-on: ubuntu-24.04
293+
container: debian@sha256:653dfb9f86c3782e8369d5f7d29bb8faba1f4bff9025db46e807fa4c22903671
294+
295+
steps:
296+
- uses: actions/checkout@v4
297+
- name: Setup LoongArch
298+
run: |
299+
rm -f /etc/apt/sources.list.d/*
300+
cat << EOF | tee /etc/apt/sources.list.d/debian-ports.list
301+
deb http://snapshot.debian.org/archive/debian/20250515T202920Z/ trixie main
302+
EOF
303+
( echo 'quiet "true";'; \
304+
echo 'APT::Get::Assume-Yes "true";'; \
305+
echo 'APT::Install-Recommends "false";'; \
306+
echo 'Acquire::Check-Valid-Until "false";'; \
307+
echo 'Acquire::Retries "5";'; \
308+
) > /etc/apt/apt.conf.d/99snapshot-repos
309+
310+
apt-get update
311+
apt-get install -y ca-certificates debian-ports-archive-keyring git zip
312+
dpkg --add-architecture loong64
313+
314+
# Add arch-specific repositories for non-amd64 architectures
315+
cat << EOF | tee /etc/apt/sources.list.d/loong64-ports.list
316+
deb [arch=loong64] http://snapshot.debian.org/archive/debian-ports/20250515T194251Z/ sid main
317+
EOF
318+
319+
apt-get update || true ;# Prevent failure due to missing URLs.
320+
321+
apt-get install -y --no-install-recommends \
322+
build-essential \
323+
cmake \
324+
glslc \
325+
gcc-14-loongarch64-linux-gnu \
326+
g++-14-loongarch64-linux-gnu \
327+
libvulkan-dev:loong64 \
328+
libcurl4-openssl-dev:loong64
329+
330+
- name: Build
331+
run: |
332+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
333+
-DGGML_VULKAN=ON \
334+
-DGGML_OPENMP=OFF \
335+
-DLLAMA_BUILD_EXAMPLES=ON \
336+
-DLLAMA_BUILD_TOOLS=ON \
337+
-DLLAMA_BUILD_TESTS=OFF \
338+
-DCMAKE_SYSTEM_NAME=Linux \
339+
-DCMAKE_SYSTEM_PROCESSOR=loongarch64 \
340+
-DCMAKE_C_COMPILER=loongarch64-linux-gnu-gcc-14 \
341+
-DCMAKE_CXX_COMPILER=loongarch64-linux-gnu-g++-14 \
342+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
343+
-DCMAKE_FIND_ROOT_PATH=/usr/lib/loongarch64-linux-gnu \
344+
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
345+
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
346+
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
347+
348+
cmake --build build --config Release -j $(nproc)

0 commit comments

Comments
 (0)