Skip to content

Commit

Permalink
Trac #32088: gfan testsuite hangs on 32bit
Browse files Browse the repository at this point in the history
For example: `tox -e docker-centos-7-i386-standard gfan` never seems to
terminate.

To check, use `tox -e docker-centos-7-i386-standard gfan-build-deps`,
then run the built image with Docker.  Then `make gfan` builds the
package and hangs in the testsuite after printing:
{{{
gfan-0.6.2.p1] Running command:"cat
<testsuite/0509IntegerGroebnerFan/input|./gfan _overintegers
--groebnerFan |grep F_VECTOR>testsuite/0509IntegerGroebnerFan/outputNew"
[gfan-0.6.2.p1] Running command:"cat
<testsuite/0510Minkowskisum/input|./gfan _minkowskisum --symmetry | grep
-A1 F_VECTOR>testsuite/0510Minkowskisum/outputNew"
[gfan-0.6.2.p1] Running command:"cat
<testsuite/0511FanHomology/input|./gfan _fanhomology -i testsuite/0511Fa
nHomology/nonTopHomology.poly>testsuite/0511FanHomology/outputNew"
[gfan-0.6.2.p1] Running command:"cat
<testsuite/0600ResultantFan/input|./gfan _resultantfan --vectorinput |
grep F_VECTOR -A1>testsuite/0600ResultantFan/outputNew"
[gfan-0.6.2.p1] Running command:"cat
<testsuite/0601ResultantFanSpecialised/input|./gfan _resultantfan
--vectorinput --special| grep F_VECTOR
-A1>testsuite/0601ResultantFanSpecialised/outputNew"
[gfan-0.6.2.p1] Running command:"cat
<testsuite/0602ResultantFanProjection/input|./gfan _resultantfan
--vectorinput --projection| grep F_VECTOR
-A1>testsuite/0602ResultantFanProjection/outputNew"
}}}

URL: https://trac.sagemath.org/32088
Reported by: mkoeppe
Ticket author(s): Thierry Monteil
Reviewer(s): Matthias Koeppe
  • Loading branch information
Release Manager committed Jul 24, 2022
2 parents 10247d5 + 54702a1 commit 4cc4817
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build/bin/write-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
ARG USE_MAKEFLAGS="-k V=0"
ENV SAGE_CHECK=warn
ENV SAGE_CHECK_PACKAGES="!gfan,!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
#:make:
ARG TARGETS_PRE="all-sage-local"
$RUN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS_PRE} $ENDRUN
Expand All @@ -262,7 +262,7 @@ ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
ARG USE_MAKEFLAGS="-k V=0"
ENV SAGE_CHECK=warn
ENV SAGE_CHECK_PACKAGES="!gfan,!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
$ADD src src
ARG TARGETS="build"
$RUN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS} $ENDRUN
Expand All @@ -272,7 +272,7 @@ ARG NUMPROC=8
ENV MAKE="make -j\${NUMPROC}"
ARG USE_MAKEFLAGS="-k V=0"
ENV SAGE_CHECK=warn
ENV SAGE_CHECK_PACKAGES="!gfan,!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
ARG TARGETS_OPTIONAL="ptest"
$RUN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS_OPTIONAL} || echo "(error ignored)" $ENDRUN
Expand Down
21 changes: 21 additions & 0 deletions build/pkgs/gfan/patches/fix-int64-for-32bit-archs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Description: Use int64_t instead of signed long int for 64-bit integer typedef.
On 32-bit architectures, longs are only 32 bits. The resulting overflow was
causing an infinite loop in the 0602ResultantFanProjection test.

References:
https://trac.sagemath.org/ticket/32088
https://salsa.debian.org/math-team/gfan/-/commit/acaaa70
https://github.com/void-linux/void-packages/pull/34182

Author: Doug Torrance <dtorrance@piedmont.edu>

--- a/src/vektor.h
+++ b/src/vektor.h
@@ -10,7 +10,7 @@

using namespace std;

-typedef signed long int int64;
+typedef int64_t int64;

void outOfRange(int i, int n);
8 changes: 8 additions & 0 deletions build/pkgs/gfan/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ cd src
# clash of log2 macro with standard library (C++ >= 14), #28984
find src -type f -print0 | xargs -0 sed -i.bak "s/log2/logger2/g"

# To let testsuite/0009RenderStairCase pass on 32bit machines
# See https://trac.sagemath.org/ticket/32088
case "$($CC -dumpmachine)" in
i[3456]86*)
CXXFLAGS+=" -ffloat-store"
;;
esac

echo "Now building gfan..."
# We don't use the makefile to install gfan so we don't need to set PREFIX
sdh_make CPPFLAGS="-I$SAGE_LOCAL/include"
Expand Down

0 comments on commit 4cc4817

Please sign in to comment.