Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

英雄帖:Make Sagemath work on LoongArch #53

Open
lwzhenglittle opened this issue Apr 26, 2024 · 9 comments
Open

英雄帖:Make Sagemath work on LoongArch #53

lwzhenglittle opened this issue Apr 26, 2024 · 9 comments
Assignees
Labels
AREA: Arch optimization Architecture-specific enablement or optimization (e.g. addition of LoongArch SIMD codepaths) 英雄帖 Volunteers welcome!

Comments

@lwzhenglittle
Copy link

Sagemath 简介

SageMath(简称Sage)是一个开源的数学软件系统,旨在提供一个包含数学软件的完整环境,以便于数学建模、数值计算、符号计算和数据可视化等任务。它集成了多个数学软件包和工具,如NumPy、SciPy、SymPy、Matplotlib等,同时提供了一个Python编程接口。

SageMath 的目标是为数学家、科学家和工程师提供一个统一的平台,使他们能够进行各种复杂的数学计算和研究。SageMath 支持大量的数学领域,包括代数、数论、几何、拓扑学、概率论等等。

SageMath 是免费开源软件,用户可以自由地使用、修改和分发它。

情况说明

Repo: https://github.com/lwzhenglittle/sage-loongarch

Upstream: https://github.com/sagemath/sage

目前正在使用 AOSC OS 在 3A5000 上尝试构建 Sagemath,正在把一些构建相关的 patch 推到 lwzhenglittle/sage-loongarch,起码让构建系统能够正常运行(目前还没推)。

Sagemath 本身自带一套 “SPKG” 系统,用于管理其第三方依赖库,目前尝试使用其自带的 SPKG 进行依赖补全,而不是使用发行版软件源中的依赖包。

目前遇到的问题

  • 第三方依赖包 Tachyon 与特定架构强耦合

相关日志文件,脚本文件:

Sagemath 提供的用于构建 Tachyon 的脚本
#!/usr/bin/env bash

export SAGE_ROOT="/home/lwzheng/sagemath/sage-10.3"
export SAGE_SRC="/home/lwzheng/sagemath/sage-10.3/src"
export SAGE_PKG_DIR="/home/lwzheng/sagemath/sage-10.3/local/var/tmp/sage/build/tachyon-0.98.9.p7"
export SAGE_SPKG_SCRIPTS="/home/lwzheng/sagemath/sage-10.3/local/var/lib/sage/scripts"
export SAGE_SPKG_WHEELS="/home/lwzheng/sagemath/sage-10.3/local/var/lib/sage/wheels"

export PKG_NAME="tachyon-0.98.9.p7"
export PKG_BASE="tachyon"
export PKG_VER="0.98.9.p7"

for lib in "$SAGE_ROOT/build/bin/sage-dist-helpers" "$SAGE_SRC/bin/sage-src-env-config" "$SAGE_SRC/bin/sage-env-config" "$SAGE_SRC/bin/sage-env" "$SAGE_ROOT/build/bin/sage-build-env-config" "$SAGE_ROOT/build/bin/sage-build-env"; do
    source "$lib"
    if [ $? -ne 0 ]; then
        echo >&2 "Error: failed to source $lib"
        echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?"
        exit 1
    fi
done

export SAGE_INST_LOCAL="/home/lwzheng/sagemath/sage-10.3/local"

sdh_guard
if [ $? -ne 0 ]; then
    echo >&2 "Error: sdh_guard not found; Sage environment was not set up properly"
    exit 1
fi

cd "$SAGE_PKG_DIR"
if [ $? -ne 0 ]; then
    echo >&2 "Error: could not cd to the package build directory $SAGE_PKG_DIR"
    exit 1
fi

CUR=`pwd`

cd "$CUR/src/unix"

TARGET=""
case "$UNAME" in
"Darwin")
    TARGET=macosx
    ;;
"FreeBSD")
    # Tachyon doesn't have a threaded option for FreeBSD (though it shouldn't
    # be too difficult to add).  There's no need for an explicit 64-bit version
    # since the only difference is a slight performance optimisation.
    TARGET=bsd
    ;;
"Linux")
    case "$($CC -dumpmachine)" in
    i[3456]86*)
        TARGET=linux-thr
        ;;
    ia64*)
        TARGET=linux-ia64-thr
        ;;
    amd64*|x86_64*)
        TARGET=linux-64-thr
        ;;
    ppc*|powerpc*)
        TARGET=linux-ppc
        ;;
    armv6l*|armv7l*)
        TARGET=linux-arm-thr
        ;;
    esac
    ;;
"SunOS")
    TARGET=solaris-pthreads-gcc
    ;;
# TODO: I don't think we even support these platforms anymore
"AIX")
    CFLAGS="$CFLAGS -g -O2"
    export CFLAGS
    TARGET=aix-generic-thr
    ;;
"HP-UX")
    CFLAGS="$CFLAGS -g -O2"
    export CFLAGS
    TARGET=hpux-generic-thr
    ;;
esac

if [ -z "$TARGET" ]; then
    sdh_die "Error: Sorry, your platform isn't supported by Tachyon and/or Sage. Exiting..."
fi

sdh_make "$TARGET"

echo "Installing the Tachyon binary..."
cd "$CUR"
binary_name=tachyon

