SCons - 'rc' is not recognized as an internal or external command, operable program or batch file - visual-studio-2005

I have set-up everything according to instructions on https://github.com/TideSDK/TideSDK/wiki/Windows7-x86-2005
But, scons won't pick up "rc" from PATH:
> scons -s debug=1 sdkinstaller run=1
...
runs fine for a while, until:
...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be
removed in a future release
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be
removed in a future release
boot_win32.cpp
'rc' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [build\win32\objs\boot\support\winboot.res] Error 1
> rc
fatal error RC1107: invalid usage; use RC /? for Help
> echo %path%
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsof
t Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tool
s;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINXP\Microsoft.NET
\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;C
:\Program Files\ImageMagick-6.8.0-Q16;C:\WINXP\system32;C:\WINXP;C:\WINXP\System
32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Git\cmd;C:\Program
Files\Git\bin;C:\Python25\Scripts;C:\Python25
Googling on this matter suggests the solution to add the VC bin directory to PATH, but as you can see, that is already in place.
Note: I installed and used scons 2.2.0 as well, but then it wouldn't even recognize "cl". At least with scons 1.2.0 it recognizes "cl", but unfortunately not "rc"
First time building on Windows, any advice appreciated!

Virtual machines are cheap and accessible. I'd recommend a clean build environment that is not polluted by several SDK versions.

Might help for someone else, but Visual Studio has it's own CMD which will have these path set. Just open corresponding Visual Studio CMD and compile from there.

Related

What runtime dependencies does TLBIMP have?

