This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Python not found when building from source

0

Hi all - I've been trying to freshen our build and update some prepared filters but since about 2.2.4 (the last build that I've done) I've found that the build is picking up the wrong python interpreter - or rather, not picking up anything at all

I've explicitly added it to the path

"cmake.exe" -DGIT_EXECUTABLE="C:\Program Files\Git\bin\git" -DPYTHON_EXECUTABLE="C:\python36\python.exe" -DENABLE_CHM_GUIDES=off ..\wireshark-2.2.7 2>&1 > cmake_msbuild.txt

CMakeCache reports the correct Python version

2017-06-20 10:41:55:0103    747 PYTHON_EXECUTABLE:FILEPATH=C:/Python36/python.exe
2017-06-20 10:41:55:0104    1194    FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL=[C:/Python36/python.exe][v3.6.1(2)]

The Cmake output appears correct:

2017-06-20 10:53:27:0396    24  -- Found PythonInterp: C:/Python36/python.exe (found version "3.6.1")
2017-06-20 10:53:27:0396    25  -- Found python module asn2wrs: C:\Wireshark\wireshark-2.2.7\tools\asn2wrs.py
2017-06-20 10:53:27:0397    196 -- Found PythonInterp: C:/Python36/python.exe (found suitable version "3.6.1", minimum required is "2")
2017-06-20 10:53:27:0397    368 -- Found python module make-dissector-reg: C:\Wireshark\wireshark-2.2.7\tools\make-dissector-reg.py

But the solution build fails with the error below:

92>CustomBuild:
     running a2x with args --verbose --attribute=build_dir=/cygdrive/c/Wireshark/build32/docbook --attribute=docinfo --destination-dir=/cygdrive/c/Wireshark/build32/docbook --asciidoc-opts=--conf-file=/cygdrive/c/Wireshark/wireshark-2.2.7/docbook/asciidoc.conf --conf-file=/cygdrive/c/Wireshark/wireshark-2.2.7/docbook/asciidoctor-asciidoc.conf --no-xmllint --format=docbook --fop --stylesheet=ws.css /cygdrive/c/Wireshark/wireshark-2.2.7/docbook/user-guide.asciidoc
     /usr/bin/env: 'python': No such file or directory
92>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 127. [C:\Wireshark\build32\docbook\generate_usea2xr-guide.xml.vcxproj]
92>Done Building Project "C:\Wireshark\build32\docbook\generate_user-guide.xml.vcxproj" (default targets) -- FAILED.

I've seen some advice to remove cygwin from my path, but I can't see what's actually picking it up Do you think it might be an issue with asciidoc/a2x?

Has anyone seen this before, so would I be best to scrub my environment.

Best regards, Baffled of Sydney.

asked 19 Jun '17, 18:22

Scott%20Harman's gravatar image

Scott Harman
46131319
accept rate: 50%

Same issue with release notes:

101>CustomBuild: Generating release-notes.html

101>CustomBuild:

running a2x with args --format=xhtml --destination-dir=/cygdrive/c/Wireshark/build32/docbook --asciidoc-opts= --fop --stylesheet=ws.css release-notes.asciidoc

101>CustomBuild: /usr/bin/env: 'python': No such file or directory

101>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 127. [C:\Wireshark\build32\docbook\release_notes_html.vcxproj]

(19 Jun '17, 20:48) Scott Harman

2 Answers:

1

a2x (AsciiDoc) is part of your Cygwin installation and does not use the Python interpreter from your Windows installation. Does your Cygwin installation have a Python binary ("python", not just "python2" or "python3").

answered 19 Jun '17, 20:12

Lekensteyn's gravatar image

Lekensteyn
2.2k3724
accept rate: 30%

Well that's just annoying - I've got python2 installed, and running which python returns the path to local Windows python under /cygdrive/c/Python27/python

I'll attempt to scrub it all and go again, but something seems screwy.

(20 Jun '17, 17:37) Scott Harman

Had to completely remove and reinstall cygwin and both version 2 and version 3 of python - it looks like having Python on Windows PATH actually breaks a2x as adding it to PATH and refreshing variables gives me the /cygdrive/c/Python27/python path - which still shouldn't fail, but hey ho.

Not the end of the world ;) Cheers

(20 Jun '17, 19:49) Scott Harman

0

I'm not entirely sure why your build is going wrong, but I see a couple of things that look odd to me:

  1. I've never had to explicitly pass the Git path to CMake. Git for Windows will, by default add itself to the system path.
  2. I've never had to explicitly pass the Windows Python path to CMake. Python usually adds itself to the path and CMake is reasonably adept at deducing the location of python via registry entries if not on the path.
  3. I make sure Cygwin is NOT on the path. CMake finds it reasonably well, but if you do have it in an odd place, then pass the path to CMake.
  4. As you've noted CMake caches paths etc. in CMakeCache.txt, so if you fix up paths etc. and want CMake to pick up the new paths, then you must either delete the items from CMakeCache.txt or delete the entire file.
  5. You MUST have Cygwin Python installed, the Cygwin docbook tools (asciidoc) depend on it. Having Windows Python installed is a good idea some parts of the build use Python to generate files and a native Python is much quicker than the Cygwin one for this.

answered 21 Jun '17, 07:05

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%