# The '*' is a place-holder for the arch just built:
sdh_install src/compile/*/"${binary_name}" "$SAGE_LOCAL/bin"
Tachyon 的 Makefile
# Makefile for the Tachyon parallel ray tracing library.
# Copyright 1994-2007 John E. Stone
# All Rights Reserved
#
# $Id: Makefile,v 1.100 2007/02/13 03:39:08 johns Exp $
#

#.SILENT:

#
# Include the machine dependent compilation flags etc.
#
include Make-opengl
include Make-config
include Make-arch
include Make-distrib

COMPILEDIR=../compile
ARCHDIR=../compile/${ARCH}
OBJDIR=${ARCHDIR}/libtachyon

#
# Name of raytracing library file to create
#
RAYLIB=${ARCHDIR}/libtachyon.a
RAYLIBDIR=${ARCHDIR}

#
# Extra parsers and such
#
PARSEOBJS = ${OBJDIR}/mgfparse.o ${OBJDIR}/ac3dparse.o 
PARSEINC  = ${MGFINC}
PARSEDIRS = ${MGFDIR}
PARSELIBS = ${MGFLIB} 

#
# Miscellaneous object files etc.
#
MISC= ${OBJDIR}/mainanim.o \
        ${OBJDIR}/animspheres.o \
        ${OBJDIR}/animspheres \
        ${OBJDIR}/animspheres2.o \
        ${OBJDIR}/animskull.o \
        ${OBJDIR}/animskull \
        ${OBJDIR}/animspheres2 \
        ${OBJDIR}/fire.o \
        ${OBJDIR}/fire \
        ${OBJDIR}/hypertex.o \
        ${OBJDIR}/hypertex \
        ${OBJDIR}/tgatoyuv \
        ${OBJDIR}/tachyon \
        ${OBJDIR}/animray \
        ${OBJDIR}/main.o \
        ${OBJDIR}/spaceball.o \
        ${OBJDIR}/trackball.o \
        ${OBJDIR}/getargs.o \
        ${OBJDIR}/parse.o \
        ${OBJDIR}/nffparse.o \
        ${OBJDIR}/glwin.o

#
# Test programs included..
#
#BINARIES = ${COMPILEDIR} ${ARCHDIR} ${OBJDIR} ${PARSEDIRS} \
#       ${RAYLIB} ${PARSELIB} ${ARCHDIR}/tachyon \
#       ${ARCHDIR}/fire ${ARCHDIR}/hypertex ${ARCHDIR}/tgatoyuv \
#       ${ARCHDIR}/animray ${ARCHDIR}/animspheres ${ARCHDIR}/animskull \
#       ${ARCHDIR}/animspheres2

#
# No test programs included..
#
BINARIES = ${COMPILEDIR} ${ARCHDIR} ${OBJDIR} ${PARSEDIRS} \
        ${RAYLIB} ${PARSELIB} ${ARCHDIR}/tachyon


#----------------------------------------------------------------------
# Demo Programs etc
#----------------------------------------------------------------------

DEMOINC= -I${SRCDIR} -I${DEMOSRC}

all : mesg directories 
        ${MAKE} ${BINARIES}
        @echo ""
        @echo "Build Complete"

directories :
        @if [ ! -d ${COMPILEDIR} ] ; then \
                echo "Making compile directory ${COMPILEDIR}"; \
                mkdir ${COMPILEDIR}; \
        fi; 
        @if [ ! -d ${ARCHDIR} ] ; then \
                echo "Making architecture directory ${ARCHDIR}"; \
                mkdir ${ARCHDIR}; \
        fi; 
        @if [ ! -d ${OBJDIR} ] ; then \
                echo "Making library directory ${OBJDIR}"; \
                mkdir ${OBJDIR}; \
        fi; 


mesg : 
        @echo "Building Tachyon Parallel Ray Tracing library"
        @echo "Copyright 1994-2007, John E. Stone"
        @echo "All Rights Reserveed"

${MGFDIR} : ${ARCHDIR}
        @if [ ! -d ${MGFDIR} ] ; then \
                echo "Making libmgf directory ${MGFDIR}"; \
                mkdir ${MGFDIR}; \
        fi; 

#
# MGF Library compilation
#
${MGFLIB} : ../libmgf/Makefile
        {cd ../libmgf; \
        ${MAKE} -f Makefile RANLIB=${RANLIB} MGFLIBDIR=${MGFLIBDIR} \
        MGFLIB=${MGFLIB} AR=${AR} ARFLAGS=${ARFLAGS} \
        };

${ARCHDIR}/tachyon : ${RAYLIB} ${PARSELIB} ${OBJDIR}/main.o ${OBJDIR}/getargs.o ${OBJDIR}/parse.o ${OBJDIR}/nffparse.o ${OBJDIR}/glwin.o ${OBJDIR}/spaceball.o ${OBJDIR}/trackball.o ${PARSEOBJS} 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/tachyon ${LDFLAGS} ${OBJDIR}/main.o ${OBJDIR}/getargs.o ${OBJDIR}/parse.o ${OBJDIR}/nffparse.o ${OBJDIR}/glwin.o ${OBJDIR}/spaceball.o ${OBJDIR}/trackball.o ${PARSEOBJS} -L${RAYLIBDIR} ${PARSELIBS} ${LIBS}
        ${STRIP} ${ARCHDIR}/tachyon

${ARCHDIR}/animray : ${RAYLIB} ${OBJDIR}/mainanim.o
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/animray ${LDFLAGS} ${OBJDIR}/mainanim.o -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/animray 

${ARCHDIR}/animspheres : ${RAYLIB} ${OBJDIR}/animspheres.o 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/animspheres ${LDFLAGS} ${OBJDIR}/animspheres.o -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/animspheres

${ARCHDIR}/animspheres2 : ${RAYLIB} ${OBJDIR}/animspheres2.o 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/animspheres2 ${LDFLAGS} ${OBJDIR}/animspheres2.o -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/animspheres2

${ARCHDIR}/hypertex : ${RAYLIB} ${OBJDIR}/hypertex.o ${DEMOSRC}/hypertex.c 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/hypertex ${LDFLAGS} ${OBJDIR}/hypertex.o -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/hypertex 

${ARCHDIR}/fire : ${RAYLIB} ${OBJDIR}/fire.o ${DEMOSRC}/fire.c 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/fire ${LDFLAGS} ${OBJDIR}/fire.o -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/fire

${ARCHDIR}/animskull : ${RAYLIB} ${OBJDIR}/animskull.o 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/animskull ${LDFLAGS} ${OBJDIR}/animskull.o -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/animskull

${ARCHDIR}/tgatoyuv : ${RAYLIB} ${DEMOSRC}/tgatoyuv.c 
        ${CC} ${CFLAGS} ${DEMOINC} -o ${ARCHDIR}/tgatoyuv ${LDFLAGS} ${DEMOSRC}/tgatoyuv.c -L${RAYLIBDIR} ${LIBS}
        ${STRIP} ${ARCHDIR}/tgatoyuv

#
# Rules for building demo .o files
#

${OBJDIR}/animskull.o : ${DEMOSRC}/animskull.c 
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/animskull.c -o ${OBJDIR}/animskull.o

${OBJDIR}/hypertex.o : ${DEMOSRC}/hypertex.c
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/hypertex.c -o ${OBJDIR}/hypertex.o

${OBJDIR}/fire.o : ${DEMOSRC}/fire.c
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/fire.c -o ${OBJDIR}/fire.o

${OBJDIR}/mainanim.o : ${DEMOSRC}/mainanim.c
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/mainanim.c -o ${OBJDIR}/mainanim.o

${OBJDIR}/main.o : ${DEMOSRC}/main.c ${DEMOSRC}/getargs.h ${DEMOSRC}/parse.h ${DEMOSRC}/nffparse.h ${DEMOSRC}/ac3dparse.h ${DEMOSRC}/glwin.h
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/main.c -o ${OBJDIR}/main.o

${OBJDIR}/getargs.o : ${DEMOSRC}/getargs.c ${DEMOSRC}/getargs.h
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/getargs.c -o ${OBJDIR}/getargs.o

${OBJDIR}/glwin.o : ${DEMOSRC}/glwin.c ${DEMOSRC}/glwin.h
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/glwin.c -o ${OBJDIR}/glwin.o

${OBJDIR}/spaceball.o : ${DEMOSRC}/spaceball.c
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/spaceball.c -o ${OBJDIR}/spaceball.o

${OBJDIR}/trackball.o : ${DEMOSRC}/trackball.c
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/trackball.c -o ${OBJDIR}/trackball.o

${OBJDIR}/animspheres.o : ${DEMOSRC}/animspheres.c 
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/animspheres.c -o ${OBJDIR}/animspheres.o

${OBJDIR}/animspheres2.o : ${DEMOSRC}/animspheres2.c 
        ${CC} ${CFLAGS} ${DEMOINC} -c ${DEMOSRC}/animspheres2.c -o ${OBJDIR}/animspheres2.o

${OBJDIR}/parse.o : ${DEMOSRC}/parse.c ${DEMOSRC}/parse.h
        ${CC} ${CFLAGS} ${PARSEINC} ${DEMOINC} -c ${DEMOSRC}/parse.c -o ${OBJDIR}/parse.o

${OBJDIR}/mgfparse.o : ${DEMOSRC}/mgfparse.c ${DEMOSRC}/mgfparse.h
        ${CC} ${CFLAGS} ${PARSEINC} ${DEMOINC} ${MGFINC} -c ${DEMOSRC}/mgfparse.c -o ${OBJDIR}/mgfparse.o

${OBJDIR}/nffparse.o : ${DEMOSRC}/nffparse.c ${DEMOSRC}/nffparse.h
        ${CC} ${CFLAGS} ${PARSEINC} ${DEMOINC} -c ${DEMOSRC}/nffparse.c -o ${OBJDIR}/nffparse.o

${OBJDIR}/ac3dparse.o : ${DEMOSRC}/ac3dparse.c ${DEMOSRC}/ac3dparse.h
        ${CC} ${CFLAGS} ${PARSEINC} ${DEMOINC} -c ${DEMOSRC}/ac3dparse.c -o ${OBJDIR}/ac3dparse.o

#----------------------------------------------------------------------
# End of demo programs
#----------------------------------------------------------------------

OBJDEPS= ${SRCDIR}/tachyon.h \
        ${SRCDIR}/machine.h \
        ${SRCDIR}/rtcommon.h \
        ${SRCDIR}/types.h \
        ${SRCDIR}/hash.h \
        ${SRCDIR}/macros.h \
        ${SRCDIR}/render.h \
        ${SRCDIR}/quadric.h \
        ${SRCDIR}/texture.h \
        ${SRCDIR}/light.h \
        ${SRCDIR}/util.h

RAYOBJS= ${OBJDIR}/api.o \
        ${OBJDIR}/apigeom.o \
        ${OBJDIR}/box.o \
        ${OBJDIR}/global.o \
        ${OBJDIR}/hash.o \
        ${OBJDIR}/parallel.o \
        ${OBJDIR}/threads.o \
        ${OBJDIR}/camera.o \
        ${OBJDIR}/render.o \
        ${OBJDIR}/trace.o \
        ${OBJDIR}/grid.o \
        ${OBJDIR}/intersect.o \
        ${OBJDIR}/sphere.o \
        ${OBJDIR}/plane.o \
        ${OBJDIR}/ring.o \
        ${OBJDIR}/triangle.o \
        ${OBJDIR}/cylinder.o \
        ${OBJDIR}/quadric.o \
        ${OBJDIR}/extvol.o \
        ${OBJDIR}/vol.o \
        ${OBJDIR}/ui.o \
        ${OBJDIR}/util.o \
        ${OBJDIR}/vector.o \
        ${OBJDIR}/shade.o \
        ${OBJDIR}/texture.o \
        ${OBJDIR}/coordsys.o \
        ${OBJDIR}/imap.o \
        ${OBJDIR}/light.o \
        ${OBJDIR}/imageio.o \
        ${OBJDIR}/jpeg.o \
        ${OBJDIR}/pngfile.o \
        ${OBJDIR}/ppm.o \
        ${OBJDIR}/psd.o \
        ${OBJDIR}/sgirgb.o \
        ${OBJDIR}/tgafile.o \
        ${OBJDIR}/winbmp.o

${RAYLIB} : ${RAYOBJS}
        rm -f ${RAYLIB}
        ${AR} ${ARFLAGS} ${RAYLIB} ${RAYOBJS}
        ${RANLIB} ${RAYLIB}

${OBJDIR}/vol.o : ${SRCDIR}/vol.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/vol.c -o ${OBJDIR}/vol.o

${OBJDIR}/extvol.o : ${SRCDIR}/extvol.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/extvol.c -o ${OBJDIR}/extvol.o

${OBJDIR}/winbmp.o : ${SRCDIR}/winbmp.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/winbmp.c -o ${OBJDIR}/winbmp.o

${OBJDIR}/vector.o : ${SRCDIR}/vector.c ${OBJDEPS} 
        ${CC} ${CFLAGS} -c ${SRCDIR}/vector.c -o ${OBJDIR}/vector.o

${OBJDIR}/triangle.o : ${SRCDIR}/triangle.c ${OBJDEPS} ${SRCDIR}/triangle.h
        ${CC} ${CFLAGS} -c ${SRCDIR}/triangle.c -o ${OBJDIR}/triangle.o

${OBJDIR}/trace.o : ${SRCDIR}/trace.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/trace.c -o ${OBJDIR}/trace.o

${OBJDIR}/threads.o : ${SRCDIR}/threads.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/threads.c -o ${OBJDIR}/threads.o

${OBJDIR}/tgafile.o : ${SRCDIR}/tgafile.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/tgafile.c -o ${OBJDIR}/tgafile.o

${OBJDIR}/util.o : ${SRCDIR}/util.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/util.c -o ${OBJDIR}/util.o

${OBJDIR}/ui.o : ${SRCDIR}/ui.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/ui.c -o ${OBJDIR}/ui.o

${OBJDIR}/texture.o : ${SRCDIR}/texture.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/texture.c -o ${OBJDIR}/texture.o

${OBJDIR}/sphere.o : ${SRCDIR}/sphere.c ${OBJDEPS} ${SRCDIR}/sphere.h
        ${CC} ${CFLAGS} -c ${SRCDIR}/sphere.c -o ${OBJDIR}/sphere.o

${OBJDIR}/sgirgb.o : ${SRCDIR}/sgirgb.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/sgirgb.c -o ${OBJDIR}/sgirgb.o

${OBJDIR}/shade.o : ${SRCDIR}/shade.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/shade.c -o ${OBJDIR}/shade.o

${OBJDIR}/ring.o : ${SRCDIR}/ring.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/ring.c -o ${OBJDIR}/ring.o

${OBJDIR}/render.o : ${SRCDIR}/render.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/render.c -o ${OBJDIR}/render.o

${OBJDIR}/quadric.o : ${SRCDIR}/quadric.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/quadric.c -o ${OBJDIR}/quadric.o

${OBJDIR}/jpeg.o : ${SRCDIR}/jpeg.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/jpeg.c -o ${OBJDIR}/jpeg.o

${OBJDIR}/pngfile.o : ${SRCDIR}/pngfile.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/pngfile.c -o ${OBJDIR}/pngfile.o

${OBJDIR}/ppm.o : ${SRCDIR}/ppm.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/ppm.c -o ${OBJDIR}/ppm.o

${OBJDIR}/psd.o : ${SRCDIR}/psd.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/psd.c -o ${OBJDIR}/psd.o

${OBJDIR}/plane.o : ${SRCDIR}/plane.c ${OBJDEPS} ${SRCDIR}/plane.h
        ${CC} ${CFLAGS} -c ${SRCDIR}/plane.c -o ${OBJDIR}/plane.o

${OBJDIR}/parallel.o : ${SRCDIR}/parallel.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/parallel.c -o ${OBJDIR}/parallel.o

${OBJDIR}/objbound.o : ${SRCDIR}/objbound.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/objbound.c -o ${OBJDIR}/objbound.o

${OBJDIR}/light.o : ${SRCDIR}/light.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/light.c -o ${OBJDIR}/light.o

${OBJDIR}/intersect.o : ${SRCDIR}/intersect.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/intersect.c -o ${OBJDIR}/intersect.o

${OBJDIR}/imageio.o : ${SRCDIR}/imageio.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/imageio.c -o ${OBJDIR}/imageio.o

${OBJDIR}/imap.o : ${SRCDIR}/imap.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/imap.c -o ${OBJDIR}/imap.o

${OBJDIR}/grid.o : ${SRCDIR}/grid.c ${SRCDIR}/grid.h ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/grid.c -o ${OBJDIR}/grid.o

${OBJDIR}/global.o : ${SRCDIR}/global.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/global.c -o ${OBJDIR}/global.o

${OBJDIR}/hash.o : ${SRCDIR}/hash.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/hash.c -o ${OBJDIR}/hash.o

${OBJDIR}/cylinder.o : ${SRCDIR}/cylinder.c ${OBJDEPS} ${SRCDIR}/cylinder.h
        ${CC} ${CFLAGS} -c ${SRCDIR}/cylinder.c -o ${OBJDIR}/cylinder.o

${OBJDIR}/coordsys.o : ${SRCDIR}/coordsys.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/coordsys.c -o ${OBJDIR}/coordsys.o

${OBJDIR}/camera.o : ${SRCDIR}/camera.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/camera.c -o ${OBJDIR}/camera.o

${OBJDIR}/box.o : ${SRCDIR}/box.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/box.c -o ${OBJDIR}/box.o

${OBJDIR}/bndbox.o : ${SRCDIR}/bndbox.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/bndbox.c -o ${OBJDIR}/bndbox.o

${OBJDIR}/apigeom.o : ${SRCDIR}/apigeom.c ${OBJDEPS}
        ${CC} ${CFLAGS} -c ${SRCDIR}/apigeom.c -o ${OBJDIR}/apigeom.o

${OBJDIR}/api.o : ${SRCDIR}/api.c ${OBJDEPS} ${SRCDIR}/sphere.h ${SRCDIR}/plane.h ${SRCDIR}/triangle.h ${SRCDIR}/cylinder.h
        ${CC} ${CFLAGS} -c ${SRCDIR}/api.c -o ${OBJDIR}/api.o

clean :
        @echo "Cleaning object files, binaries etc."
        @echo ""
        rm -rf ${COMPILEDIR}/*

valgrind:
        /usr/local/encap/valgrind-3.2.3/bin/valgrind --tool=memcheck --error-limit=no  --track-fds=yes --num-callers=1000 ../compile/linux-debug/tachyon ../scenes/*.dat -res 32 32 -aasamples 1 -nosave

valgrind-full:
        /usr/local/encap/valgrind-3.2.3/bin/valgrind --tool=memcheck --leak-check=full --error-limit=no  --track-fds=yes --num-callers=1000 ../compile/linux-debug/tachyon ../scenes/*.dat -res 32 32 -aasamples 1 -nosave

valgrind-debug:
        /usr/local/encap/valgrind-3.2.3/bin/valgrind --tool=memcheck --db-attach=yes --error-limit=no  --track-fds=yes --num-callers=1000 --gen-suppressions=yes ../compile/linux-debug/tachyon ../scenes/*.dat -res 32 32 -aasamples 1 -nosave
Sagemath 构建系统提供的失败日志
Attempting to download package tachyon-0.98.9.tar.bz2 from mirrors
https://github.com/sagemath/sage/releases/download/10.3/tachyon-0.98.9.tar.bz2
[......................................................................]
tachyon-0.98.9.p7
====================================================
Setting up build directory for tachyon-0.98.9.p7
Finished extraction
Applying patches from ../patches...
Applying ../patches/Make-arch.patch
patching file unix/Make-arch
Applying ../patches/Make-config.patch
patching file unix/Make-config
Applying ../patches/Makefile.patch
patching file unix/Makefile
Applying ../patches/main.c.patch
patching file demosrc/main.c
****************************************************
Host system:
Linux lwzheng-3a5k 6.9.0-aosc-main #1 SMP PREEMPT_DYNAMIC Wed Apr 10 16:51:47 UTC 2024 loongarch64 GNU/Linux
****************************************************
C compiler: gcc
C compiler version:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/loongarch64-aosc-linux-gnu/13.2.0/lto-wrapper
Target: loongarch64-aosc-linux-gnu
Configured with: /var/cache/acbs/build/acbs.epohdmgh/gcc-13.2.0/configure --build=loongarch64-aosc-linux-gnu --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --bindir=/usr/bin --sbindir=/usr/bin --mandir=/usr/share/man --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/AOSC-Dev/aosc-os-core --enable-shared --enable-threads=posix --with-system-zlib --enable-gnu-indirect-function --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --with-isl=/usr --enable-lto --enable-plugin --enable-install-libiberty --disable-multilib --disable-werror --enable-pie --enable-checking=release --enable-libstdcxx-dual-abi --with-default-libstdcxx-abi=new --enable-default-pie --enable-default-ssp --enable-bootstrap --enable-languages=c,c++,fortran,lto,objc,obj-c++,m2,d --with-abi=lp64d --with-arch=loongarch64 --with-tune=la464 
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 20230727 (AOSC OS, Core) (GCC) 
****************************************************
Package 'tachyon' is currently not installed
No legacy uninstaller found for 'tachyon'; nothing to do
*******************************************************************************************************************************************
Error: Sorry, your platform isn't supported by Tachyon and/or Sage. Exiting...
*******************************************************************************************************************************************

real    0m0.091s
user    0m0.070s
sys     0m0.019s
************************************************************************
Error installing package tachyon-0.98.9.p7
************************************************************************
Please email sage-devel (http://groups.google.com/group/sage-devel)
explaining the problem and including the log files
  /home/lwzheng/sagemath/sage-10.3/logs/pkgs/tachyon-0.98.9.p7.log
and
  /home/lwzheng/sagemath/sage-10.3/config.log
Describe your computer, operating system, etc.
If you want to try to fix the problem yourself, *don't* just cd to
/home/lwzheng/sagemath/sage-10.3/local/var/tmp/sage/build/tachyon-0.98.9.p7 and type 'make' or whatever is appropriate.
Instead, the following commands setup all environment variables
correctly and load a subshell for you to debug the error:
  (cd '/home/lwzheng/sagemath/sage-10.3/local/var/tmp/sage/build/tachyon-0.98.9.p7' && '/home/lwzheng/sagemath/sage-10.3/sage' --buildsh)
When you are done debugging, you can type "exit" to leave the subshell.
************************************************************************

@lwzhenglittle
Copy link
Author

通过一些非常 Dirty 的 Hack ,勉强 Workaround 掉了 Tachyon 的问题,看看下面还能有啥包需要调整。

@lwzhenglittle
Copy link
Author

新进展:已经编译出来了!

image.png

目前正在进行 make test

@lwzhenglittle
Copy link
Author

更新进度: make test 有失败

失败部分的摘要

sage -t --random-seed=148981849284651241199665828132196767613 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 14 doctests failed
sage -t --random-seed=148981849284651241199665828132196767613 src/sage/modular/abvar/abvar.py  # 1 doctest failed
sage -t --random-seed=148981849284651241199665828132196767613 src/sage/modular/hecke/submodule.py  # 1 doctest failed
sage -t --random-seed=148981849284651241199665828132196767613 src/sage/lfunctions/sympow.py  # 10 doctests failed
ell_rational_field.py 失败的完整日志
Running doctests with ID 2024-04-28-21-39-02-f5b8b412.
Git branch: develop
Git ref: 10.4.beta3-3-ga997ce97f7-dirty
Running with SAGE_LOCAL='/home/lwzheng/sagemath/sage-loongarch/local' and SAGE_VENV='/home/lwzheng/sagemath/sage-loongarch/local/var/lib/sage/venv-python3.10'
Using --optional=ccache,debian,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
Doctesting 1 file.
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/schemes/elliptic_curves/ell_rational_field.py
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 308, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field._set_modular_degree
Failed example:
    E.modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_pari_curve'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field._set_modular_degree[1]>", line 1, in <module>
        E.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 1492, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.analytic_rank
Failed example:
    E.analytic_rank(algorithm='sympow')
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.analytic_rank[3]>", line 1, in <module>
        E.analytic_rank(algorithm='sympow')
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 1549, in analytic_rank
        return sympow.analytic_rank(self)[0]
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 1498, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.analytic_rank
Failed example:
    E.analytic_rank(algorithm='all')
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.analytic_rank[5]>", line 1, in <module>
        E.analytic_rank(algorithm='all')
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 1566, in analytic_rank
        self.analytic_rank('sympow')}
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 1549, in analytic_rank
        return sympow.analytic_rank(self)[0]
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3901, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree
Failed example:
    E.modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree[2]>", line 1, in <module>
        E.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3904, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree
Failed example:
    E.modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_pari_curve'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree[4]>", line 1, in <module>
        E.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3911, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree
Failed example:
    EllipticCurve([0, 0, 1, -7, 6]).modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree[6]>", line 1, in <module>
        EllipticCurve([Integer(0), Integer(0), Integer(1), -Integer(7), Integer(6)]).modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3913, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree
Failed example:
    EllipticCurve([0, 0, 1, -7, 6]).modular_degree(algorithm='sympow')
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree[7]>", line 1, in <module>
        EllipticCurve([Integer(0), Integer(0), Integer(1), -Integer(7), Integer(6)]).modular_degree(algorithm='sympow')
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3924, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree
Failed example:
    factor(E.modular_degree())
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__minimal_model'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree[10]>", line 1, in <module>
        factor(E.modular_degree())
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4035, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
Failed example:
    E.congruence_number()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number[1]>", line 1, in <module>
        E.congruence_number()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4082, in congruence_number
        m = self.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4037, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
Failed example:
    E.congruence_number()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number[2]>", line 1, in <module>
        E.congruence_number()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4082, in congruence_number
        m = self.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4040, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
Failed example:
    E.congruence_number()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_pari_curve'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number[4]>", line 1, in <module>
        E.congruence_number()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4082, in congruence_number
        m = self.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4042, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
Failed example:
    E.modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number[5]>", line 1, in <module>
        E.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4045, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
Failed example:
    E.modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_pari_curve'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number[7]>", line 1, in <module>
        E.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4072, in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
Failed example:
    E.congruence_number()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number[10]>", line 1, in <module>
        E.congruence_number()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4082, in congruence_number
        m = self.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
4 items had failures:
   1 of   6 in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field._set_modular_degree
   2 of  13 in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.analytic_rank
   6 of  12 in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.congruence_number
   5 of  13 in sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_degree
    [888 tests, 14 failures, 52.40 s]
----------------------------------------------------------------------
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 14 doctests failed
----------------------------------------------------------------------
Total time for all tests: 57.8 seconds
    cpu time: 45.2 seconds
    cumulative wall time: 52.4 seconds
Features detected for doctesting: sage.plot,sage.rings.number_field
pytest is not installed in the venv, skip checking tests that rely on it

abvar.py 失败的完整日志
Running doctests with ID 2024-04-28-21-42-49-7b65b85b.
Git branch: develop
Git ref: 10.4.beta3-3-ga997ce97f7-dirty
Running with SAGE_LOCAL='/home/lwzheng/sagemath/sage-loongarch/local' and SAGE_VENV='/home/lwzheng/sagemath/sage-loongarch/local/var/lib/sage/venv-python3.10'
Using --optional=ccache,debian,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
Doctesting 1 file.
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/modular/abvar/abvar.py
**********************************************************************
File "src/sage/modular/abvar/abvar.py", line 3780, in sage.modular.abvar.abvar.ModularAbelianVariety_abstract.dual
Failed example:
    E.modular_degree()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'EllipticCurve_rational_field_with_category' object has no attribute '_pari_curve'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.modular.abvar.abvar.ModularAbelianVariety_abstract.dual[6]>", line 1, in <module>
        E.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
1 item had failures:
   1 of  13 in sage.modular.abvar.abvar.ModularAbelianVariety_abstract.dual
    [637 tests, 1 failure, 15.21 s]
----------------------------------------------------------------------
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/modular/abvar/abvar.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 15.4 seconds
    cpu time: 15.1 seconds
    cumulative wall time: 15.2 seconds
Features detected for doctesting: sage.libs.flint,sage.libs.pari,sage.rings.number_field
pytest is not installed in the venv, skip checking tests that rely on it

submodule.py 失败的完整日志
Running doctests with ID 2024-04-28-21-44-54-68e983bb.
Git branch: develop
Git ref: 10.4.beta3-3-ga997ce97f7-dirty
Running with SAGE_LOCAL='/home/lwzheng/sagemath/sage-loongarch/local' and SAGE_VENV='/home/lwzheng/sagemath/sage-loongarch/local/var/lib/sage/venv-python3.10'
Using --optional=ccache,debian,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
Doctesting 1 file.
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/modular/hecke/submodule.py
**********************************************************************
File "src/sage/modular/hecke/submodule.py", line 512, in sage.modular.hecke.submodule.HeckeSubmodule.dual_free_module
Failed example:
    EllipticCurve('128a').congruence_number()
Exception raised:
    Traceback (most recent call last):
      File "sage/structure/category_object.pyx", line 856, in sage.structure.category_object.CategoryObject.getattr_from_category
        return self._cached_methods[name]
    KeyError: '_EllipticCurve_rational_field__modular_degree'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3945, in modular_degree
        return self.__modular_degree
      File "sage/structure/category_object.pyx", line 850, in sage.structure.category_object.CategoryObject.__getattr__
        return self.getattr_from_category(name)
      File "sage/structure/category_object.pyx", line 865, in sage.structure.category_object.CategoryObject.getattr_from_category
        attr = getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
        raise AttributeError(dummy_error_message)
    AttributeError: 'sage.sets.pythonclass.Set_PythonType_class' object has no attribute '_Hom_'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.modular.hecke.submodule.HeckeSubmodule.dual_free_module[17]>", line 1, in <module>
        EllipticCurve('128a').congruence_number()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 4082, in congruence_number
        m = self.modular_degree()
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/schemes/elliptic_curves/ell_rational_field.py", line 3950, in modular_degree
        m = sympow.modular_degree(self)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
1 item had failures:
   1 of  19 in sage.modular.hecke.submodule.HeckeSubmodule.dual_free_module
    [141 tests, 1 failure, 7.81 s]
----------------------------------------------------------------------
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/modular/hecke/submodule.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 7.9 seconds
    cpu time: 7.8 seconds
    cumulative wall time: 7.8 seconds
Features detected for doctesting: sage.libs.flint,sage.libs.pari
pytest is not installed in the venv, skip checking tests that rely on it
sympow.py 失败的完整日志
Running doctests with ID 2024-04-28-21-45-46-a90cafa2.
Git branch: develop
Git ref: 10.4.beta3-3-ga997ce97f7-dirty
Running with SAGE_LOCAL='/home/lwzheng/sagemath/sage-loongarch/local' and SAGE_VENV='/home/lwzheng/sagemath/sage-loongarch/local/var/lib/sage/venv-python3.10'
Using --optional=ccache,debian,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
Doctesting 1 file.
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/lfunctions/sympow.py
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 223, in sage.lfunctions.sympow.Sympow.modular_degree
Failed example:
    sympow.modular_degree(EllipticCurve('11a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.modular_degree[0]>", line 1, in <module>
        sympow.modular_degree(EllipticCurve('11a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 225, in sage.lfunctions.sympow.Sympow.modular_degree
Failed example:
    sympow.modular_degree(EllipticCurve('37a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.modular_degree[1]>", line 1, in <module>
        sympow.modular_degree(EllipticCurve('37a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 227, in sage.lfunctions.sympow.Sympow.modular_degree
Failed example:
    sympow.modular_degree(EllipticCurve('389a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.modular_degree[2]>", line 1, in <module>
        sympow.modular_degree(EllipticCurve('389a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 229, in sage.lfunctions.sympow.Sympow.modular_degree
Failed example:
    sympow.modular_degree(EllipticCurve('5077a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.modular_degree[3]>", line 1, in <module>
        sympow.modular_degree(EllipticCurve('5077a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 231, in sage.lfunctions.sympow.Sympow.modular_degree
Failed example:
    sympow.modular_degree(EllipticCurve([1, -1, 0, -79, 289]))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.modular_degree[4]>", line 1, in <module>
        sympow.modular_degree(EllipticCurve([Integer(1), -Integer(1), Integer(0), -Integer(79), Integer(289)]))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 239, in modular_degree
        raise RuntimeError(f"failed to compute modular degree")
    RuntimeError: failed to compute modular degree
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 275, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('11a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.analytic_rank[0]>", line 1, in <module>
        sympow.analytic_rank(EllipticCurve('11a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 277, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('37a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.analytic_rank[1]>", line 1, in <module>
        sympow.analytic_rank(EllipticCurve('37a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 279, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('389a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.analytic_rank[2]>", line 1, in <module>
        sympow.analytic_rank(EllipticCurve('389a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 281, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('5077a'))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.analytic_rank[3]>", line 1, in <module>
        sympow.analytic_rank(EllipticCurve('5077a'))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 283, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve([1, -1, 0, -79, 289]))
Exception raised:
    Traceback (most recent call last):
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 715, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/doctest/forker.py", line 1147, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.lfunctions.sympow.Sympow.analytic_rank[4]>", line 1, in <module>
        sympow.analytic_rank(EllipticCurve([Integer(1), -Integer(1), Integer(0), -Integer(79), Integer(289)]))
      File "/home/lwzheng/sagemath/sage-loongarch/src/sage/lfunctions/sympow.py", line 297, in analytic_rank
        raise RuntimeError("failed to compute analytic rank")
    RuntimeError: failed to compute analytic rank
**********************************************************************
2 items had failures:
   5 of   6 in sage.lfunctions.sympow.Sympow.analytic_rank
   5 of   6 in sage.lfunctions.sympow.Sympow.modular_degree
    [10 tests, 10 failures, 0.16 s]
----------------------------------------------------------------------
sage -t --warn-long 40.5 --random-seed=148981849284651241199665828132196767613 src/sage/lfunctions/sympow.py  # 10 doctests failed
----------------------------------------------------------------------
Total time for all tests: 0.2 seconds
    cpu time: 0.1 seconds
    cumulative wall time: 0.2 seconds
Features detected for doctesting: 
pytest is not installed in the venv, skip checking tests that rely on it

简单观察发现和 sympow 这个组件有关,尝试直接编译运行 sympow

编译运行日志
lwzheng@lwzheng-3a5k [ src@develop ] ! pwd
/home/lwzheng/sagemath/sage-loongarch/local/var/tmp/sage/build/sympow-2.023.6/src
lwzheng@lwzheng-3a5k [ src@develop ] $ ./Configure 
CFLAGS for SYMPOW:  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH 
The double precision of your FPU is 53 bits.
ENDIANTUPLE for SYMPOW: le64
Makefile has been re-made. Use make if you wish to build SYMPOW

**ATTENTION** If you wish build SYMPOW, please ensure beforehand
that the various licenses of your C compiler, linker, assembler, etc.
allow you to create a derived work based on SYMPOW and your C libraries
lwzheng@lwzheng-3a5k [ src@develop ] $ make
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o fpu.o fpu.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o analrank.o analrank.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o analytic.o analytic.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o compute.o compute.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o compute2.o compute2.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o help.o help.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o conductors.o conductors.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o disk.o disk.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o ec_ap.o ec_ap.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o ec_ap_bsgs.o ec_ap_bsgs.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o ec_ap_large.o ec_ap_large.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o eulerfactors.o eulerfactors.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o factor.o factor.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o generate.o generate.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o init_curve.o init_curve.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o main.o main.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o moddeg.o moddeg.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o periods.o periods.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o prepare.o prepare.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o QD.o QD.c
QD.c: 在函数‘QD_div_22’中:
QD.c:77:15: 警告:‘QD_mul_21’ accessing 32 bytes in a region of size 16 [-Wstringop-overflow=]
   77 |  s=a[0]/b[0]; QD_mul_21(b,s,r); QD_diff(a[0],r[0],t,u);
      |               ^~~~~~~~~~~~~~~~
QD.c:77:15: 附注:referencing argument 3 of type ‘double[4]’
QD.c:62:13: 附注:in a call to function ‘QD_mul_21’
   62 | static void QD_mul_21(QD a,double b,QD c)
      |             ^~~~~~~~~
QD.c: 在函数‘QD_div_31’中:
QD.c:108:48: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  108 |  q0=a[0]/b; QD_prod(b,q0,t[0],t[1]); t[2]=0.0; QD_sub_33(a,t,r);
      |                                                ^~~~~~~~~~~~~~~~
QD.c:108:48: 附注:referencing argument 2 of type ‘double[4]’
QD.c:108:48: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
QD.c:108:48: 附注:referencing argument 3 of type ‘double[4]’
QD.c:89:13: 附注:in a call to function ‘QD_sub_33’
   89 | static void QD_sub_33(QD a,QD b,QD c)
      |             ^~~~~~~~~
QD.c:109:38: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  109 |  q1=r[0]/b; QD_prod(b,q1,t[0],t[1]); QD_sub_33(r,t,r);
      |                                      ^~~~~~~~~~~~~~~~
QD.c:109:38: 附注:referencing argument 1 of type ‘double[4]’
QD.c:109:38: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
QD.c:109:38: 附注:referencing argument 2 of type ‘double[4]’
QD.c:109:38: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
QD.c:109:38: 附注:referencing argument 3 of type ‘double[4]’
QD.c:89:13: 附注:in a call to function ‘QD_sub_33’
   89 | static void QD_sub_33(QD a,QD b,QD c)
      |             ^~~~~~~~~
QD.c: 在函数‘QD_div_33’中:
QD.c:114:16: 警告:‘QD_mul_31’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  114 |  q0=a[0]/b[0]; QD_mul_31(b,q0,t); QD_sub_33(a,t,r);
      |                ^~~~~~~~~~~~~~~~~
QD.c:114:16: 附注:referencing argument 3 of type ‘double[4]’
QD.c:94:13: 附注:in a call to function ‘QD_mul_31’
   94 | static void QD_mul_31(QD a,double b,QD c)
      |             ^~~~~~~~~
QD.c:114:35: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  114 |  q0=a[0]/b[0]; QD_mul_31(b,q0,t); QD_sub_33(a,t,r);
      |                                   ^~~~~~~~~~~~~~~~
QD.c:114:35: 附注:referencing argument 2 of type ‘double[4]’
QD.c:114:35: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
QD.c:114:35: 附注:referencing argument 3 of type ‘double[4]’
QD.c:89:13: 附注:in a call to function ‘QD_sub_33’
   89 | static void QD_sub_33(QD a,QD b,QD c)
      |             ^~~~~~~~~
QD.c:115:16: 警告:‘QD_mul_31’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  115 |  q1=r[0]/b[0]; QD_mul_31(b,q1,t); QD_sub_33(r,t,r);
      |                ^~~~~~~~~~~~~~~~~
QD.c:115:16: 附注:referencing argument 3 of type ‘double[4]’
QD.c:94:13: 附注:in a call to function ‘QD_mul_31’
   94 | static void QD_mul_31(QD a,double b,QD c)
      |             ^~~~~~~~~
QD.c:115:35: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
  115 |  q1=r[0]/b[0]; QD_mul_31(b,q1,t); QD_sub_33(r,t,r);
      |                                   ^~~~~~~~~~~~~~~~
QD.c:115:35: 附注:referencing argument 1 of type ‘double[4]’
QD.c:115:35: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
QD.c:115:35: 附注:referencing argument 2 of type ‘double[4]’
QD.c:115:35: 警告:‘QD_sub_33’ accessing 32 bytes in a region of size 24 [-Wstringop-overflow=]
QD.c:115:35: 附注:referencing argument 3 of type ‘double[4]’
QD.c:89:13: 附注:in a call to function ‘QD_sub_33’
   89 | static void QD_sub_33(QD a,QD b,QD c)
      |             ^~~~~~~~~
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o rootno.o rootno.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH   -c -o util.o util.c
gcc   -O3  -std=gnu17 -fno-fast-math -ffp-contract=on -DFPUCONTROLH  -o sympow  fpu.o analrank.o analytic.o compute.o compute2.o help.o conductors.o disk.o ec_ap.o ec_ap_bsgs.o ec_ap_large.o eulerfactors.o factor.o generate.o init_curve.o main.o moddeg.o periods.o prepare.o QD.o rootno.o util.o  
touch sympow.1
lwzheng@lwzheng-3a5k [ src@develop ] $ ./sympow 
**ERROR** QD_check failed at x[1]
sympow 2.023.6 RELEASE  (c) Mark Watkins -

发现不能正常编译运行,先睡觉了,明天再研究

@lwzhenglittle
Copy link
Author

lwzhenglittle commented Apr 28, 2024

找到问题了,构建 sympow 时会自动开启 -DFPUCONTROLH

相关代码 fpu.c

/* David Kirkby 21st August 2010
Licenced under the GPL version 2 or at your option any later version.

Set the FPU's precision control to 53 bits (double precision) instead of
the default 64-bits (extended precision). I've commented it fairly
liberally, with the hope it's helpful if anyone needs to edit it.

Note, the extended precision uses 80 bits in total,
of which 64 are for the mantissa.

Double precsion uses 64 bits in total, but ony 53 are
for the mantissa.

The precision is set by bits 8 and 9 of the Control Word in the floating
point processor. The Control word has 16 bits.

Data taken from The 80387 Programmer's reference Manual, Intel,
1987.

00 = 24-bits (single precision)
01 = reserved (or at least it was at the time the 387 was released)
10 = 53-bits (double precision)
11 = 64-bits (extended precision).

FLDCW is an x86 instruction to "Load the Control Word"
FNSTCW is an x88 instruction to "Store FPU Control Word"
It does so without checking for pending unmasked floating-point
exceptions. (A similar FSTCW checks for them first).
*/

