MSB4019 from VS2012 solution when building on Jenkins - visual-c++

I'm setting up our build server. I've installed Jenkins on a Windows 7 machine and am running into problems when building the 64 bit version of our solution.
We're using Visual Studio 2012 Express for Windows Desktop. Jenkins uses the MSBuild plugin and is targeting the 64 bit MSbuild exe at
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
However, when it runs msbuild an evironment variable is not being parsed properly. VCTargetsPath.
If I leave everything as-is then the output of MSBuild is this
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I played around a bit with the VCTargetsPath variables in the registry, Windwos Environment Variables and as Jenkins Eviornment Variables too. I noticed this behavior.
If I set VCTargetsPath to be "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110" then the output of msbuild is the same as above. However, if I set it to "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0" then the output changes to this.
error MSB4019: The imported project "C:\progra~2\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
The tile Microsoft.Cpp.Default.props is found in "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110" I checked the limits on environment variable length and it's supposed to be 2048 characters. Am I missing something obvious here? I've found some info that basically says I am going to have to reinstall everything in a specific order, which is quite annoying (but also very Microsofty).

I fixed this by adding
/p:VCTargetsPath="C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V120"
or the more elegant
/p:VisualStudioVersion=12.0
into
Build > Build a Visual Studio project or solution using MSBuild > Command Line Arguments

Your first round of fix-it attempts for a build server.
Install the appropriate SDK on the build machine.
http://www.microsoft.com/en-us/download/details.aspx?id=8279
If that doesn't work, report back.
EDIT:
/p:VisualStudioVersion=11.0
Add that to your command line...as a parameter for msbuild.exe
EDIT:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
I have a 64 bit version of msbuild.exe there.
Which isn't what you show.
I'm throwing a guess out, nothing concrete, FYI.

Try passing : /p:PlatformTarget=x86 as one of the arguments to MSBuild.

Related

llvm-sys - Didn't find usable system wide LLVM. But llvm-config is installed

I have built llvm-13.0.1 from source using Visual Studio 17 2022 on Windows 11. When attempting to build llvm-sys (through external crate llvm-ir). It fails, saying:
error: No suitable version of LLVM was found system-wide or pointed to by LLVM_SYS_130_PREFIX.
I know llvm-config exists because I can use it from the command line, and it returns the correct version. I don't understand why this doesn't work. This might be a stupid question but I am really stuck.
I was also having this problem, trying to use llvm-sys on Windows. Here are some mistakes that I did that made it fail to compile just like yours.
Installation Prefix
Make sure that your LLVM installation path doesn't have any whitespace.
Mine was -DCMAKE_INSTALL_PREFIX=C:\Program Files (x86)\LLVM, which was their default install prefix. The whitespace in the installation path causes some errors when using it with llvm-sys. Later, I changed it to C:\LLVM and it worked.
Set Environment Variable
Set Environment Variable LLVM_SYS_<version>_PREFIX to the installed LLVM folder.
From CMD For LLVM-13.0.1
setx LLVM_SYS_130_PREFIX "<PATH TO LLVM WITHOUT WHITESPACE>" /M
Make sure that the variable is registered by using echo command
echo %LLVM_SYS_130_PREFIX%
It should output your registered path, not %LLVM_SYS_130_PREFIX%.
If it doesn’t output your path, restart the computer and try again and it should be working.
Now you should be good to go .....
Hope this helps :)

Opening the code generated from CMake

I am trying to build Assimp to use in visual studio 2012.
Following the instructions on their website: http://assimp.sourceforge.net/lib_html/cmake_build.htm I have tried to build assimp, however I am stuck on the last step "Open the generated solution/project files and have fun"
This is the build folder which was created by CMake - http://puu.sh/fq8kp/cc16e985c3.png
Following the advice of another tutorial I opened this in the terminal and tried to type "make" and launch it. However there isnt a make file so this didnt work. I also typed "install" as there is an install file, however this also did not work.
The tutorial goes as follows:
Type "make" and launch it; you should see the build progressing without issues
When the build is finished, type "sudo make install"; it will ask for your password and install the library!
Any help would be much appreciated!
the 'generated solution/project' in your case (windows) would be the Assimp.sln file. You generated a visual studio solution, so you have to use Visual Studio to build the application.
According to your screenshot, the Assimp.sln file is the 9 KB sized file underneath the one with size 45,120 KB

CMAKE, NMAKE makefiles - 'compiler cl not found' (but VS 12 generator succeeds)

