Wireshark-dev: Re: [Wireshark-dev] Wireshark seems to require Python 3.4 or better now ...

From: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Date: Sat, 10 Nov 2018 13:31:11 -0800
On Sat, Nov 10, 2018 at 1:17 PM Richard Sharpe
<realrichardsharpe@xxxxxxxxx> wrote:
>
> On Sat, Nov 10, 2018 at 1:14 PM Richard Sharpe
> <realrichardsharpe@xxxxxxxxx> wrote:
> >
> > On Sat, Nov 10, 2018 at 12:11 PM Peter Wu <peter@xxxxxxxxxxxxx> wrote:
> > >
> > > On Sat, Nov 10, 2018 at 10:05:14AM -0800, Richard Sharpe wrote:
> > > > On Sat, Nov 10, 2018 at 9:40 AM Pascal Quantin <pascal.quantin@xxxxxxxxx> wrote:
> > > > >
> > > > > Hi Richard,
> > > > >
> > > > > Le sam. 10 nov. 2018 à 18:33, Richard Sharpe <realrichardsharpe@xxxxxxxxx> a écrit :
> > > > >>
> > > > >> Hi folks,
> > > > >>
> > > > >> I am running into problems with building the latest Wireshark master
> > > > >> release on CentOS 7.5.1804.
> > > > >>
> > > > >> Wireshark seems to need Python 3.4 or better, and I have Python 3.6
> > > > >> installed and am using the software collection (scl enable rh-python36
> > > > >> bash) but cmake 3 does not want to find it.
> > > > >>
> > > > >> I get:
> > > > >>
> > > > >>    [rsharpe@localhost wireshark-build]$ python -V
> > > > >>    Python 3.6.3
> > > > >>    cmake3 ../wireshark-official
> > > > >>    ...
> > > > >>    CMake Error at
> > > > >> /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:137
> > > > >> (message):
> > > > >>      Could NOT find PythonInterp: Found unsuitable version "2.7.5", but required
> > > > >>      is at least "3.4" (found /usr/bin/python)
> > > > >>
> > > > >> Any suggestions?
> > > > >
> > > > >
> > > > > Either clean your build folder, or edit your CMake cache file to remove the PythonInterp entry and force a new search.
> > > >
> > > > It was a completely new build dir.
> > > >
> > > > In the end, because I imagine the Wireshark build needs a more recent
> > > > version of Python, but the base platform still needs Python 2.7.5, I
> > > > went with virtualenv and it seems to have worked.
> > > >
> > > >    sudo pip3.6 install virtualenv
> > > >    virtualenv ./wireshark-master
> > > >    cd wireshark-master/
> > > >    source ./bin/activate
> > > >    cmake3 /path/to/wireshark/source
> > > >
> > > > seems to work.
> > >
> > > Like Pascal said, clearing PYTHON_EXECUTABLE from your CMakeCache.txt
> > > was sufficient (you do not have to wipe the full build directory). The
> > > default /usr/bin/python interpreter is Python 2.7, but CMake will now
> > > search for python3 first and use that if it is new enough.
> >
> > Well, I tried doing that also, but no luck. It insists that python
> > 2.7.5 is unsuitable ...
>
> The correct instructions seem to be to modify the PYTHON_EXECUTABLE
> line in CMakeCache.txt to the following (or whatever version you have
> on the system):
>
> PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3.6

A little digging in the cmake documentation reveals that the
FindPythonInterp command has been deprecated and the following is
better and works. I will submit a review on Gerrit:

[rsharpe@localhost wireshark-official]$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d001071..f42732e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -880,7 +880,7 @@ endif()
 # - set HAVE_XXX

 # The minimum package list
-set(PACKAGELIST Git GLIB2 GMODULE2 GTHREAD2 GCRYPT LEX YACC Perl PythonInterp)
+set(PACKAGELIST Git GLIB2 GMODULE2 GTHREAD2 GCRYPT LEX YACC Perl Python3)
 set(LEX_OPTIONS REQUIRED)
 set(GLIB2_OPTIONS REQUIRED)
 set(GLIB2_FIND_OPTIONS REQUIRED)
@@ -888,7 +888,6 @@ set(GLIB2_MIN_VERSION 2.32.0)
 set(GTHREAD2_OPTIONS REQUIRED)
 set(GCRYPT_OPTIONS "1.4.2" REQUIRED)
 set(Perl_OPTIONS REQUIRED)
-set(PythonInterp_OPTIONS "3.4" REQUIRED)
 set(YACC_OPTIONS REQUIRED)

 if (NOT WIN32)


-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)(传说杜康是酒的发明者)