Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 793962 - media-gfx/freecad: Should respect PYTHON_TARGET at build time and specify -DPYTHON_EXECUTABLE="${EPYTHON}"
Summary: media-gfx/freecad: Should respect PYTHON_TARGET at build time and specify -DP...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernd
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-02 19:35 UTC by Andrew Nowa Ammerlaan
Modified: 2021-06-05 12:03 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
CMakeOutput (CMakeOutput.log,51.35 KB, text/plain)
2021-06-02 19:35 UTC, Andrew Nowa Ammerlaan
Details
buildlog (build.log,20.70 KB, text/plain)
2021-06-02 19:41 UTC, Andrew Nowa Ammerlaan
Details
CMakeError.log (CMakeError.log,2.41 KB, text/plain)
2021-06-05 11:16 UTC, Andrew Nowa Ammerlaan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Nowa Ammerlaan gentoo-dev 2021-06-02 19:35:44 UTC
Created attachment 713346 [details]
CMakeOutput

Since dev-python/pyside2 gained the python3_9 compat target, freecad fails to build with this error: 

```
-- Found PythonLibs: /usr/lib64/libpython3.8.so (found suitable version "3.8.10", minimum required is "3") 
CMake Error at /usr/lib64/cmake/Shiboken2-5.15.2/shiboken_helpers.cmake:468 (message):
The detected Python minor version is not compatible with the Python minor
version which was used when Shiboken was built.  Consider building shiboken
with FORCE_LIMITED_API set to '1', so that only the Python major version
matters.

Built with: '3.9' Detected: '3.8'
Call Stack (most recent call first):
/usr/lib64/cmake/Shiboken2-5.15.2/Shiboken2Config-python3.9.cmake:55 (shiboken_check_if_built_and_target_python_are_compatible)
/usr/lib64/cmake/Shiboken2-5.15.2/Shiboken2Config.cmake:5 (include)
cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake:25 (find_package)
CMakeLists.txt:70 (SetupShibokenAndPyside)
```

Because freecad does have a dependency on dev-python/shiboken2[${PYTHON_MULTI_USEDEP}] the correct shiboken2 version is actually present. However the build system appears to execute the default python interpreter (which is python3.9 on my system), and therefore executes shiboken2 with python3.9, with this error as a result. We could of course follow the suggestion in the output, but I think it is better to fix the freecad ebuild to actually use/execute the python version that is specified as it's PYTHON_SINGLE_TARGET, since the build process should respect this flag (i.e. python3.8).

Adding the following option to the configure phase fixes this error, but introduces another which may or may not be related (CMakeOutput attached):
```
-DPYTHON_EXECUTABLE="${EPYTHON}"
```
Comment 1 Andrew Nowa Ammerlaan gentoo-dev 2021-06-02 19:41:53 UTC
Created attachment 713349 [details]
buildlog

