Bug 1706233

Summary: hplip FTBFS with python3.8
Product: [Fedora] Fedora Reporter: Charalampos Stratakis <cstratak>
Component: hplipAssignee: Zdenek Dohnal <zdohnal>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: bkabrda, cstratak, dmalcolm, jpopelka, jridky, mcyprian, mhroncok, pviktori, rkuska, shcherbina.iryna, tkorbar, tomspur, torsava, twaugh, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hplip-3.18.12-11.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-17 12:13:57 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:
Bug Depends On:    
Bug Blocks: 1686977    
Attachments:
Description Flags
Full log from Copr
none
Full log from Copr (Python 3.8.0a4)
none
config.log none

Description Charalampos Stratakis 2019-05-03 20:53:23 UTC
Created attachment 1562733 [details]
Full log from Copr

hplip-3.18.12-9 fails to build with Python 3.8. It seems that for some reason the configure script can't find Python.h:

checking whether /usr/bin/python3 version is >= 2.2... yes
checking for /usr/bin/python3 version... 3.8
checking for /usr/bin/python3 platform... linux
checking for /usr/bin/python3 script directory... ${prefix}/lib/python3.8/site-packages
checking for /usr/bin/python3 extension module directory... ${exec_prefix}/lib64/python3.8/site-packages
checking for path to Python.h... "using /usr/include/python3.8m ....  python3.8/Python.h"
checking python3.8/Python.h usability... no
checking python3.8/Python.h presence... no
checking for python3.8/Python.h... no
checking python3.8mu/Python.h usability... no
checking python3.8mu/Python.h presence... no
checking for python3.8mu/Python.h... no
checking python3.8m/Python.h usability... no
checking python3.8m/Python.h presence... no
checking for python3.8m/Python.h... no
configure: error: cannot find python-devel support

Full log attached

Comment 1 Zdenek Dohnal 2019-05-15 13:01:43 UTC
Hi Charis!

Thank you for reporting the issue! I was on PTO last two weeks, so I was not able to get it done. Hope it did not block someone...

From config.log:

configure:13745: checking python3.8/Python.h usability
configure:13745: gcc -c -g -O2  conftest.c >&5
In file included from /usr/include/python3.8/pystate.h:129,
                 from /usr/include/python3.8/traceback.h:8,
                 from /usr/include/python3.8/Python.h:117,
                 from conftest.c:67:
/usr/include/python3.8/cpython/pystate.h:9:10: fatal error: cpython/coreconfig.h: No such file or directory
    9 | #include "cpython/coreconfig.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
configure:13745: $? = 1

In my local F29 machine:
$ dnf repoquery --whatprovides *cpython/coreconfig.h
python38-0:3.8.0~a3-1.fc29.i686
python38-0:3.8.0~a3-1.fc29.x86_64
python38-debugsource-0:3.8.0~a3-1.fc29.i686
python38-debugsource-0:3.8.0~a3-1.fc29.x86_64

In mock chroot:
<mock-chroot> -bash-5.0# rpm -q python3
python3-3.8.0~a4-1.fc31.x86_64
<mock-chroot> -bash-5.0# rpm -q python38
package python38 is not installed

It seems like an include for header from python38-devel package got lost in header file from python3-devel package. Reassigning to python team, IMO it is issue in python.

Comment 2 Miro Hrončok 2019-05-15 13:41:58 UTC
The build failure is from our copr with updated python3 package: https://copr.fedorainfracloud.org/coprs/g/python/python3.8/ - a work in progress copr for Fedora 31 change.

$ dnf repoquery --repo=python3.8 --whatprovides *cpython/coreconfig.h
python3-debug-0:3.8.0~a4-1.fc31.x86_64
python3-debugsource-0:3.8.0~a4-1.fc31.x86_64
python3-devel-0:3.8.0~a4-1.fc31.x86_64

$ dnf repoquery --repo=python3.8 -l python3-devel | grep cpython/coreconfig.h
/usr/include/python3.8/cpython/coreconfig.h


> It seems like an include for header from python38-devel package got lost in header file from python3-devel package.

