Bug 1808321

Summary: python-cvxopt fails to build with Python 3.9: src/C/lapack.c:6910:28: error: expected ‘;’ before ‘a’
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-cvxoptAssignee: Jerry James <loganjerry>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, loganjerry, mhroncok, mplch, pviktori
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: 2020-03-01 16:42:54 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: 1785415    

Description Miro Hrončok 2020-02-28 09:21:34 UTC
python-cvxopt fails to build with Python 3.9.0a4.

gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I/usr/include/python3.9 -c src/C/lapack.c -o build/temp.linux-x86_64-3.9/src/C/lapack.o
In file included from /usr/include/python3.9/pytime.h:6,
                 from /usr/include/python3.9/Python.h:85,
                 from src/C/lapack.c:22:
src/C/lapack.c: In function ‘fselect_c’:
/usr/include/python3.9/object.h:623:41: error: expected ‘(’ before ‘PyType_HasFeature’
  623 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/usr/include/python3.9/longobject.h:15:9: note: in expansion of macro ‘PyType_FastSubclass’
   15 |         PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
      |         ^~~~~~~~~~~~~~~~~~~
src/C/lapack.c:6664:8: note: in expansion of macro ‘PyLong_Check’
 6664 |     if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |        ^~~~~~~~~~~~
src/C/lapack.c:6664:29: error: expected ‘;’ before ‘a’
 6664 |     if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |                             ^
In file included from /usr/include/python3.9/pytime.h:6,
                 from /usr/include/python3.9/Python.h:85,
                 from src/C/lapack.c:22:
src/C/lapack.c: In function ‘fselect_r’:
/usr/include/python3.9/object.h:623:41: error: expected ‘(’ before ‘PyType_HasFeature’
  623 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/usr/include/python3.9/longobject.h:15:9: note: in expansion of macro ‘PyType_FastSubclass’
   15 |         PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
      |         ^~~~~~~~~~~~~~~~~~~
src/C/lapack.c:6686:8: note: in expansion of macro ‘PyLong_Check’
 6686 |     if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |        ^~~~~~~~~~~~
src/C/lapack.c:6686:29: error: expected ‘;’ before ‘a’
 6686 |     if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |                             ^
In file included from /usr/include/python3.9/pytime.h:6,
                 from /usr/include/python3.9/Python.h:85,
                 from src/C/lapack.c:22:
src/C/lapack.c: In function ‘fselect_gc’:
/usr/include/python3.9/object.h:623:41: error: expected ‘(’ before ‘PyType_HasFeature’
  623 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/usr/include/python3.9/longobject.h:15:9: note: in expansion of macro ‘PyType_FastSubclass’
   15 |         PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
      |         ^~~~~~~~~~~~~~~~~~~
src/C/lapack.c:6886:7: note: in expansion of macro ‘PyLong_Check’
 6886 |    if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |       ^~~~~~~~~~~~
src/C/lapack.c:6886:28: error: expected ‘;’ before ‘a’
 6886 |    if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |                            ^
In file included from /usr/include/python3.9/pytime.h:6,
                 from /usr/include/python3.9/Python.h:85,
                 from src/C/lapack.c:22:
src/C/lapack.c: In function ‘fselect_gr’:
/usr/include/python3.9/object.h:623:41: error: expected ‘(’ before ‘PyType_HasFeature’
  623 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/usr/include/python3.9/longobject.h:15:9: note: in expansion of macro ‘PyType_FastSubclass’
   15 |         PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
      |         ^~~~~~~~~~~~~~~~~~~
src/C/lapack.c:6910:7: note: in expansion of macro ‘PyLong_Check’
 6910 |    if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |       ^~~~~~~~~~~~
src/C/lapack.c:6910:28: error: expected ‘;’ before ‘a’
 6910 |    if PyLong_Check(result) a = (int) PyLong_AsLong(result);
      |                            ^
error: command 'gcc' failed with exit status 1


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01255929-python-cvxopt/

For all our attempts to build python-cvxopt with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-cvxopt/

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.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
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 Petr Viktorin (pviktori) 2020-02-28 10:20:08 UTC
In C, `if` expressions should be parenthesized, so that line should read:

    if (PyLong_Check(result)) a = (int) PyLong_AsLong(result);

I guess PyLong_Check happened to expand to a parenthesized expression before, but that's not API to rely on.

Comment 2 Jerry James 2020-03-01 16:42:54 UTC
Thanks, Petr.  Upstream pull request:

https://github.com/cvxopt/cvxopt/pull/164

I have added that patch and built for Rawhide.