user [email protected]
usertags 1143644 python3.15
tags 1143644 patch
retitle 1143644 brial: FTBFS with GCC 16
thanks

Hi!

While rebuilding the python related packages against the Python 3.15rc2
version I ran into this FTBFS [1].

To solve the problem I had to do two changes:
- Apply upstream fix df5b4fd300cdbdd4cda920a27fdc5257f3cfea26 "Fix
  compilation and tests with C++20 (#64)"
- The tests depend on sagemath, which doesn't work with the current
  Python versions, so I replaced that test with a simpler one.

I've applied these fixes in the sandbox [2] to verify that it builds
successfully, these should be applied in Debian to get brial back to a
healthy state.

Happy hacking,

[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4416214/
[2]: https://debusine.debian.net/debian/r-python-python3.15/

--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
From: Xeonacid <[email protected]>
Date: Tue, 1 Sep 2026 18:23:56 +0800
Subject: Fix compilation and tests with C++20 (#64)

GCC 16 defaults to C++20, which breaks BRiAl in two places.

std::accumulate now invokes the binary operation as
binary_op(std::move(acc), *i). AddEliminationDegree::operator() took a
non-const size_type& that cannot bind to that rvalue. Take the
accumulator by value and return the updated count instead. The numeric
result is unchanged.

operator==(bool, const BoolePolynomial&) is implemented as
`return (rhs == lhs)`. In C++20 that expression also considers the
reversed candidate, which is this same function, so the comparison
recurses instead of calling BoolePolynomial::operator==(constant_type).
The same issue applies to operator!=. Call the member operators
directly. This keeps the existing semantics and unbreaks tests such as
`true == BoolePolynomial(true, ring)`.
---
 libbrial/include/polybori/BoolePolynomial.h | 4 ++--
 libbrial/src/BoolePolynomial.cc             | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libbrial/include/polybori/BoolePolynomial.h b/libbrial/include/polybori/BoolePolynomial.h
index 2f5f35f8..96a68938 100644
--- a/libbrial/include/polybori/BoolePolynomial.h
+++ b/libbrial/include/polybori/BoolePolynomial.h
@@ -578,14 +578,14 @@ operator%(const BoolePolynomial& lhs, const RHSType& rhs){
 inline BoolePolynomial::bool_type
 operator==(BoolePolynomial::bool_type lhs, const BoolePolynomial& rhs) {
 
-  return (rhs == lhs); 
+  return rhs.operator==(lhs);
 }
 
 /// Nonquality check (with constant lhs)
 inline BoolePolynomial::bool_type
 operator!=(BoolePolynomial::bool_type lhs, const BoolePolynomial& rhs) {
 
-  return (rhs != lhs); 
+  return rhs.operator!=(lhs);
 }
 
 /// Stream output operator
diff --git a/libbrial/src/BoolePolynomial.cc b/libbrial/src/BoolePolynomial.cc
index 8878354a..05e4d844 100644
--- a/libbrial/src/BoolePolynomial.cc
+++ b/libbrial/src/BoolePolynomial.cc
@@ -773,7 +773,7 @@ public:
   AddEliminationDegree(size_type min): 
     m_min(min) {}
 
-  size_type& operator()(size_type& rhs, size_type lhs) {
+  size_type operator()(size_type rhs, size_type lhs) const {
     ++rhs;
     if (lhs > m_min)
       rhs += (lhs - m_min);
#!/bin/sh
set -e

if [ -z "$AUTOPKGTEST_TMP" ]; then
    AUTOPKGTEST_TMP=$(mktemp -d)
    trap 'rm -rf "$AUTOPKGTEST_TMP"' EXIT
fi

cd "$AUTOPKGTEST_TMP"

cat << 'EOF' > test_brial.cc
#include <polybori.h>
#include <polybori/groebner/GroebnerStrategy.h>
#include <iostream>

USING_NAMESPACE_PBORI
USING_NAMESPACE_PBORIGB

int main() {
    BoolePolyRing ring(10);
    BooleVariable x(0, ring);
    BoolePolynomial p = x + 1;
    GroebnerStrategy strat(ring);
    strat.addGenerator(p);
    std::cout << "p = " << p << std::endl;
    return 0;
}
EOF

${CXX:-g++} test_brial.cc -lbrial -lbrial_groebner -o test_brial
./test_brial
Tests: build-and-run
Depends: libbrial-dev, libbrial-groebner-dev, build-essential
Restrictions: allow-stderr

Reply via email to