Bug 1913346

Summary: libsbml fails to build with Python 3.10: Imports the removed formatter module
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: libsbmlAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, neuro-sig, thrnciar, trpost, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-21 08:25:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1890881    

Description Tomáš Hrnčiar 2021-01-06 14:53:22 UTC
libsbml fails to build with Python 3.10.0a4.

cd /builddir/build/BUILD/libSBML-5.18.0-Source/build/src && /usr/bin/cmake -E cmake_symlink_library libsbml.so.5.18.0 libsbml.so.5 libsbml.so
make[2]: Leaving directory '/builddir/build/BUILD/libSBML-5.18.0-Source/build'
In function 'strncpy',
    inlined from '__ct_base ' at /builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/xml/XMLMemoryBuffer.cpp:62:10:
/usr/include/bits/string_fortified.h:91:34: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   91 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |                                  ^
/builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/xml/XMLMemoryBuffer.cpp: In member function '__ct_base ':
/builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/xml/XMLMemoryBuffer.cpp:59:27: note: length computed here
   59 |   size_t bufsize  = strlen(buffer);
      |                           ^
In function 'strncpy',
    inlined from 'file_build_ioposix' at /builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/compress/ioapi.c:123:5,
    inlined from 'fopen_file_func' at /builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/compress/ioapi.c:141:16:
/usr/include/bits/string_fortified.h:91:10: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   91 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^
/builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/compress/ioapi.c: In function 'fopen_file_func':
/builddir/build/BUILD/libSBML-5.18.0-Source/src/sbml/compress/ioapi.c:121:31: note: length computed here
  121 |     ioposix->filenameLength = strlen(filename) + 1;
      |                               ^
make[1]: Entering directory '/builddir/build/BUILD/libSBML-5.18.0-Source/build'
[ 70%] Built target sbml
make[1]: Leaving directory '/builddir/build/BUILD/libSBML-5.18.0-Source/build'
make: *** [Makefile:185: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.oEPHut (%build)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01859884-libsbml/

For all our attempts to build libsbml with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/libsbml/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Antonio T. sagitter 2021-01-06 18:01:34 UTC
??

[ 70%] Swig Python source
cd /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python && /usr/bin/python3 /builddir/build/BUILD/libSBML-5.18.0-Source/src/bindings/python/../swig/swigdoc.py --language python --top /builddir/build/BUILD/libSBML-5.18.0-Source --master /builddir/build/BUILD/libSBML-5.18.0-Source/src/bindings/python/../swig/libsbml.i --output /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/pydoc-doxygen.i --define USE_COMP --define USE_FBC --define USE_GROUPS --define USE_L3V2EXTENDEDMATH --define USE_LAYOUT --define USE_MULTI --define USE_QUAL --define USE_RENDER --define USE_COMP --define USE_FBC --define USE_GROUPS --define USE_L3V2EXTENDEDMATH --define USE_MULTI --define USE_QUAL --define USE_RENDER
cd /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python && /usr/bin/python3 /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/generate-class-name-list.py /builddir/build/BUILD/libSBML-5.18.0-Source/src > /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/class-list.txt
cd /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python && /usr/bin/python3 /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/generate-converters-list.py /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/class-list.txt > /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/libsbml-converters.txt
cd /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python && /usr/bin/python3 /builddir/build/BUILD/libSBML-5.18.0-Source/src/bindings/python/doc-converter/rewrite_pydoc.py -f /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/pydoc-doxygen.i -o /builddir/build/BUILD/libSBML-5.18.0-Source/build/src/bindings/python/pydoc-normal.i -i /builddir/build/BUILD/libSBML-5.18.0-Source/src/bindings/python/../../../docs/src/common-text -g /builddir/build/BUILD/libSBML-5.18.0-Source/src/bindings/python/../../../docs/src/common-graphics
Traceback (most recent call last):
  File "/builddir/build/BUILD/libSBML-5.18.0-Source/src/bindings/python/doc-converter/rewrite_pydoc.py", line 121, in <module>
    from formatter import NullWriter, AbstractFormatter
ModuleNotFoundError: No module named 'formatter'

Comment 2 Miro Hrončok 2021-01-06 18:10:57 UTC
Yes, that is the actual error. Do you know where is the formatter module suppose to come from?

Comment 3 Miro Hrončok 2021-01-06 18:14:17 UTC
formatter: Deprecated since version 3.4: Due to lack of usage, the formatter module has been deprecated.

https://docs.python.org/3.10/whatsnew/3.10.html#removed

Removed the formatter module, which was deprecated in Python 3.4. It is somewhat obsolete, little used, and not tested. It was originally scheduled to be removed in Python 3.6, but such removals were delayed until after Python 2.7 EOL. Existing users should copy whatever classes they use into their code. (Contributed by Dong-hee Na and Terry J. Reedy in https://bugs.python.org/issue42299.)

Comment 4 Antonio T. sagitter 2021-01-06 19:10:09 UTC
@Zbigniew,

i was about to open a bug ticket for upstream; do you prefer to patch libsbml for this issue?

Comment 5 Zbigniew Jędrzejewski-Szmek 2021-01-14 10:20:29 UTC
There's a bunch of issues. I had it building already, but then upgrades in rawhide caused more issues.
So I want to figure it out all the way, and then file a bug upstream.

Comment 6 Zbigniew Jędrzejewski-Szmek 2021-01-21 08:25:32 UTC
Works: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/1888326/.