Source: brotli
Version: 1.2.0-1
Severity: normal
Tags: FTBFS patch
User: [email protected]
Usertags: loong64
X-Debbugs-Cc: [email protected]
Dear maintainers,
Compiling the new brotli version failed for loong64 in the Debian
Package Auto-Building environment.
The error log is as follows,
```
In file included from c/common/constants.c:7:
c/common/constants.h:196:23: error: invalid argument of ‘model’ attribute
196 | BrotliPrefixCodeRange
_kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
| ^~~~~~~~~~~~~~~~~~~~~~~~
c/common/constants.c:10:23: error: invalid argument of ‘model’ attribute
10 | BrotliPrefixCodeRange
_kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~
error: command '/usr/bin/loongarch64-linux-gnu-gcc' failed with exit code 1
E: pybuild pybuild:483: build: plugin distutils failed with: exit
code=1: /usr/bin/python3 setup.py build
dh_auto_build: error: pybuild --build -i python{version} -p "3.14 3.13"
returned exit code 13
make[1]: *** [debian/rules:18: override_dh_auto_build] Error 25
```
After analyzing, I have created a repair patch.
Please consider the patch attached.
Based attached patch, I have built brotli 1.2.0-1 successfully on loong64.
```
dpkg-deb: building package 'brotli-dbgsym' in
'../brotli-dbgsym_1.2.0-1.1_loong64.deb'.
dpkg-deb: building package 'python3-brotli-dbgsym' in
'../python3-brotli-dbgsym_1.2.0-1.1_loong64.deb'.
dpkg-deb: building package 'libbrotli1' in
'../libbrotli1_1.2.0-1.1_loong64.deb'.
dpkg-genbuildinfo -O../brotli_1.2.0-1.1_loong64.buildinfo
dpkg-genchanges -O../brotli_1.2.0-1.1_loong64.changes
```
Best regards,
Dandan Zhang
From: Dandan Zhang <[email protected]>
Date: Tue, 03 Feb 2026 17:23:10 +0800
Subject: [PATCH] Cherry-pick upstream patch to fix build error on loong64
Origin: (upstream), (commit: https://github.com/google/brotli/commit/e230f474b87134e8c6c85b630084c612057f253e)
--- brotli-1.2.0.orig/c/common/platform.h
+++ brotli-1.2.0/c/common/platform.h
@@ -665,7 +665,8 @@ BROTLI_UNUSED_FUNCTION void BrotliSuppre
#undef BROTLI_TEST
#endif
-#if BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3)
+#if !defined(BROTLI_MODEL) && BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3) && \
+ !defined(BROTLI_TARGET_LOONGARCH64)
#define BROTLI_MODEL(M) __attribute__((model(M)))
#else
#define BROTLI_MODEL(M) /* M */