Setting up a clean build machine I have only installed VS2019 so far, including Windows 10 SDK, as far as 3rd-party software is concerned.
An ODL file has custom compile step:
midl /out ..\dll %(FullPath)
TLBIMP ../dll/%(Filename).tlb /namespace:MyOrg.COM /keyfile:../include/MyOrg.snk /out:../dll/%(Filename).dll
This gives the build error:
1>'TLBIMP' is not recognized as an internal or external command,
1>operable program or batch file. 1>C:\Program Files (x86)\Microsoft
Visual
Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5):
error MSB6006: "cmd.exe" exited with code 9009.
Clearly MIDL is working, what additional Visual Studio/Windows components do I need to install for TMPLIB?
As Simon points out in comments, TLMIMP.exe is a standard VS tool. Depending which Windows SDK is being used it should be found in:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\TlbImp.exe
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
You might have multiple versions installed, which is used during a build will depend on your %PATH variable. This would normally be set whenever you run Visual Studio Developer Command Prompt (I assume if you build within the IDE it's done automatically).
My issue was actually that I'm building with Azure Devops and it doesn't automatically add this folder to the build path.

Failed to Build WebKit-r161259 on Win7/VS2010

I've build WebKit-r128959 successfully on Win7/VS2010, but now the source (WebKit-r161259) has changed a lot and my experience doesn't work any longer...
I met this first error.
WebKitSupportLibrary is up-to-date.
Building results into: /cygdrive/c/cygwin_dir/home/LioMoon/WebKit-r161249/WebKitBuild
WEBKIT_OUTPUTDIR is set to: C:\cygwin_dir\home\LioMoon\WebKit-r161249\WebKitBuild
WEBKIT_LIBRARIES is set to: C:\cygwin_dir\home\LioMoon\WebKit-r161249\WebKitLibraries\win
/cygdrive/c/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/devenv.com WebKit.vcxproj\WebKit.sln /build Release|Win32
Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
------ Build started: Project: WTFGenerated, Configuration: Release Win32 ------
Build started 1/4/2014 7:05:45 AM.
Build:
/usr/bin/which: no bash in ((null))
'nmake' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "%SystemDrive%\cygwin\bin\which.exe bash
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: set PLATFORMARCHITECTURE=32
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake /nologo -f WTFGenerated.make" exited with code 9009.
Build FAILED.
I just don't understand why the path is (null) and why the devenv executable cannot find nmake. The following lines are the path variable in VS2010:
Path=C:\Program Files\Microsoft F#\v4.0\;C:\Program Files\Microsoft Visual Studi
o 10.0\VSTSDB\Deploy;C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\;
c:\Program Files\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files\Microsoft
Visual Studio 10.0\Common7\Tools;c:\Windows\Microsoft.NET\Framework\v4.0.30319;c
:\Windows\Microsoft.NET\Framework\v3.5;c:\Program Files\Microsoft Visual Studio
10.0\VC\VCPackages;C:\Program Files\HTML Help Workshop;C:\Program Files\Microsof
t Visual Studio 10.0\Team Tools\Performance Tools;C:\Program Files\Microsoft SDK
s\Windows\v7.0A\bin\NETFX 4.0 Tools;C:\Program Files\Microsoft SDKs\Windows\v7.0
A\bin;c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\..\..\VC\bin;C
:\cygwin\bin;C:\Program Files\Parallels\Parallels Tools\Applications;C:\Windows\
system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShe
ll\v1.0\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\
Microsoft SQL Server\100\DTS\Binn" /f;c:\Program Files\Microsoft Visual Studio 1
0.0\Common7\Tools\..\..\VC\bin;
Obviously it's not null. How can I fix the problem?
My build experience is as follow. See more at http://blog.csdn.net/lzl124631x/article/details/18098361
Environment:
Operating System: Windows 7 Ultimate 32-bit
Processor: Intel Core i7 860
Installed Memory: 4.00 GB
1. Installing VS2013:
a. Install Win7 SP1 (windows6.1-KB976932-X86.exe)
b. Install 5 patches for IE10
ⅰ. Windows6.1-KB2533623-x86.msu
ⅱ. Windows6.1-KB2670838-x86.msu
ⅲ. Windows6.1-KB2729094-v2-x86.msu
ⅳ. Windows6.1-KB2731771-x86.msu
ⅴ. Windows6.1-KB2786081-x86.msu
c. Install IE10 (IE10-Windows6.1-x86-en-us.exe)
d. Install VS2013 (VS2013_RTM_ULT_ENU.iso)
e. Right click on "C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe", "Properties", "Compatibility", check "Run this program as an administrator".
2. Installing Cygwin
a. Download cygwin-downloader.zip (http://svn.webkit.org/repository/webkit/trunk/Tools/CygwinDownloader/cygwin-downloader.zip) and unzip it.
b. Run cygwin-downloader.exe and wait...
c. Run setup.exe, select "Install from Local Directory" and install.
d. Run setup.exe, select "Install from Internet"
i. In steps before "Select Packages", just select default folder, whatever connection and download site.
ⅱ. Select Packages: Search "gcc", expand Devel, select "gcc-g++: GNU Compiler Collection(C++)"
ⅲ. Select Packages: Search "gdb", expand Devel, select "gdb: The GNU Debugger"
See more at "Installing gcc with Cygwin"(http://www.eecg.utoronto.ca/~aamodt/ece242/cygwin.html)
e. Open C:\cygwin\etc\profile
ⅰ. Modify line 32 to PATH="/bin:${PATH}"
ⅱ. Comment line 44-50 by adding '#' at the beginning of each line.
3. Installing SDKs
a. Install QuickTime SDK (https://developer.apple.com/quicktime/)
b. Install Direct SDK (June 2010 DirectX SDK:http://www.microsoft.com/en-us/download/details.aspx?id=6812)
4. Getting the Code
a. Download Nightly Build (http://nightly.webkit.org/) and unzip it. My version is WebKit-r161524.
b. Suppress Warning 4309: Open "WebKitLibraries/win/tools/vsprops/common.props", find tag , add 4309.
c. Download Support Library (https://developer.apple.com/opensource/internet/webkit_sptlib_agree.html) and copy it into WebKit-r161524. DO NOT unzip it.
d. Open Source/WebCore/platform/LocalizedString.cpp, search "Look Up", delete the DOUBLE-BYTE double quotation marks around “%#” and “”.
5. Save the following lines as a .cmd/.bat file. I named it as Build.cmd.
#echo off
echo Setting up links...
set CYGWIN_DIR=C:\cygwin
set WEBKIT_SOURCE_DIR=%~dp0%
if "%WEBKIT_SOURCE_DIR:~-1%"=="\" set WEBKIT_SOURCE_DIR=%WEBKIT_SOURCE_DIR:~0,-1%
for /R "delims=\" %%a in (%WEBKIT_SOURCE_DIR%) do set WEBKIT_DIR_NAME=%%~nxa
set WEBKIT_LINK_DIR=%CYGWIN_DIR%\home\%username%\%WEBKIT_DIR_NAME%
if exist "%WEBKIT_LINK_DIR%" rmdir "%WEBKIT_LINK_DIR%"
mklink /D "%WEBKIT_LINK_DIR%" "%WEBKIT_SOURCE_DIR%"
echo Exporting environment varibles...
set WEBKIT_OUTPUTDIR=%WEBKIT_LINK_DIR%\WebKitBuildByCygwin
set WEBKIT_LIBRARIES=%WEBKIT_LINK_DIR%\WebKitLibraries\win
set VSINSTALLDIR=%VS120COMNTOOLS%..\..
set PATH=%WEBKIT_LINK_DIR%\Tools\Scripts;%PATH%
echo Running Cygwin...
call "%CYGWIN_DIR%\Cygwin.bat"
:exit
6. Build
a. run Build.cmd
b. update-webkit
c. build-webkit --debug | tee WebKit-r161524/log.txt
Other Material:
a. Building on Windows:http://trac.webkit.org/wiki/BuildingOnWindows (WebKit Team's note on building on windows)
b. ​WebKit Wiki: http://trac.webkit.org/wiki/WikiStart
Error Solutions:
---------------------------------------------------------------------
Error Message:
17> sh: /usr/bin/gcc: No such file or directory
17> Failed to read names from file: /cygdrive/g/WEBKIT~1/Source/WebCore/html/HTMLTagNames.in at /cygdrive/g/WEBKIT~1/Source/WebCore/dom/make_names.pl line 324.
17> /cygdrive/g/WEBKIT~1/Source/WebCore/DerivedSources.make:942: recipe for target 'HTMLElementFactory.cpp' failed
17> make: *** [HTMLElementFactory.cpp] Error 127
17> make: *** Waiting for unfinished jobs....
17> ./CSSGrammar.y:62.1: error: syntax error, unexpected end of file
Solution:
Install gcc to Cygwin (step 2.d).
---------------------------------------------------------------------
Error Message:
17> build-generated-files.sh: line 59: cd: /home/Moon/WEBKIT~1/WEBKIT~2/Debug/obj32/WebCore/DerivedSources: Permission denied
18> c1xx : fatal error C1083: Cannot open source file: 'C:\cygwin\home\Moon\WebKit-r161524\WebKitBuildByCygwin\Debug\obj32\WebCore\DerivedSources\CSSPropertyNames.cpp': No such file or directory
Solution:
Right click on "C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe", "Properties", "Compatibility", check "Run this program as an administrator"
---------------------------------------------------------------------
Error Message:
..\platform\LocalizedStrings.cpp(248): error C2001: newline in constant
Or
..\platform\LocalizedStrings.cpp(250): error C2001: newline in constant
Solution:
Open Source/WebCore/platform/LocalizedString.cpp, search "Look Up", delete the DOUBLE-BYTE double quotation marks around “%#” and “”.
In my case the problems I faced were the following:
Missing cygwin tool such as perl, make python o ruby:
execute the setup of cygwin and install the missing components.
Conflictive components installed in cygwin and windows at the same time. For instance, if you have python installed in your windows and it is also installed in cygwin, then it's possible that depending on which version is specified in the path, you would get errors related to library versions or problems finding files due the different folder separator character used in the paths ("\" vs "/")
remediation: uninstall the conflictive component from windows and let the one installed in cygwin
Build script doesn't found the installed SDK: Consider to edit the script and point to the SDK that you have currently installed. You can use regedit to find out the key that corresponds to your SDK in your machine. In my case I added the key that corresponds to my current windows SDK "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.0A" in the script webkitdirs.pm:
line 1523: my #windowsPlatformSDKRegistryEntries = (
line 1524: "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v8.0A",
line 1525: "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v8.0",
line 1526: "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.1A",
line 1527: "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.1",
line 1528: "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.0A",
line 1529: "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1", line 1530:);
Encoding issues: if you see there is some file that prevent the building, open the file and ensure it has not encoding issues related to DOS / Unix encoding types.
Remediation: download the problematic file with the right encoding and try again.
Problems related to missing files or files not found:
Ensure to execute the script with administrator permissions. in some cases 3rd party tools invoked by the script are the ones without permissions. if it is the case consider to edit the settings of the involved application and change the compatibility to "run as administrator"

Running vcvars32.bat before compiling in Code::Blocks?

I've installed Visual Studio C++ Express 2012 and want to use it's compiler with Code::Blocks. Starting cl.exe does not work (missing mspdb100.dll) until I run vcvars32.bat, but that does only hold on for the current session in the Command-line. The same applies to compiling with Code::Blocks.
How can I make it run the vcvars32.bat before compiling?
Workaround
That workaround is actually not what I was looking for, but it works, and that is important. Instead of letting Code::Blocks running cl.exe directly, I've set-up a simple batch-script that runs vcvars32.bat before running the actual compiler.
REM File: cl.bat
call vcvars32.bat
call cl.exe %1 %*
In the project properties, you have a section Build events. You can add vcvars32.bat to the pre-build event.
To run the .bat before compiling in Code Blocks(16.01), go to the project build options and its under the "pre/post build steps" tab. This tab only appears in the project settings, not the compiler settings.
However, adding "vcvars32.bat" (or "vcvars64.bat") to the pre build steps didn't fix the error for me.
I found the directory where the library is and added it to the linker search directories. This gave errors about further missing libraries. I added the following paths to my linker settings. These will almost certainly be different for you. I'm installed MSVS 2017 community edition. For some reason known only to Microsoft, the necessary libraries are installed on two different drives.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x64
D:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x64
D:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64
Note that the .bat script is no longer necessary if you add these paths by hand.

VC++ cl.exe -- DLL not found

I added the bin directory of the VS2010 (not SP1) C++ compiler to my PATH variable on Windows XP. When i try to run it, it tells me that a DLL was not found.
I added this line to my PATH:
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin;
Update: it still fails when I cd to the bin directory above, and then run the compiler
Can you help me out?
Run the VS command prompt shortcut or the batch file it points to, such as:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
to set up an appropriate environment including the path.
By the way, mspdb100.dll lives in C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE. But run the shortcut/batch file anyway - it does more than set up the correct path.
add Microsoft Visual Studio 10.0\Common7\IDE to your Path variable, than close cmd prompt and open it. now it will work.
Running the VS command prompt takes care of setting up the environment. Also, ensure that you are running the command prompt as an admin.
Installing Visual Studio 2010 SP1 C++ Compiler Setup fixed this issue for me. Visual Studio 2010 SP1 C++ Compiler install
I faced the same issue when I tried to run a 32 bit exe I built, on a 64 bit machine.
"mspdb100.dll couldn't be found by cl.exe "
Visual Studio 2010(the version I currently use) builds a 32 bit exe by Default.To create a 64 bit executable, just change the setting from Win32 to x64 in the dropdown box at the top of VS and build.This will build for you a 64 bit executable and solve your problem.

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