The VS environment variable is set beforehand with vcvars32.bat, and VS is the only compiler that I use; the OS is win 7.
The error happens with cmake-gui; specifying the compiler with path results in error 'compiler failed to make simple test'; alternatively, cmake -i from command line succeeds initially with presenting an 'options' menu which then fails to allocate a 'cmakelists.txt' file (which is somewhere deeper in the cmake folder).
Where am I going wrong?
(I continued with building the solution files from VS 12, but there's other issues.)
The answer to your question from cmake mailing list
Run cmake-gui FROM the target environment, just like you run cmake...
i.e. : type "cmake-gui" in the cmd prompt that has your stuff set up
in it. Don't just launch it from a short-cut unless you're using the
"Visual Studio *" generators. Those do not need any special
environment. Many of the makefile ones do.

Adding blackberry10 platform in cordova(3.0.0) is showing "Error: node cannot be found on the path. Aborting"

I had installed blackberry 10 required software.
Error: node cannot be found on the path. Aborting.
I'm having the same problem. It works when I specify android but not when I specify blackberry10.
As pointed out by Ludivoc above, node is in my path. My command sequence is:
mydir>cordova create test com.example.test Test
mydir>cd test
mydir\test>cordova platform add android
mydir\test>cordova platform add blackberry10
[Error: node cannot be found in path. Aborting.
]
mydir\test>where node
C:\Program Files\nodejs\node.exe
I have also verified that the bbndk is in my path:
mydir\test>where blackberry-signer
C:\bbndk\host_10_1_0_238\win32\x86\usr\bin\blackberry-signer
C:\bbndk\host_10_1_0_238\win32\x86\usr\bin\blackberry-signer.bat
FWIW, I'm running Windows 7 Professional (64bit)
It seems to me that this problem is specific to the cordova scripts for blackberry10 and not to the node installation.
SOLVED: I've had some luck with this problem and there is an answer posted on my thread at http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/lt-img-gt-images-not-being-cached-in-BB10-Webworks-app/m-p/2649771/highlight/false#M41350. The thread actually discusses another problem, but I was able to get this one solved as well (I think:-)). Essentially, you have to make some edits to the init.bat file at C:\Users\.cordova\lib\blackberry10\cordova\3.1.0\bin
We had the same problem and managed to fix it.
The first problem "Error: node cannot be found on the path. Aborting." is related to a file called check_reqs.bat which can be found in the .cordova dir, normally situated in your users home eg. C:\Users\.cordova\lib\blackberry10\cordova\3.1.0\bin\check_reqs.bat
This script tries to check for some files using a variable called %CORDOVA_NODE% e.g.
if not exist "%CORDOVA_NODE%\node.exe" (
No matter what I do, this variable is NEVER set when I call cordova so I just set it by hand
SET %CORDOVA_NODE%=somepath_dont_use_quotes
You might also have to adjust %CORDOVA_BBTOOLS%, on one of our machines it worked, on one it didn't, I was NOT in the mood figuring out why.
The same CORDOVA_NODE issue has to be fixed in your build.bat situated at
\platforms\blackberry10\cordova\build.bat
Last but not least we had a problem in packager.js. There is a logger used in there which gives an error whenever the packager tries to call it so we just put it under comments.
I know this is a little bit of a hack us the %CORDOVA variables should be taken from your system but as those paths shouldn't change we are h appy with the solution.
Open the check_reqs.bat file under C:\Users.cordova\lib\blackberry10\cordova\3.1.0\bin\check_reqs.bat and:
replace %CORDOVA_NODE% with your path to nodejs, mine is C:\Program Files\nodejs.
Then repalce %CORDOVA_BBTOOLS% with the path the blackberry sdk, mine is: C:\bbndk\host_10_2_0_15\win32\x86\usr\bin.
Finally replace the last line "%CORDOVA_NODE%\node" "%~dp0\check_reqs.js" %* by "C:\Program Files\nodejs\node.exe" "%~dp0\check_reqs.js" %*
It works for me
I believe you would get this error if 1) you have not installed node.js or 2) you have installed node.js but not yet added it to your system path.
These two pages provide further detail that may be helpful:
http://cordova.apache.org/docs/en/3.1.0/guide_cli_index.md.html#The%20Command-line%20Interface
http://cordova.apache.org/docs/en/3.1.0/guide_platforms_blackberry10_index.md.html#BlackBerry%2010%20Platform%20Guide
If you install nodejs in the default location, it should be installed in a location that is already in the system path on MacOS
i have updated cordova to 3.2.0,now everything is working fine in win7.
Thank you all
Have u downloaded the Blackberry SDK. You have install the blackberry sdk manually from blackberry's website. only then u can use it in phonegap.
This error occurs in C:\Users\{username}\.cordova\lib\blackberry10\cordova\{version}\bin\init.bat
The fix for me was to add a new environment variable:
Name: CORDOVA_BBTOOLS
Value: C:\Program Files\BlackBerry\BB10 WebWorks SDK 2.2.0.15\cordova-blackberry\bin\dependencies\bb-tools\bin
Your path might not be the exact same. If you can't find it do a search for blackberry-nativepackager.bat and the folder that contains that is the directory you need to set as the value.

