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

CMake build fails

1
1

Got this when building Wireshark:

The PLATFORM environment variable ([undefined]) doesn't match the generator
On AMD64 machine. Any resolution to that that does not involve modification to the cmake file?

asked 02 Oct '16, 10:51

neuralsea's gravatar image

neuralsea
21234
accept rate: 0%

edited 02 Oct '16, 11:54

Jaap's gravatar image

Jaap ♦
11.7k16101

You left out the last part of the error message. Please provide that as well.

(02 Oct '16, 11:54) Jaap ♦

One Answer:

1

As per the Developers Guide Section 2.2.10 you must create an environment variable indicating your target platform:

WIRESHARK_TARGET_PLATFORM=win32 or win64 as required

That means choose win32 or win64 as appropriate, not the whole string.

answered 02 Oct '16, 12:37

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

[Your answer has been converted to a comment as that's how this site works. Please read the FAQ for more information.]

Thank you grahamb. This did not resolve the issue. See console output below:

set WIRESHARK_TARGET_PLATFORM=win64

C:\dev\wsbuild64>"C:\Program Files\CMake\bin\cmake" -DENABLE_CHM_GUIDES=on -G "Visual Studio 14 2015 Win64" ..\wireshark – The C compiler identification is MSVC 19.0.24210.0 – The CXX compiler identification is MSVC 19.0.24210.0 – Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC /bin/x86_amd64/cl.exe – Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe – works – Detecting C compiler ABI info – Detecting C compiler ABI info - done – Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC /bin/x86_amd64/cl.exe – Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe – works – Detecting CXX compiler ABI info – Detecting CXX compiler ABI info - done – Detecting CXX compile features – Detecting CXX compile features - done – Generating build using CMake 3.6.2 – Found POWERSHELL: C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe CMake Error at CMakeLists.txt:107 (message): The PLATFORM environment variable ([undefined]) doesn't match the generator platform (win64)

– Configuring incomplete, errors occurred! See also "C:/dev/wsbuild64/CMakeFiles/CMakeOutput.log".

(02 Oct ‘16, 13:06) neuralsea

CMakeList.txt actually says it’s the environment variable PLATFORM that has to be set in this case, not WIRESHARK_TARGET_PLATFORM.

Simply reading CMakeList.txt should make it obvious what’s needed (although not the why)

(02 Oct ‘16, 14:05) Jaap ♦

Thank you Jaap. CMake variables refer to x86 CXX path.

Also: //Name of generator platform. CMAKE_GENERATOR_PLATFORM:INTERNAL= //Name of generator toolset. CMAKE_GENERATOR_TOOLSET:INTERNAL=

Thank you again.

(02 Oct ‘16, 16:05) neuralsea

PLATFORM is an environment variable defined by the Visual Studio “system”, either when opening a Visual Studio Command Prompt or running any of the Visual Studio batch files (vcvars, vsvars, etc.) or using PSCX Import-VisualStudioVars, so SHOULD NOT need to be defined by the user.

Please read and follow the section of the Developers Guide I noted above, 2.2.10 to correctly set up your build environment.

You might also note that support for VS2015 is currently experimental, the “official” compiler to use, as per the Developers Guide, is VS2013, although there have been reports of success with VS2015.

(03 Oct ‘16, 02:52) grahamb ♦

Good point Graham. @neuralsea: Are you using VS2015 ?

(03 Oct ‘16, 05:28) Jaap ♦

VS2015 should not be a problem as such, I’m using it every day to build Wireshark(64bits)…

(03 Oct ‘16, 06:33) Anders ♦

Yes I am using VS 2015

(04 Oct ‘16, 11:34) neuralsea

I pointed out the use of VS2015 more as an example of a deviation from the instructions in the Developers Guide, not as the particular issue in play here, which I believe is a deviation from the instructions in that the OP hasn’t opened a Visual Studio command prompt as per section 2.2.10 which will set the PLATFORM env. var.

(05 Oct ‘16, 03:26) grahamb ♦
showing 5 of 8 show 3 more comments