psmoveservice / PSMoveService

A background service that communicates with the psmove and stores pose and button data.
Apache License 2.0
591 stars 148 forks source link

Unable to build with VS2017. #638

Open alatnet opened 5 years ago

alatnet commented 5 years ago

I've tried multiple times and i cannot build with VS2017. Have a unique build environment where i have VS on a separate drive. Modified the InitialSetup_X64.bat accordingly: -added "set PATH=%PATH%;D:\Users\alatn\Desktop\psmoveservice\cmake-3.15.2-win64-x64\bin" and "SET VCTargetsPath=D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets" after setlocal. (using not installed version of cmake, does work fine).

Modified the path pointing to vcvarsall.bat from C drive to D drive.

Here's where I'm getting the errors:

"Creating protobuf project files..." -- Selecting Windows SDK version to target Windows 10.0.17763. CMake Error at CMakeLists.txt:12 (project): Failed to run MSBuild command:

MSBuild.exe

to get the value of VCTargetsPath:

Microsoft (R) Build Engine version 4.8.3761.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 8/14/2019 6:47:07 PM.
Project "D:\Users\alatn\Desktop\psmoveservice\thirdparty\protobuf\vsprojects\CMakeFiles\3.15.2\VCTargetsPath.vcxproj" on node 1 (default targets).
D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.DesignTime.targets(491,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\Users\alatn\Desktop\psmoveservice\thirdparty\protobuf\vsprojects\CMakeFiles\3.15.2\VCTargetsPath.vcxproj]
Done Building Project "D:\Users\alatn\Desktop\psmoveservice\thirdparty\protobuf\vsprojects\CMakeFiles\3.15.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.

Build FAILED.

"D:\Users\alatn\Desktop\psmoveservice\thirdparty\protobuf\vsprojects\CMakeFiles\3.15.2\VCTargetsPath.vcxproj" (default target) (1) -> (SetTelemetryEnvironmentVariables target) -> D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.DesignTime.targets(491,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\Users\alatn\Desktop\psmoveservice\thirdparty\protobuf\vsprojects\CMakeFiles\3.15.2\VCTargetsPath.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.65

Exit code: 1

-- Configuring incomplete, errors occurred! See also "D:/Users/alatn/Desktop/psmoveservice/thirdparty/protobuf/vsprojects/CMakeFiles/CMakeOutput.log". "Error generating protobuf project files!"

alatnet commented 5 years ago

Ok, i think i got it. Have to do it manually but i essentially opened up a developer console (Visual Studio 2017 > Developer Command Prompt for VS 2017) and then set cmake in path with the command that i had above. Though Eigen didnt want to pull it's data from github and had to manually download the tree... I got to the point where i could try to build PSMoveService itself.

D:\Users\alatn\Desktop\psmoveservice\build>cmake -G "Visual Studio 14 2015 Win64" -DBOOST_ROOT=%BOOST_ROOT_PATH% -DBOOST_LIBRARYDIR=%BOOST_LIB_PATH% .. -- The C compiler identification is MSVC 19.0.24234.1 -- The CXX compiler identification is MSVC 19.0.24234.1 -- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working C compiler: D:/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 -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working CXX compiler: D:/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 -- Project version: 0.9_alpha9.0.1 -- Using Eigen3 in submodule CMake Warning (dev) at cmake/ThirdParty.cmake:43 (find_package): Policy CMP0074 is not set: find_package uses _ROOT variables. Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Environment variable Eigen3_ROOT is set to:

D:/Users/alatn/Desktop/psmoveservice/thirdparty/eigen

For compatibility, CMake is ignoring the variable. Call Stack (most recent call first): CMakeLists.txt:18 (include) This warning is for project developers. Use -Wno-dev to suppress it.

-- Found Eigen3: D:/Users/alatn/Desktop/psmoveservice/thirdparty/eigen (Required is at least version "2.91.0") -- Boost version: 1.61.0 CMake Warning at D:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.12/Modules/FindProtobuf.cmake:455 (message): Protobuf compiler version doesn't match library version 3.9.1 Call Stack (most recent call first): cmake/ThirdParty.cmake:167 (find_package) CMakeLists.txt:18 (include)

CMake Error at D:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find Protobuf (missing: Protobuf_LIBRARIES) (found version "3.9.1") Call Stack (most recent call first): D:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) D:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.12/Modules/FindProtobuf.cmake:543 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) cmake/ThirdParty.cmake:167 (find_package) CMakeLists.txt:18 (include)

-- Configuring incomplete, errors occurred! See also "D:/Users/alatn/Desktop/psmoveservice/build/CMakeFiles/CMakeOutput.log".

Fun times ahead...

Edit: Somehow when trying to get Eigen it wiped protobuf... Edit2: And another git submodule that didnt download...

alatnet commented 5 years ago

Ok, after everything, i got it to compile. My method, because of my build environment, is as followed for those who are trying to compile:

  1. Download the repository.
  2. Download the submodules (thirdparty folder), making sure that they are downloaded. (Eigen and hidapi are my culprits.)
  3. Download CMake, not the installable version and place it in the root of psmoveservice.
  4. Download boost and place it in the root of psmoveservice.
  5. Open a developer console (Start > Visual Studio 2017 > Developer Command Prompt for VS 2017)
  6. "set PATH=%PATH%;\<psmoveservice root>\cmake-3.15.2-win64-x64\bin"
  7. "set BOOST_ROOT_PATH=\<psmoveservice root>\\<boost folder>"
  8. "set BOOST_LIB_PATH=%BOOST_ROOT_PATH%/lib64-msvc-14.0"
  9. Follow the manual build until the cmake command on #4.
  10. "cmake -G "Visual Studio 14 2015 Win64" -DBOOST_ROOT=%BOOST_ROOT_PATH% -DBOOST_LIBRARYDIR=%BOOST_LIB_PATH% .."
  11. Continue with following the directions.

Edit: and opencv is giving me problems... Jesus christ i hate CMake...

Edit 2: So... due to some bs with visual studio's brand of git, i cannot download opencv AT ALL because it keeps throwing: SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version I Really Hate CMake...

timfischbach commented 4 years ago

Just install VS2015 and MSBuild is getting found