fatal error C1083: Cannot open include file: 'Windows.h': and scons

Today is officially my first day with C++ :P
I've downloaded Visual C++ 2005 Express Edition and Microsoft Platform SDK for Windows Server 2003 SP1, because I want to get my hands on the open source Enso Project.
So, after installing scons I went to the console and tried to compile it using scons, but I got this error:
C:\oreyes\apps\enso\enso-read-only\src\platform\win32\Include\WinSdk.h(64) : fatal error C1083: Cannot open include file: 'Windows.h': No such file or directory
scons: *** [src\platform\win32\InputManager\AsyncEventProcessorRegistry.obj] Error 2
scons: building terminated because of errors.
After checking these links:
VS ans PSDK
Include tiffi.h
Wndows.h
I've managed to configure my installation like this:
And even run this script
And I managed to compile the file below in the IDE.
// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
But I still get that exception in the console. Does anyone have scons experience?
EDIT
Actually (and I forgot to tell you this) I started the command prompt with the link "Visual Studio 2005 Command Prompt".
I assume this will include the paths in environment variables. Well after printing them I find that it didn't:
echo %INCLUDE%
echo %LIB%
echo %PATH%
And they were not present, so I created this .bat file:
set PATH=%PATH%;"C:\Program Files\Microsoft Platform SDK\Bin"
set INCLUDE=%INCLUDE%;"C:\ Program Files\Microsoft Platform SDK\Include"
set LIB=%LIB%;"C:\ Program Files\Microsoft Platform SDK\Lib"
Still, scons seeems not to take the vars... :(
Using the above recommendations will not work with scons: scons does not import the user environment (PATH and other variables). The fundamental problem is that scons does not handle recent versions of SDKs/VS .
I am an occasional contributor to scons, and am working on this feature ATM. Hopefully, it will be included soon in scons, but the feature is much harder to implement reliably than I first expected, partly because every sdk/compiler combination is different (and sometimes even MS does not get it right, some of their .bat files are broken), so I can't give you a date. I hope it will be included in 1.2 (to be released in approximatively one month).
You need to set the include file path (and possibly other things). At the command line this is typically done using a batch file that Visual Studio installs called vsvars32.bat (or vcvars32.bat for compatibility with VC6).
I'm not familiar with scons so I don't know the best way to get these settings configured for that tool, but for standard makefiles there's usually a line in the makefile which sets a macro variable with the include directory path and that macro is used as part of a command line parameter in the command that invokes the compiler.
Another possibility might be to have the scons process invoke vsvars32.bat or run the scons script from a command line that has been configured with the batch file.
In short you need to get the things that vsvars32.bat configures into the scons configuration somehow.
There will be a batch file similar to this one (for MSVC 2005) that sets up the environment variables:
c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat
Step 1: Find a similar file in the Express installation folders
Step 2: Create a shortcut on the desktop with these target details and a suitably modified path:
cmd.exe /K "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
Step 3: Open the DOS prompt via this shortcut
The command line build should now work from within this console window.
You show us how you configured Visual Studio for compilations within Visual Studio but you didn't show us what command line environment you tried. Sorry I haven't tried Express versions so I don't know if they create additional Start menu shortcuts like Pro and above do. If you open a suitable command prompt with its environment variables already set then you can compile on the command line. Otherwise you have to set variables yourself or execute a batch script to set them, each time you open a command prompt.
It'll be nice when scons does this automatically. For now, I use this (run from an SDK command prompt, not sure if there is a difference if run after vsvars32.bat):
import os
env = Environment(ENV={'PATH': os.environ['PATH']})
env['ENV']['TMP'] = os.environ['TMP']
env.AppendUnique(CPPPATH=os.environ['INCLUDE'].split(';'))
env.AppendUnique(LIBPATH=os.environ['LIB'].split(';'))
This works for me while compiling wxwidgets with Visual C++ 2005 Express using the command line prompt:
REM Fix Error error C1083 'windows.h'
(Use /useenv option when compiling.)
set PDSKWIN=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2
(Change to the right one.)
set INCLUDE=%PDSKWIN%\Include;%INCLUDE%
set LIB=%PDSKWIN%\Lib;%LIB%
Then I use this line when compiling. I believe just add /useenv to your lines and everything should work fine:
vcbuild /useenv /nohtmllog /nologo name.proj (or any file to compile)

Resources