[mythtv] cmake build

Roland Ernst rcrernst at gmail.com
Sat Jan 25 16:13:42 UTC 2025


On Sat, Jan 25, 2025 at 4:59 PM David Hampton <mythtv at love2code.net> wrote:

> On Thu, 2025-01-23 at 16:58 -0500, Peter Bennett wrote:
> >
> >
> >
> >
> > On 1/23/25 13:26, David Hampton wrote:
> >
> >
> > >
> > > I'm updating the cmake code to properly enforce the choice of pip
> > > or
> > > setup.py.  My understanding now is that python 3.12+ requires pip,
> > > python 3.11 can use pip or setup.py, and python 3.10 and less
> > > require
> > > setup.py.
> > >
> > > This command will tell you what python modules were found by cmake:
> > >
> > >     grep 'Found python module' <logfile>
> > >
> > > David
> > >
> >
> > I have Ubuntu 24.04 and Python 3.12.3
> >
> >
> > After your latest commit, Without a python virtual environment I
> > still get the error
> >
> > error: externally-managed-environment
> >
> >  × This environment is externally managed
> >  ╰─> To install Python packages system-wide, try apt install
> >      python3-xyz, where xyz is the package you are trying to
> >      install.
> >
> >      If you wish to install a non-Debian-packaged Python package,
> >      create a virtual environment using python3 -m venv path/to/venv.
> >      Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
> >      sure you have python3-full installed.
> >
> >      If you wish to install a non-Debian packaged Python application,
> >      it may be easiest to use pipx install xyz, which will manage a
> >      virtual environment for you. Make sure you have pipx installed.
> >
> >      See /usr/share/doc/python3.12/README.venv for more information.
> >
> >  note: If you believe this is a mistake, please contact your Python
> > installation or OS distribution provider. You can override this, at
> > the risk of breaking your Python installation or OS, by passing --
> > break-system-packages.
> >  hint: See PEP 668 for the detailed specification.
> >
> > With a python virtual environment it works correctly and with no
> > warning about deprecated setup.py.
> >
> > Peter
>
> I still can't recreate your problem on my test Ubuntu 24.04 system
> running python 3.12.3.  Can you try applying the attached patch?  It
> will print the exact pip commands that are being executed.
>
> David
>
>
Well, a little progress on that

1) I did not manage to run the first step described by Peter:

cmake --preset qt5 \
-DMYTH_BUILD_PLUGINS=OFF \
-DCMAKE_INSTALL_PREFIX=<some-valid-path-in-$HOME/usr \
|& tee ../cmake1.log

because the check in  mythtv/CMakeLists.txt line 247
<https://github.com/MythTV/mythtv/blob/b53e94ae9ef0366fbe73bc36b725cbb4b63a5a77/CMakeLists.txt#L247>
failed:
The "LIBS_INSTALL_PREFIX" was still set to "/usr/local".

Adding the correct switch to the command line solved that issue:

cmake --preset qt5 \
-DMYTH_BUILD_PLUGINS=OFF \
-DCMAKE_INSTALL_PREFIX=<some-valid-path-in-$HOME/usr \
-DLIBS_INSTALL_PREFIX=<some-valid-path-in-$HOME/usr \
|& tee ../cmake1.log

@Peter, do you already have this "LIBS_INSTALL_PREFIX"
set in your environment?

I still believe that the logic in 'mythtv/CMakeLists.txt' that derives the
"LIBS_INSTALL_PREFIX" from "CMAKE_INSTALL_PREFIX" is not correct (well, at
least for my case)

The log files shows:
"-- Using python pip install method"
After that, I got the same error as Peter gets when running with python pip:
The log files shows:
"-- Using python pip install method"
but pip install fails with the known error "Externally Managed Environemt"

2) I added some printouts to the file
"mythtv/mythtv/bindings/python/CMakeLists.txt"
and discovered, that
"PREFIX_FLAGS" is empty, but
"MYTHTV_INSTALL_PREFIX" is set to value of "CMAKE_INSTALL_PREFIX"
in the call of python pip install at line 107
<https://github.com/MythTV/mythtv/blob/6e438854e723806d7d00d43f2ada5f3e68e5436d/mythtv/bindings/python/CMakeLists.txt#L107>

That leads to the previous mentioned error because pip now tries to install
the package systemwide.

Needs further investigation

Roland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20250125/e773eeae/attachment.htm>


More information about the mythtv-dev mailing list