/*
 * Rrefreshed and revisited for Debian on behalf of the Debian Science Team
 * by Jerome Benoit <calculus@rezozer.net>, 2014-10-07.
 */

#if defined(ISOC99_FENV)
#include <fenv.h>
#elif defined(FPUCONTROLH)
#include <fpu_control.h>
#define ADHOC__FPU_OR_MASK_EXTENDED (((fpu_control_t)(0x1) << 8) | ((fpu_control_t)(0x1) << 9))
#define ADHOC__FPU_AND_MASK_DOUBLE (~((fpu_control_t)(0x1) << 8))
#elif defined(x86)
#define _SET_FPU_CONTROL_WORD(x) asm volatile ("fldcw %0": :"m" (x));
#define _READ_FPU_CONTROL_WORD(x) asm volatile ("fnstcw %0":"=m" (x));
#else
#endif

void fpu_53bits()
{

#if defined(ISOC99_FENV)
    fesetprec(FE_DBLPREC);
#elif defined(FPUCONTROLH)
    fpu_control_t fpu_control=_FPU_DEFAULT;
    _FPU_GETCW(fpu_control);
    fpu_control|=ADHOC__FPU_OR_MASK_EXTENDED;
    fpu_control&=ADHOC__FPU_AND_MASK_DOUBLE;
		_FPU_SETCW(fpu_control);
#elif defined(x86)
    /* The control word is 16 bits, numbered 0 to 15 */
    volatile unsigned short control_word;

    _READ_FPU_CONTROL_WORD(control_word); /* Read the FPU control word */
    control_word=control_word & 0xfeff; /* Set bit 8 = 0 */
    control_word=control_word | 0x200; /* Set bit 9 = 1 */
    _SET_FPU_CONTROL_WORD(control_word); /* Force double-precision, 53-bit mantissa */
#endif

}

