How to build Lua with Visual Studio 2019? - visual-studio

I am trying to build Lua (version 5.3.5) with Visual Studio 2019. For this, I am following the instructions given here. The steps that I have followed are as follows:
Set up environment variables as mentioned below
UTIL_DIR = C:\Program Files\utility
LUA_DIR = C:\Program Files\lua\5.3
LUA_CPATH = ?.dll;%LUA_DIR%\?.dll
LUA_PATH = ?.lua;%LUA_DIR%\?.lua
SDK_DIR = Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133
INCLUDE = %SDK_DIR%\include;%SDK_DIR%\include\usr
LIB = %SDK_DIR%\lib;%SDK_DIR%\lib\usr
Created the folders required, as mentioned in the environment variables
C:\Program Files\utility
C:\Program Files\lua\5.3
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\usr
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\usr
Added C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin to the environment path variables
Downloaded lua-5.3.5 from here, untarred it and stored in C:\dev\
Added the build.bat file given in this image in C:\dev\lua-5.3.5\src\folder with the 5.1s replaced by 5.3s
In the command prompt, executed the command C:\dev\lua-5.3.5\src>build
I am getting error for every line of build.bat. The entire error screen is shown here.
Please tell me what is going wrong and how to resolve that.
**P.S. - ** I think my SDK_DIR variable is not pointing to the correct folder.
However, I don't know what the correct folder should be. There are
many bin, include and lib directories in Microsoft Visual Studio\2019\Community\.

Related

Cannot open file 'pgort.llib' after adding /GENPROFILE flag

I'm trying to follow the instructions here to add PGO for my project. After I added the /GENPROFILE flag, I start getting the link error:
LINK : fatal error LNK1104: cannot open file 'pgort.lib'
After debugging it a bit, I believe the problem is that my Library Directories (found under VC++ Directories tab) has a value of $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) which is evaluating to:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\atlmfc\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\lib\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\UnitTest\lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64
It looks like the .\spectre\x64 paths don't have the pgort.lib library, but the non-spectre path does:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64
What do I do to fix this? I find it hard to believe that if I'm using the spectre binaries (which I am not even sure how/why I am in the first place) that I can't optimize my project.
BTW, I tried this on a machine with Enterprise VS installed and it's the same. So this isn't specific to Community edition.
I ended up updating my build configuration/scripts to dynamically update the LibraryPath to add the appropriate, architecture-specific version of $(VC_LibraryPath_VC_x64_Desktop) when compiling for PGO.

MSBuild with VS 2017 BuildTools set wrong $(VSInstallDir) at build time

I am seeing some weird behavior with the latest 15.8.2 Visual Studio 2017 Build Tools. After installing the tools and ensuring that it has installed all workloads and components, I attempted to build our master solution from a batch file with the following command:
msbuild %~dp0\..\..\Master.sln /verbosity:quiet /ds /p:Configuration=Debug;Platform=x64 /m /fl1 /fl2 /fl3 /flp1:LogFile="%~dp0\MSBuild.log";Verbosity=normal /flp2:LogFile="%~dp0\ProjectWarnings.log";WarningsOnly /flp3:LogFile="%~dp0\ProjectErrors.log";ErrorsOnly
One of the very first projects fails with the following error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TextTemplating\Microsoft.TextTemplating.targets(340,5): error : System.IO.FileNotFoundException: Could not find a part of the path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\Microsoft.SqlServer.TransactSql.ScriptDom.dll'.
If you'll notice, the path that can't be found is looking for the "Enterprise" directory, which obviously doesn't exist because we installed the Build Tools. The .dll in question is there in the correct directory, just under the "BuildTools" folder and not "Enterprise". In the project itself, we have this line for the above .dll:
<HintPath>$(VSInstallDir)\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\Microsoft.SqlServer.TransactSql.ScriptDom.dll</HintPath>
When looking at a developer command prompt on the system with just the Build Tools installed, running set, the variable VSInstallDir maps correctly to the BuildTools folder:
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\
My question is this: where in the world is MSBuild getting the "Enterprise" directory from? We are not referencing it in ANY project, instead using $(VSInstallDir) when necessary. I have grepped the entire BuildTools directory for references to "Enterprise" and I'm finding nothing in .targets files or .props (or really any other files) that would indicate the variable would resolve to "Enterprise" rather than "BuildTools".

VS2017: “Cannot find the resource compiler DLL. Please make sure the path is correct.”

