Bug 479260 - building fails with cmake 3.27 + extra-cmake-modules due to CMP0148
Summary: building fails with cmake 3.27 + extra-cmake-modules due to CMP0148
Status: RESOLVED NOT A BUG
Alias: None
Product: kdev-python
Classification: Developer tools
Component: general (show other bugs)
Version: git master
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-01 15:43 UTC by Björn Strömberg
Modified: 2024-01-01 20:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
APKBUILD for alpine v3.19 + kdev-python-23.08.4 (1.34 KB, application/octet-stream)
2024-01-01 15:43 UTC, Björn Strömberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Strömberg 2024-01-01 15:43:44 UTC
Created attachment 164597 [details]
APKBUILD for alpine v3.19 + kdev-python-23.08.4

SUMMARY
***
on alpine linux with python 3.11.6 + -DCMAKE_POLICY_DEFAULT_CMP0148=OLD

-- Found PythonInterp: /usr/bin/python3.11 (found suitable version "3.11.6", minimum required is "3.11") 
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
  (Required is exact version "3.11")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindPythonLibs.cmake:323 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:60 (find_package)


-- Configuring incomplete, errors occurred!

-----------------------
and with CMP0148=NEW
------------------------


CMake Error at CMakeLists.txt:64 (message):
  Python >= 3.4.3 but < 3.12 with --enable-shared is required to build
  kdev-python


https://cmake.org/cmake/help/latest/policy/CMP0148.html

so if CMP0148 is new it should use FindPython3 instead..

as of master commit 5a22e29cd676fbe5851554c381da0e899bd4cf55 this is not the case yet.
***


STEPS TO REPRODUCE
1. alpine 3.19 with kdevelop installed
2. build the attached APKBUILD with 'abuild -r'
3. error triggers due to cmake 3.27 uses FindPython3 instead of old ones.

OBSERVED RESULT
error messages

EXPECTED RESULT
clean compile that takes CMP0148 into account

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
this will be a issue with 24.02 also since the code has not changed in master yet
Comment 1 Björn Strömberg 2024-01-01 17:51:24 UTC
hmm tested to patch the code directly and modify the CMakeLists.txt:

```
# handle CMP0148 - NEW is default from cmake 3.27
if(POLICY CMP0148)
    message(STATUS "Policy CMP0148 is true: need to be handled!")
    find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
[...]
```

```
-- Policy CMP0148 is true: need to be handled!
-- Configuring incomplete, errors occurred!
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Python3_LIBRARIES
  Development Development.Module Development.Embed) (found version "3.11.6")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindPython/Support.cmake:3824 (find_package_handle_standard_args)
  /usr/share/cmake/Modules/FindPython3.cmake:545 (include)
  CMakeLists.txt:47 (find_package)


*** Failure: Exit code 1 ***
```

so this looks like extra-cmake-packages is not picking up python, even though it finds it?

not sure where the issue is here.. 'extra-cmake-packages', 'alpines python package' or 'just me using find_package(Python3) wrong'

my trial and error: https://invent.kde.org/stromberg/kdev-python/-/commit/7a66da9e614ad7d39c0d31e12ba970265876f821
Comment 2 Björn Strömberg 2024-01-01 17:59:23 UTC
adding the link to the downstream alpine bug-report also since im not sure where the actual problem is more then the fact that it finds 3.11.6 but fails to find what its looking for.. https://gitlab.alpinelinux.org/alpine/aports/-/issues/15631
Comment 3 Björn Strömberg 2024-01-01 20:09:12 UTC
well over the river for water.. missing header package for python was the issue.