去掉这个选项重新构建即可通过以上几个 test。

目前没有比较好的 patch 方法,有 idea 可以直接回复。

@lwzhenglittle
Copy link
Author

同时发现了 clang 和 gcc 不一致的行为,分别运行

clang   -O3 -g -std=gnu17 -fno-fast-math -ffp-contract=on  -c -o fpu.o fpu.c -DFPUCONTROLH
gcc -O3 -g -std=gnu17 -fno-fast-math -ffp-contract=on  -c -o fpu.o fpu.c -DFPUCONTROLH

gcc 没有输出

clang 输出

fpu.c:55:5: error: invalid operand for instruction
   55 |     _FPU_GETCW(fpu_control);
      |     ^
/usr/include/fpu_control.h:94:42: note: expanded from macro '_FPU_GETCW'
   94 | #define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$r0" : "=r"(cw))
      |                                          ^
<inline asm>:1:18: note: instantiated into assembly here
    1 |         movfcsr2gr $a0,$r0
      |                         ^
fpu.c:58:3: error: invalid operand for instruction
   58 |                 _FPU_SETCW(fpu_control);
      |                 ^
/usr/include/fpu_control.h:95:42: note: expanded from macro '_FPU_SETCW'
   95 | #define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $r0,%0" : : "r"(cw))
      |                                          ^