I am using Visual Studio 2017. When I try to build a solution, I encounter this error:
Cannot find the resource compiler DLL. Please make sure the path is correct.
I checked my system, and found that the v7.0, v8.0, v8.0A, v8.1A, and v10.0A SDKs are installed on my machine. I checked my project properties, and the default SDK is v8.0
Me too, i have only the "windows 10 sdk version 10.0.15063.0" installed, and solved after:
Copy rddll.dll from:
c:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86\rcdll.dll
to:
c:\Program Files (x86)\Windows Kits\10\bin\x86\
ref link: https://developercommunity.visualstudio.com/content/problem/43024/ide-cannot-find-the-resource-compiler-dll-rcdlldll.html
Just a temporary workaround, but it works.
Edit:
Run Visual Studio Installer from start menu, and click Update, after a while it's done, all thing worked.
it's doesn't need to copy file any more.
you could copy from
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rc.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rcdll.dll
to
C:\Program Files (x86)\Windows Kits\10\bin\x64\rc.exe
C:\Program Files (x86)\Windows Kits\10\bin\x64\rcdll.dll
and copy from
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86\rc.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86\rcdll.dll
to
C:\Program Files (x86)\Windows Kits\10\bin\x86\rc.exe
C:\Program Files (x86)\Windows Kits\10\bin\x86\rcdll.dll
The reason is that Visual Studio cannot find the requested files.
You have to (re)install or repair the requested version through Visual Studio Installer.
You can reach that through Visual Studio menu bar -> Tools -> Get Tools and Features -> Individual Components -> find and tick the respective {version} tools to install and then click "Modify".
It should work after that. Best of luck.
you can just simply change the compiler from resource compiler to C / C++ Compiler and you can do that by simply making a resource and you will face that error, after that right click the empty resource that have been generated and on the folder of resources right click the [nameofyourproject].rc and then choose properties and from item type change it to C / C++ Compiler and then delete that resource and create a new one and you will find it works fine with you.

Visual studio 'xsd' command: file path

The command 'xsd' in the Visual Studio (2010) command window is not fiding my file.
Tried full path 'c:\...\etc...', tried path from project folder, tried any sub path of the full path, tried only the file name (as shown on any example in the web of the usage of the tool).
The file is inside the project inside a subfolder, like "project\schema\mySchema.xsd".
Command used
>Tools.Shell xsd <path\>myfile.xsd /classes
returns:
The operation could not be completed. System could not find specified file.
What work around can I make, how should I properly use the tool? (Am I using it wrongly?)
To find XSD.exe these days, go to:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2
Tools\xsd.exe
Step by step:
Go to C:\Program Files (x86)\Microsoft SDKs\Windows\
Click latest version (e.g. v10.0A)
Click Bin
Select latest .NET Version e.g. NETFX 4.7.2 Tools
There is xsd.exe
When you launch the shortcut that opens the Visual Studio Command Prompt you execute a batch file that set some important string inside the PATH environment variable. These strings contain the folder names where the XSD tool is located.
The shortcuts are located in this folder on my dev PC with Visual Studio 2013
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
The shortcut that opens the Command Prompt for Visual Studio x86 Native Tools is something like this
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" x86
So, unless your installation is damaged you should be able to find the correct command in the relative directory of your Visual Studio 2010 install.

Error Code -1073741515 When Using EDITBIN

I'm using EditBin to increase the stack size of an application I'm writing. I have this in the post-build event command line for Visual Studio:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\editbin.exe" /STACK:268435456 "$(TargetPath)"
When I build my project, I get this error:
Error 470 The command ""C:\Program
Files (x86)\Microsoft Visual Studio
10.0\VC\bin\editbin.exe" /STACK:268435456 "[Target Executable]"" exited
with code -1073741515.
I have both of the following in my PATH environment variable:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
The command also works when I run it manually with cmd.exe. Does anyone know what the problem is here?
I had the same issue, how I resolved it:
Ran msbuild.exe <my.sln> /t:<mytargetproject> from a VS2010 command prompt, where <my.sln> is your solution name and <mytargetproject> is the project you are trying to build. For e.g. msbuild.exe helloworld.sln /t:mainproj.
When you do this or at least when I ran this, a dialog box popped up and said "foo.dll" cannot be found, I added the path of that dll to my "PATH" environment variable and the problem was solved! See ChrisF's comment to the question, as it says, the error is that some dll/component is missing.
From the dll name it complained about, I believe this is not contained to VS2010 libs/dlls, for me it was a third-party dll (which I am using and supposed to be available during the build) it was complaining about.
The best solution is to run the vcvarsall.bat located in the root of the visual studio install folder(C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC). That sets up the search folders for all MSVC compiler related tools.
I got this to work for now by copying mspdb100.dll into the same directory as editbin.exe, but this is not an optimal solution because every developer on my team will need to do the same thing.

Resources