WebRTC not building for Windows too - webrtc

Like in this question WebRTC not building for Windows, I can't build WebRTC on a Windows 7 64-bit with VS 2015 but the issue is different.
The fetch and gclient sync go well without error. But when I run the gn gen out/WebRTC, then I get the below error
ERROR at //third_party/protobuf/proto_library.gni:229:15: File is not inside out
put directory.
outputs = get_path_info(protogens, "abspath")
^---------------------------------
The given file should be in the output directory. Normally you would specify
"$target_out_dir/foo" or "$target_gen_dir/foo". I interpreted this as
"//out/Default/gen/webrtc/rtc_tools/event_log_visualizer/chart.pb.h".
See //webrtc/rtc_tools/BUILD.gn:184:3: whence it was called.
proto_library("chart_proto") {
^-----------------------------
See //BUILD.gn:16:5: which caused the file to be included.
"//webrtc/rtc_tools",
^-------------------
Traceback (most recent call last):
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 459, in <module>
sys.exit(main())
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 455, in main
return commands[sys.argv[1]](*sys.argv[2:])
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 431, in GetTool
chainDir
win_sdk_dir = SetEnvironmentAndGetSDKDir()
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 424, in SetEnvi
ronmentAndGetSDKDir
return NormalizePath(os.environ['WINDOWSSDKDIR'])
File "D:\temp\depot_tools\win_tools-2_7_6_bin\python\bin\lib\os.py", line 423,
in __getitem__
return self.data[key.upper()]
KeyError: 'WINDOWSSDKDIR'
I tried to add the variables mentioned in the above question but it didn't helped.
Any help would be greatly appreciated.

You need set LIB and INCLUDE in envirnment variables (windows sdk).
And set PATH to the correct version of python (I think that 2.7.6) too.
So your envirnment variables should be:
LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64
INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\winrt
PATH=C:\src\depot_tools\python276_bin\
Please mark if it worked

libwebrtc
I'm using libwebrtc from https://github.com/cloudwebrtc/libwebrtc-build where that compile is wrapped inside a CMake custom call and I tried to modify LIB/INCLUDE but you probably refer to the Visual Studio IDE variables (which the command line does not have or where it does not work as I expected it).
My conservative solution now is to print this message before the libwebrtc compile:
if(NOT EXISTS "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt")
message("============================== C:/Program Files (x86)/Windows Kits/10/Redist/ucrt missing ==========================")
message("C:/Program Files (x86)/Windows Kits/10/Redist/ucrt can not be found")
message(" normally it contains files like /DLLs/x64/ucrtbase.dll and is required for libwebrtc to build")
message(FATAL_ERROR "Please copy the directory C:/Program Files (x86)/Windows Kits/10/Redist/10.0.18362.0/ucrt into C:/Program Files (x86)/Windows Kits/10/Redist/")
endif(NOT EXISTS "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt")
Another would be to patch https://github.com/nareix/webrtc.build/blob/69e87f529e935111b2b8c774ce283366fa2157d0/vs_toolchain.py#L212 to (pseudocode):
ucrt_dll_dirs = os.path.join("C:/Program Files (x86)/Windows Kits/10/Redist/10.0.18362.0/", 'DLLs', target_cpu)
But since that python code is checked out from the libwebrtc and potentially overridden periodically I go with the manual solution.
xcopy (manual copy of files)
xcopy /Y /E /I "c:\Program Files (x86)\Windows Kits\10\Redist\10.0.18362.0\ucrt" "c:\Program Files (x86)\Windows Kits\10\Redist\
alternate discussions
All solutions proposed in https://bugs.chromium.org/p/webrtc/issues/detail?id=7677#c24 also failed for me.
wish
I just wish that the python devs would have spent this another environment variable where we could pass in the directory to look into. Or even better, why did Microsoft create such a crappy infrastructure in the first place -> on UNIX one could use a concept as 'pkg-config' for custom library detection.

Related

CMake Error: Cannot open file for write: C:/Program Files/vtk/bin/CMakeCache.txt.tmpc3fcf for VTK

I am trying to build VTK version 9.2.2 with CMake for a few days now, but no luck so far. I am getting the below error in CMake GUI:
CMake Error: Cannot open file for write: C:/Program Files/vtk/bin/CMakeCache.txt.tmpc3fcf
CMake Error: Unable to (re)create the private pkgRedirects directory:
C:/Program Files/vtk/bin/CMakeFiles/pkgRedirects
CMake Error: : System Error: No such file or directory
CMake Error: Unable to open cache file for save. C:/Program Files/vtk/bin/CMakeCache.txt
CMake Error: : System Error: No such file or directory
I am following the video here, but it still does not work for me. I have tried to search for answers for a while, but there doesn't seem to be the exact same error that I am having on the internet anywhere.
I am on Windows 10, using VTK 9.2.2 and my CMake version is 3.25.1. I also tried with multiple versions of visual studio in the configuration, but it returned the same error.
The steps I have taken were:
Download VTK from the site
Put the downloaded files into the program files directory
Made a /src and /bin folder under a /vtk folder, which is outside the downloaded package
Copied and pasted the downloaded files into the /src folder
Opened CMake GUI and chose the src folder as the source and chose the bin folder as the build folder
Clicked generate and it threw the errors above
The error message like
CMake Error: Cannot open file for write: ...
usually occurred when CMake has no permissions to write a given file.
Your case involves directories under C:/Program Files/, which are usually configured as read-only for normal users.
The file CMakeCache.txt is created in the build directory, so the error message about such file usually means problem with a build directory.
A build directory should always be writable by the regular user. Here CMake creates files for the build tool, and here a build tool creates intermediate and resulted files.

The command ""C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /r "C:\InteropUserControl.rc" #echo." exited with code 3

I am trying to build a VB.NET project.
I am getting this error
The command ""C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /r "C:\InteropUserControl.rc" #echo." exited with code 3.
I think the problem is that this file does not exist on my computer:
C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\rc.exe
Instead, I found it for example here:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86
The vbproj shows this:
<PropertyGroup>
<PreBuildEvent>"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /r "$(ProjectDir)InteropUserControl.rc"
#echo.</PreBuildEvent>
</PropertyGroup>
But I am not sure what to write there instead.
I have tried and changed it to
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\rc.exe
But that did not help.
I have also copied rc.exe and rc.dll from here
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\
to here
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE
but it didn't change anything.
How could I fix this problem?
In the InteropFormToolKit directory, there was a file to found named "Source\Source.zip".
I unzipped these files, and with them, all went fine.
No more rc.exe errors.

What is the cause for this invalid path issue when trying to run cpp protocol buffer compiler from CMake on Windows 10 and how can I solve it?

I'm trying to build the aasdk project on a Windows 10 computer. To do this, I am attempting to run the following commands in the root of the git repo directory:
mkdir buildDir
cd buildDir
cmake ..\
cmake --build . --config Release
The last command is obviously the one that's failing. I get the following output when I run that command:
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- Found libusb-1.0:
-- - Includes: C:/libusb-master/x64/Release
-- - Libraries: C:/libusb-master/x64/Release/lib/libusb-1.0.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/aasdk-development/buildDir
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(200
,5): warning MSB8062: Custom build for item "C:\aasdk-development\buildDir\CMakeFiles\b2b8e2a3c1aae1e014a7c3c3f8aadde7\AVCha
nnelData.pb.h.rule" specifies invalid path "C:\aasdk-development\buildDir\aasdk_proto\protobuf::protoc" as an additional dep
endency. This may cause incremental build to work incorrectly. [C:\aasdk-development\buildDir\aasdk_proto\aasdk_proto.vcxpro
j]
...
Running cpp protocol buffer compiler on C:/aasdk-development/aasdk_proto/AVChannelData.proto
The filename, directory name, or volume label syntax is incorrect.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238
,5): error MSB8066: Custom build for 'C:\aasdk-development\buildDir\CMakeFiles\b2b8e2a3c1aae1e014a7c3c3f8aadde7\AVChannelDat
a.pb.h.rule;...' exited
with code 123. [C:\aasdk-development\buildDir\aasdk_proto\aasdk_proto.vcxproj]
Where ... is the same message repetead for each *.proto file inside aasdk_proto directory. From what I can tell, it seems it thinks some paths are invalid. What I can't tell, is which paths and in what way are they invalid.
After the first comment, I decided to check where it gets those paths. Below is the content of the CMakeLists.txt for protobuf, found in the aasdk_proto directory:
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
file(GLOB_RECURSE proto_files ${CMAKE_CURRENT_SOURCE_DIR}/*.proto)
protobuf_generate_cpp(proto_sources proto_headers ${proto_files})
add_library(aasdk_proto SHARED ${proto_headers} ${proto_sources})
target_link_libraries(aasdk_proto ${PROTOBUF_LIBRARIES})
Of interest is the 5th line which enumerates all the *.proto files in the relevant directory before calling protobuf_generate_cpp, the part which I believe to be causing the errors.
Adding message(STATUS ProtoFiles: ${proto_files}) after line 5 to print the paths yielded correct values, atleast to my eyes:
C:/aasdk-development/aasdk_proto/AbsoluteInputEventData.proto;C:/aasdk-development/aasdk_proto/AbsoluteInputEventData.proto;...
I replaced the forward slash with a backslash just for giggles, since that's how Windows likes them, but that didn't work.
I'm a bit late, but for anyone still having this problem, I ran into a similar issue while building CuraEngine, and found the cause. In my case, I had to set the path to protoc.exe with both variables PROTOC and Protobuf_PROTOC_EXECUTABLE. (I had only set PROTOC and CMake didn't throw any errors.)
I imagine the situation with aasdk must be similar. Some variable (probably PROTOBUF_PROTOC_EXECUTABLE?) that tells the location of protoc.exe must be missing.

How to define where msbuild looks for packages?

I'm trying to build a solution from command line. This involves 3 steps:
nuget install
nuget restore
msbuild
I am using a NuGet.Config files that specifies where the nuget packages are cached to, and also where the restored packages are added.
The command nuget restore does not work, nor does it provide a helpful error message other than 'the solution can't be built'. Another answer on StackOverflow helpfully recommended to run the msbuild command and see what the error is.
It would seem that files installed via nuget are not found during msbuild (or apparently nuget restore). This is the log from msbuild for every single assembly other than what is found in GAC:
Primary reference "NTRPRS.NLog.Slack".
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "NTRPRS.NLog.Slack". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Avesta\Services\Dashboard\src\Avesta.DashboardService.csproj]
For SearchPath "{HintPathFromItem}".
Considered "..\..\..\..\AppData\Roaming\NuGet\packages\NTRPRS.NLog.Slack.5.0.4\lib\net45\NTRPRS.NLog.Slack.dll", but it didn't exist.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.exe", but it didn't exist.
For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.5,AssemblyFoldersEx}".
Considered AssemblyFoldersEx locations.
For SearchPath "{AssemblyFolders}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.exe", but it didn't exist.
For SearchPath "{GAC}".
Considered "NTRPRS.NLog.Slack", which was not found in the GAC.
For SearchPath "{RawFileName}".
Considered treating "NTRPRS.NLog.Slack" as a file name, but it didn't exist.
For SearchPath "bin\Debug\".
Considered "bin\Debug\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "bin\Debug\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "bin\Debug\NTRPRS.NLog.Slack.exe", but it didn't exist.
How can I specify to msbuild where assemblies installed by nuget are? Also.... why is nuget restore failing? The message I get from nuget restore is:
C:\<path>\src>nuget restore
Error parsing solution file at C:\<path>\src\<name>.sln: Exception has been thrown by the target of an invocation.
The project file could not be loaded. Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified. C:\<path>\src\<name>.sln
using:
MSBuild auto-detection: using msbuild version '15.7.177.53362' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.
As far as I can tell, the nuget error output is completely nonsensical. The absolute path C:\<path>\src\<name>.sln absolutely does exist.
This is a problem that only surfaced after 15.7.0 of Visual Studio / MSBuild.
NuGet already has an open issue for this problem: https://github.com/NuGet/Home/issues/6918
The current workaround is to install .NET 4.7.1 until the problem is fixed, because that will install the missing library in the Global Assembly Cache.

Compiling C++ programs in Sublime Text 2

I installed the git-cmd.bat command prompt so I could do RoR. I forgot where I got this. Anyway, the git-cmd.bat has g++ installed or something (I don't know why and would love to learn!).
For class I need to make sure my projects run on visual studios and on g++. I like to write my programs in a sublime then transfer over to the ide to test then transfer back and fix code. This is getting very tedious and writing g++ -o asdf *.cpp every single time is not ideal.
When I do ctrl+b in sublime, it give me this error:
[Error 2] The system cannot find the file specified
[cmd: [u'g++', u'C:\\Users\Desktop\\Project 2\\main.cpp', u'-o', u'C:\\Users\\\Desktop\\Project 2/main']]
[dir: C:\Users\s\Desktop\Project 2]
[path: C:\windos\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\MATLAB\R2013a\runtime\win64;C:\Program Files\MATLAB\R2013a\bin;C:\Ruby193\bin]
[Finished]
I thought g++ was already installed and since I can run g++ in my git command prompt, it should already be in path. Can anyone help me out please?
Thanks!
Hey not sure if you figured this out, but it is checking the directories listed in path.
So you'll have to add the path to g++ in the system path: http://www.computerhope.com/issues/ch000549.htm
or where it says "g++" you'll have to add the absolute path to the executable. For example, instead of downloading MinGW twice, I have linked to the Code::Blocks (my IDE of choice) version of MinGW and the "g++" now says:
C:\Program Files (x86)\CodeBlocks\MinGW\bin\g++
(each slash is twice above, StackOverflow is escaping the string)
I'm not familiar with the "git-cmd.bat prompt" you mention, but if it does have g++ you'd have to find the path to it and do one of the above. If StackOverflow/Google can't shed light on this I would recommend just doing a search for g++ in Windows Explorer.