I don't really understand what does this mean. I think hplib does some configure-fu that is no longer valid for Python 3.8.

Comment 3 Miro Hrončok 2019-05-15 14:02:15 UTC
How do I get the config.log?

Comment 4 Miro Hrončok 2019-05-15 14:07:37 UTC
Never mind, found it:

| #include <python3.8/Python.h>
configure:13745: result: no
configure:13745: checking python3.8/Python.h presence
configure:13745: gcc -E  conftest.c
In file included from /usr/include/python3.8/pystate.h:129,
                 from /usr/include/python3.8/traceback.h:8,
                 from /usr/include/python3.8/Python.h:117,
                 from conftest.c:34:
/usr/include/python3.8/cpython/pystate.h:9:10: fatal error: cpython/coreconfig.h: No such file or directory
    9 | #include "cpython/coreconfig.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
configure:13745: $? = 1





Note that the following is not supposed to work:

#include <python3.8/Python.h>

And hence it is a terrible idea to check from a configure script: 

Instead, do this:

Set -I /usr/include/python3.8 and do:

#include <Python.h>

Comment 5 Miro Hrončok 2019-05-15 14:12:46 UTC
Bad:

$ cat bad.c 
#include <python3.8/Python.h>
$ gcc -c bad.c 
In file included from /usr/include/python3.8/pystate.h:129,
                 from /usr/include/python3.8/traceback.h:8,
                 from /usr/include/python3.8/Python.h:117,
                 from bad.c:1:
/usr/include/python3.8/cpython/pystate.h:9:10: fatal error: cpython/coreconfig.h: Adresář nebo soubor neexistuje
    9 | #include "cpython/coreconfig.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
$ 

Better:

$ cat good.c
#include <Python.h>
$ gcc -I/usr/include/python3.8 -c good.c 
$ 

The best:

$ cat good.c
#include <Python.h>
$ gcc $(python3.8-config --includes) -c good.c
$

Comment 6 Miro Hrončok 2019-05-15 14:27:19 UTC
Created attachment 1569010 [details]
Full log from Copr (Python 3.8.0a4)

Up to date logs attached.

Comment 7 Miro Hrončok 2019-05-15 14:27:56 UTC
Created attachment 1569011 [details]
config.log

Comment 8 Zdenek Dohnal 2019-05-16 13:53:12 UTC
(In reply to Miro Hrončok from comment #4)
> And hence it is a terrible idea to check from a configure script: 

Do you mean do not check python usability in configure at all?

> $ gcc $(python3.8-config --includes) -c good.c

I used python3-config, is it ok?

Comment 9 Miro Hrončok 2019-05-16 14:03:28 UTC
(In reply to Zdenek Dohnal from comment #8)
> (In reply to Miro Hrončok from comment #4)
> > And hence it is a terrible idea to check from a configure script: 
> 
> Do you mean do not check python usability in configure at all?

No, I mean to do it this way.

> > $ gcc $(python3.8-config --includes) -c good.c
> 
> I used python3-config, is it ok?

Sure!

Comment 10 Zdenek Dohnal 2019-05-17 08:12:19 UTC
(In reply to Miro Hrončok from comment #9)
> (In reply to Zdenek Dohnal from comment #8)
> > (In reply to Miro Hrončok from comment #4)
> > > And hence it is a terrible idea to check from a configure script: 
> > 
> > Do you mean do not check python usability in configure at all?
> 
> No, I mean to do it this way.

Do you mean use python3-config in configure script? I understood you suggest to run python3-config in spec file and output put into CFLAGS/CXXFLAGS.

Comment 11 Miro Hrončok 2019-05-17 10:09:56 UTC
I suggest that running ggc without include flags on this:

    #include <python3.8/Python.h>

Is not supposed to work.

Comment 12 Zdenek Dohnal 2019-05-17 12:13:57 UTC
Fixed in https://koji.fedoraproject.org/koji/taskinfo?taskID=34892600 by adding python includedir into CFLAGS+CXXFLAGS in spec file.