<inline asm>:1:14: note: instantiated into assembly here
    1 |         movgr2fcsr $r0,$a0
      |                     ^
2 errors generated.

@xry111
Copy link
Member

xry111 commented Apr 29, 2024

同时发现了 clang 和 gcc 不一致的行为,分别运行

clang   -O3 -g -std=gnu17 -fno-fast-math -ffp-contract=on  -c -o fpu.o fpu.c -DFPUCONTROLH
gcc -O3 -g -std=gnu17 -fno-fast-math -ffp-contract=on  -c -o fpu.o fpu.c -DFPUCONTROLH

gcc 没有输出

clang 输出

fpu.c:55:5: error: invalid operand for instruction
   55 |     _FPU_GETCW(fpu_control);
      |     ^
/usr/include/fpu_control.h:94:42: note: expanded from macro '_FPU_GETCW'
   94 | #define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$r0" : "=r"(cw))
      |                                          ^
<inline asm>:1:18: note: instantiated into assembly here
    1 |         movfcsr2gr $a0,$r0
      |                         ^
fpu.c:58:3: error: invalid operand for instruction
   58 |                 _FPU_SETCW(fpu_control);
      |                 ^
/usr/include/fpu_control.h:95:42: note: expanded from macro '_FPU_SETCW'
   95 | #define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $r0,%0" : : "r"(cw))
      |                                          ^