and the full build log
Comment 2 Bernd 2021-06-03 08:07:39 UTC
(In reply to Andrew Ammerlaan from comment #0)
> Adding the following option to the configure phase fixes this error, but
> introduces another which may or may not be related (CMakeOutput attached):
> ```
> -DPYTHON_EXECUTABLE="${EPYTHON}"
> ```

Thanks for the report. There was a similar option once in the ebuild, but at some time it wasn't needed anymore, so I removed it.
Btw. the option should read "-DPython_EXECUTABLE" and probably even better would be to use "-DPython3_EXECUTABLE" as the package doesn't support python-2, and this avoids cmake checking for any usable interpreter.
Comment 3 Bernd 2021-06-03 08:10:05 UTC
I couldn't find any error in the CMakeOutput.log file you've attached. Are you able to point the error in this file, which you've encountered?
AFAIK errors are usually written to a CMakeError.log file.
Comment 4 Andrew Nowa Ammerlaan gentoo-dev 2021-06-03 08:29:15 UTC
(In reply to Bernd from comment #3)
> I couldn't find any error in the CMakeOutput.log file you've attached. Are
> you able to point the error in this file, which you've encountered?
> AFAIK errors are usually written to a CMakeError.log file.

For some reason I didn't get a CMakeError.log from this failure, but the error message is in the full build log, though it is not very helpful:
```
CMake Error at /usr/share/cmake/pybind11/FindPythonLibsNew.cmake:133 (message):
  Python config failure:
```

Perhaps the content of -DPython_EXECUTABLE is simply wrong. It does show this earlier in the log, so it does find the correct python version:
```
-- Found PythonInterp: /var/tmp/portage/media-gfx/freecad-0.19.2/work/freecad-0.19.2_build/python3.8  
-- Found PythonLibs: /usr/lib64/libpython3.8.so (found version "3.8.10") 
```
Comment 5 Bernd 2021-06-03 09:19:58 UTC
(In reply to Andrew Ammerlaan from comment #0)
> Adding the following option to the configure phase fixes this error, but
> introduces another which may or may not be related (CMakeOutput attached):

I noticed the error in the build log, but you're writing about another error in CMakeOutput here.
Comment 6 Andrew Nowa Ammerlaan gentoo-dev 2021-06-03 09:22:25 UTC
(In reply to Bernd from comment #5)
> (In reply to Andrew Ammerlaan from comment #0)
> > Adding the following option to the configure phase fixes this error, but
> > introduces another which may or may not be related (CMakeOutput attached):
> 
> I noticed the error in the build log, but you're writing about another error
> in CMakeOutput here.

That was the one I meant, sorry for the confusion, I didn't write it down very clearly.
Comment 7 Andrew Nowa Ammerlaan gentoo-dev 2021-06-05 11:16:45 UTC
Created attachment 713820 [details]
CMakeError.log

Found the solution: 
```
		-DPYTHON_CONFIG_SUFFIX="${EPYTHON}"
```
/usr/lib64/cmake/Shiboken2-5.15.2/Shiboken2Config.cmake has:
```
if (NOT PYTHON_CONFIG_SUFFIX)
    message(STATUS "Shiboken2Config: Using default python: -python3.9")
    SET(PYTHON_CONFIG_SUFFIX -python3.9)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake")
```
So adding this variable makes cmake use shiboken2-python3.8 instead of the default shiboken2-python3.9.

However, now I get a different error (CMakeErrors.log attached): cannot find -lpthreads
Comment 8 Andrew Nowa Ammerlaan gentoo-dev 2021-06-05 11:25:59 UTC
Okay never mind, it was just missing a dash s/${EPYTHON}/-${EPYTHON}/g (facepalm)

So we should add:
```
      -DPYTHON_CONFIG_SUFFIX="-${EPYTHON}"
```

@waebbl do you mind if I go ahead and add this to your freecad ebuild, or would you like to do this yourself?
Comment 9 Bernd 2021-06-05 11:37:21 UTC
@Andrew, nice, I just did a first check and found the shiboken2 cmake files, to be the source, but didn't had the time to look into it further.
Go ahead if you like! Please also update the 0.19.1 and live ebuild.
Comment 10 Larry the Git Cow gentoo-dev 2021-06-05 11:56:09 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12f82ac6b59dcbb679a0a5a4b819ac0ba2f6193a

commit 12f82ac6b59dcbb679a0a5a4b819ac0ba2f6193a
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2021-06-05 11:42:21 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2021-06-05 11:56:04 +0000

    media-gfx/freecad: use the shiboken2 that matches python version
    
    Closes: https://bugs.gentoo.org/793962
    Package-Manager: Portage-3.0.19, Repoman-3.0.3
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 media-gfx/freecad/freecad-0.19.1.ebuild | 3 +++
 media-gfx/freecad/freecad-0.19.2.ebuild | 3 +++
 media-gfx/freecad/freecad-9999.ebuild   | 3 +++
 3 files changed, 9 insertions(+)
Comment 11 Bernd 2021-06-05 12:03:42 UTC
Thanks Andrew!