How to fix Cmake The PLATFORM environment variable (x64) doesn't match the generator platform (win32)
Building in Windows Sandbox with
choco install -y winflexbison3 cmake activeperl python3 asciidoctorj xsltproc docbook-bundle visualstudio2019community visualstudio2019-workload-nativedesktop
Command prompt is titled "Administator: x64 Native Tools Command Prompt for VS 2019" and opens claiming to be "Visual Studio 2019 Developer Command Prompt v16.6.5".
WIRESHARK_BASE_DIR and QT5_BASE_DIR are set
cmake -G "Visual Studio 16 2019" -A x64 ..\wireshark-3.2.5
quits with:
CMake Error at CMakeLists.txt:91 (message):
The PLATFORM environment variable (x64) doesn't match the generator
platform (win32)
Also set WIRESHARK_TARGET_PLATFORM=win64 does not fix this. Any ideas how to persuade this to work?
Set reports:
Platform=x64
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
After opening the prompt, the banner should look like this:
and the last line indicates the target.
What does
set VSCMD_ARG_TGT_ARCH
report?And you should be setting
QT5_BASE_DIR
.Another thought, are you using a build directory that you've previously configured CMake for an x86 build? If so, create a new build dir, the x64 and x86 builds MUST be kept separate.
More output:
(more)This bit of output is odd, not sure what that means:
It should be something like:
The check in CMakeList.txt is failing because the WIRESHARK_TARGET_PLATFORM variable is incorrect ("win32").
That is set by the block:
So I would assume that the first conditional evaluates to false and the second to true. Can you add some debugging
message(STATUS "...")
items to dump out the value of{CMAKE_CL_64}
and{CMAKE_GENERATOR}
, e.g.add it just in front of the above block.
-- CMAKE_CL_64: , CMAKE_GENERATOR:Visual Studio 16 2019
I still see the error if I
before running CMake
OK, so the CMakeLists.txt expects
CMAKE_CL_64
to be TRUE, and it isn't in your case. That's set by CMake if it's using an MS 64 bit compiler. I suspect this is tied up with the unknown compiler outputIs it possible you have other compilers in your path? Can you show the PATH env var?
Path:
(more)And there shouldn't be any other compilers - it's a fresh Windows Sandbox
Formatted for better inspection:
(more)You might want to have a look at the CMake output generated by the Windows Server 2019 x64 buildbot and compare that output with yours. (All master buildbots can be found here: https://buildbot.wireshark.org/wiresh...) You may discover differences that are adversely affecting your ability to build Wireshark, and it's certainly possible that the documentation for building Wireshark may be to blame and not necessarily anything that you did wrong specifically, especially if you closely followed the documentation for setting up the build environment as documented at https://www.wireshark.org/docs/wsdg_h.... At least a few things seem out-of-date with the documentation in that it mentions:
- "For example, at the time of this writing the Qt 5.12.1 “msvc2017 64-bit” component is used to build the official 64-bit packages.", but that's not true as Qt 5.12.8 is used.
- "e.g. C:\Qt ...
(more)@cmaynard Great suggestion to look at the build slaves, in this case I would suggest the 3.2 set as the user is trying to build 3.2.5. For this specific case look at the Windows Server 2019 X64 builder and the "ran cmake" step, clicking on the stdio link to see the command, the env vars and output of running the CMake generation phase. There are some annoying CMake warnings there that should be fixed.
While the docs could use an update, the exact versions of Qt 5.12, Python, Perl et al don't really matter as CMake will locate them.
The Qt install path is wherever the user decides to put it, IIRC Qt have moved things about a bit, the key bit is the supplied path should end in the appropriate compiler\build version as in "msvc2017_64".
The issue here is that CMake isn't ...(more)
@Eddy CMake should write errors to the CMakeFiles\CMakeError.log which might give some clues about the compiler identification issue. Can you post the contents of that file on a public share somewhere and then add a link to it back here?
CMakeError.log here (sorry for delay in posting) https://file.io/2C27Pc15xN6a
Beginning to think there's some nasty interact of Windows sandbox (no reboot) and choco here. The compiler is on the command line though so I don't know how CMake fails to find it