<inline asm>:1:14: note: instantiated into assembly here
    1 |         movgr2fcsr $r0,$a0
      |                     ^
2 errors generated.

https://sourceware.org/pipermail/libc-alpha/2024-April/156376.html

@lwzhenglittle
Copy link
Author

lwzhenglittle commented Apr 29, 2024

设备在学校,五一假期期间估计没啥进度,等节后开始研究进一步的补丁和打包。

@xen0n xen0n added 英雄帖 Volunteers welcome! AREA: Arch optimization Architecture-specific enablement or optimization (e.g. addition of LoongArch SIMD codepaths) labels May 8, 2024
@lwzhenglittle
Copy link
Author

最近事情比较多,在参考其他发行版研究打包格式和 sage 运行所需要的环境变量。

@lwzhenglittle
Copy link
Author

喜报,现在 https://github.com/lwzhenglittle/sage-loongarch 已经可以在龙芯上构建了,只需:

git clone https://github.com/lwzhenglittle/sage-loongarch.git
cd sage-loongarch
make configure
./configure
make -j4

构建完成后即可在项目根目录下执行 ./sage 来运行 Sagemath。

目前正在测试 make ptestlong

saagarjha pushed a commit to ahjragaas/glibc that referenced this issue May 28, 2024
Clang inline-asm parser does not allow using "$r0" in
movfcsr2gr/movgr2fcsr, so everything using _FPU_{GET,SET}CW is now
failing to build with Clang on LoongArch.  As we now requires Binutils
>= 2.41 which supports using "$fcsr0" here, use it instead of "$r0" to
fix the issue.

Link: loongson-community/discussions#53 (comment)
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA: Arch optimization Architecture-specific enablement or optimization (e.g. addition of LoongArch SIMD codepaths) 英雄帖 Volunteers welcome!
Projects
None yet
Development

No branches or pull requests

3 participants