Visual Studio: MSB3073 error exited with code 1 - c++

everyone. I am compiling DCMTK 3.6.1 in Visual Studio 2013. My OS is Windows 8. I also used CMake 3.2.3. I have already successfully compiled both x64 versions of debug and release for the ALL_BUILD project. However, for the INSTALL project, I can't compile it because the following error occurs:
Error 1 error MSB3073: The command "setlocal
"C:\Program Files (x86)\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 132
According to this link, I need admin rights. But I am already running Visual Studio in Admin mode. Can someone please enlighten me on what I might be doing wrong? Thank you very much!

What about specifying another value for CMAKE_INSTALL_PREFIX in the CMake GUI? That means, a directory where you definitely have write access.

This is an old post, but I encountered the same problem when I attempted to install OpenCV for Windows 10 using VS 16 2019 in a folder close to the root of C:.
Solution: Open cmd as administrator, open the SLN-project (In my case <OpenCV.sln>), and run Build on INSTALL. That worked like a charm.

This is a simple 2 step fix.
First step is to remove the Read Only folder property. To do this, just go wherever you cloned the software you want to build, right click on the containing folder and uncheck the Read Only checkmark.
Second step is to exit visual studio and start terminal as administrator/with sudo privileges if on linux/mac. Navigate to the build folder and type the solution name. This will open up VC with admin privileges.
This fixed the problem for me.

Just open a prompt and run "C:\Program Files (x86)\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake (or similar showed in VS error list) and see where is the problem
in my case the problem was samples were not compiled, so i entered in modules directory and compile manually each module necessary.
After compile the module i run the command again and see what happen, repeat until solve the problem

the best solution;
CMAKE_INSTALL_PREFIX
if you choose realease/debug then after CMake configure by CMake on the same mood.
just try

I had a similar error, if you can check that there are no spaces or character symbols in your path. FOr example I had a directory with the file name 'ABC&D' and by removing & the error was fixed.
This coupled with allowing admin rights should be an attempt to fix the problem.

Related

MysqlConnector C++ (including jdbc) building from source using CMake

I got the latest version of mysql connector/c++ source code form the github respiratory https://github.com/mysql/mysql-connector-cpp. In order to install it I followed the doc:
https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-source.html.
I did configuration and generate the mysql connector/c++ using CMake GUI ver. 3.22 In order to build and install the connector/c++ I used Visual Studio 2022 and Visual Studio 17 2022 compiler. During building I had two problems in two subprojects(in the solution tree) - namely in: connector and connector-jdbc:
Severity Code Description Project File Line Suppression State
Error MSB3073 The command "setlocal
"C:\Program Files\CMake\bin\cmake.exe" -DTARGET=P:/mysql-connector-cpp/_build/jdbc/Release/mysqlcppconn-static.lib -DTYPE=STATIC -DBUILD_LOG=P:/mysql-connector-cpp/_build/jdbc/Release/connector-jdbc.log.STATIC -DMSBUILD=ON -DMSVC=19.30.30709.0 -DINFO=P:/mysql-connector-cpp/_build/jdbc/INFO_BIN -DINFO_PREFIX=jdbc- -P P:/mysql-connector-cpp/_build/libutils/merge_archives.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. connector-jdbc C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 156
I got rid of the the problem by going to properties of the connector and connector-jdbc subprojects next to Post-Build-Events and finally by removing that what was in the field of "Command Line".
I built and installed the connector/c++ you can access it on github: https://github.com/SPiernikowski/mysqlConnector
All variables used when configuring using cmake gui are in the CMakeCache.txt file.
According to doc in paragraph:"Installing Connector/C++ from Source"(https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-source-cpp.html)
"If the build is successful, it creates the connector libraries in the build directory. (For Windows, look for the libraries in a subdirectory with the same name as the build_type value specified for the --config option.)"
I wanted to get static libs for jdbc and xapi respectively on Windows so:
accor.to doc: "If you build legacy static libraries, they have these names:"
mysqlcppconn-static.lib (Windows) - this is for jdbc
mysqlcppconn8-static.lib (Windows) - this is for xapi
Hereunder conserns when solution is already built:
I can find these two files first for xapi in /Release/mysqlcppconn8-static.lib (see on github link to the respiratory is the third one)
and the second one for jdbc in /jdbc/Release/mysqlcppconn-static.lib (see on github link to the respiratory is the third one)
The problem is that each libs file volume are only 2kB.
Definetly something went wrong but I am not able to find the reason.
I opend the mysqlcppconn-static.lib file:
hereunder see the part of it:
/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ń Ś N P:\mysql-connector-cpp_build\jdbc\connector-jdbc.dir\Release\empty.obj :
Despite this I can find libs for every subprojects:
/xapi/Release/xapi.lib - volume 6097kB
/jdbc/driver/Release/jdbc.lib - volume 4413kB
/devapi/Release/devapi.lib - volume 6073 ... and so on
Hereunder conserns when solution is already installed:
I can find in /_install/lib64/vs14 folder the two libs:
mysqlcppconn8-static.lib and mysqlcppconn-static.lib but thay have only
2KB volume each (see it in repo on git in the _install folder)
Maybe I wrongly configured something in CMake???
I add that mysqlcppconn-static.lib volume should be 55628kB
Maybe the problem is trivial but I can not see it. Please share with me if you see something is done wrongly.

Unable to build GDAL Visual Studio project with "generate_vcxproj.bat"

I need to link GDAL library to a c++ project.
I use the instruction from here:
http://trac.osgeo.org/gdal/wiki/GeneratingVisualStudioProject
Download gdal231.zip from official web site. Unpack.
(this step may be omitted — result will be the same) Edit nmake.opt by adding this in the very top of the file:
MSVC_VER=1910
WIN64=1
(don't know if it's right; there is no thorough guide)
Run win cmd, type "generate_vcxproj.bat 15.0 64 gdal_vs2017", wait for finish.
Open gdal_vs2017.vcxproj with MSVS Community 15.8.4. Build solution.
Build failed with "fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory".
Project settings look strange:
1
"VC++ Directories" seem normal, except $(VC_SourcePath) in "Library Directories":
2
What's wrong with it?
In order to build GDAL one doesn't need a Visual Studio project. Don't know what's wrong with "generate_vcxproj" script — it just does'nt work. But there is another way.
Unpack gdal231.zip.
Launch "x64 Native Tools Command Prompt for VS 2017" (or whatever version of VS command prompt that suits your needs). cd to "gdal-2.3.1\" dir.
Open nmake.opt file. In it's beginning there are some hints for usage of makefile.vc. Pick some arguments from there. I opt for x64 release build, so my call to nmake was like that: "nmake -f makefile.vc MSVC_VER=1910 WIN64=1". (1910 is a version of Visual Studio 2017).
Switch to "Native tools command prompt" and type "nmake -f makefile.vc MSVC_VER=1910 WIN64=1" there. Enter.
When it's finished, type "nmake -f makefile.vc MSVC_VER=1910 WIN64=1 install" and press Enter.
When that's finished too, type "nmake -f makefile.vc MSVC_VER=1910 WIN64=1 devinstall" and press Enter.
Done. The library is in C:\warmerda\bld\ folder.
I got the same problem when building with VS2017 Community Edition. I was able to build fine using VS2015 Community Edition.
Bottom line: when running the .bat, use the 2015 option.
Modify the generate_vcxproj.bat file using the information from here:
https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
I modified mine to work with Visual Studio Community 2019 by modifying lines 55-70 to be this:
if "%_vcver_%"=="16.2" (
set _clver_=1922
set _vstoolset_=v1422
) else if "%_vcver_%"=="15.0" (
set _clver_=1910
set _vstoolset_=v141
) else if "%_vcver_%"=="14.0" (
set _clver_=1900
set _vstoolset_=v140
) else ( if "%_vcver_%"=="12.0" (
set _clver_=1800
set _vstoolset_=v120
) else (
echo Wrong value for parameter 1. See usage:
goto :usage
))

LNK1181 error when compiling V8 engine on Win10

I'm following this guide on building V8 but I am hitting some issues on the compilation step. I am running Windows 10 x64. I am trying to compile with options to embed the engine also.
Running the following command:
ninja -C out.gn/x64.release
Gives me this error:
ninja: Entering directory `out.gn/x64.release'
[1/471] LINK mksnapshot.exe mksnapshot.exe.pdb
FAILED: mksnapshot.exe mksnapshot.exe.pdb
C:/Workspace/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./mksnapshot.exe /PDB:./mksnapshot.exe.pdb #./mksnapshot.exe.rsp
LINK : fatal error LNK1181: cannot open input file 'comdlg32.lib'
ninja: build stopped: subcommand failed.
Now I believe I have narrowed down the error to looking for the .lib files in the wrong directory. I have (had) multiple versions installed, so there were multiple folders in my Windows Kit install.
Windows Kits/10/Lib/10.0.16299.0
Windows Kits/10/Lib/10.0.15xxx.0
If I dragged and dropped the comdlg32.lib file from 10.0.16299.0 into the 10.0.15xxx.0 directory then the error changed to a LNK1181 error with a different input file. I did this a few times but I was unsure if this was going to cause issues with different versions and there was probably going to be a lot.
I uninstalled the 10.0.15xxx.0 version which left behind the folder I mentioned, so I removed that and after doing so I have started getting the LNK1181 error with a different input file (advapi32.lib I assume the very first file it can't find). This is how I came to the conclusion about the path being incorrect.
So I have tried a few things to change the path (I hoped just uninstalling the old version would fix it) such as:
Uninstalling the old version.
Going through registry entries to see if I can find an install path or something using that path, which I didn't. I did notice that there was still installation and data in the registry for the 10.0.15xxx.0 install, I might try deleting that from the registry directly as a last resort?
I have tried to explicitly set the path by setting <TargetUniversalCRTVersion>10.0.16299.0</TargetUniversalCRTVersion> in this file: C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\uCRT.props
I have never used Ninja before so I tried looking for a way to set some kind of lib-path in the command but couldn't really find anything.
I looked through the python scripts being executed to try and locate something to do with the libs path but couldn't see anything.
I would be grateful for any help and suggestions. Thanks.
You can try to compile v8 using Visual Studio as explained here: https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#using-the-visual-studio-ide
By running the following commands:
$ gn gen --ide=vs out.gn/x64.release
$ cd out.gn/x64.release
$ msbuild all.sln
You can see a full example here: https://github.com/phpv8/v8js/issues/272#issuecomment-262848754
Apparently this method is not officially supported anymore, but I had the same problem as you have and this solved the issue for me.
Note that after this I had another issue, the unit tests failed to be compiled due to a linking error, but I had the necessary libraries to use v8. So there may be deeper problem that is causing all of this that I'm missing.
Edit:
Also, you could try to set the following parameters with gn args:
visual_studio_path = "..."
visual_studio_version = "2017"
wdk_path = "..."
windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10"
To set those parameters, do:
gn args out.gn/x64.release
This will open a text editor where you can write the extra parameters you are interested in.
To see the full list of parameters you can specify:
gn args --list out.gn/x64.release
I was following this guide https://medium.com/dailyjs/how-to-build-v8-on-windows-and-not-go-mad-6347c69aacd4 and also ran into the error
LINK1181: cannot open input file 'advapi32.lib'
I'm pretty sure it was because I had the wrong versions of the Windows 10 SDK. Similar to you I had versions:
Windows Kits/10/Lib/10.0.10240.0
Windows Kits/10/Lib/10.0.16299.0
But according to https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#Setting-up-Windows (Which I think is relevant) you need version 10.0.15063.0
After installing version 10.0.15063.0 (with the visual studio installer) to
Windows Kits/10/Lib/10.0.15063.0
I was able to continue with the build.

Building via MSBuild fails when run as System User

We are using Visual Studio 2012 to build our C++ application
If I run from the commandline in my source folder:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release /p:Platform=Win32 Myproject2012.sln
it works fine. If it's run via the Buildscript of my buildserver (Atlassian bamboo) I get a lot of errors. The first two lines..
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: The "CL" task failed unexpectedly. [C:\data\bamboo-home\xml-data\build-dir\XXX-IMB-JOB1\XXX\common\common.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.IO.DirectoryNotFoundException: Das System kann den angegebenen Pfad nicht finden. (Exception from HRESULT: 0x80070003) [C:\data\bamboo-home\xml-data\build-dir\XXX-IMB-JOB1\XXX\common\common.vcxproj]
What can be the reason for this behaviour?
You can run the build outside of Bamboo as system if you use Sysinternals psexec.
psexec -i -s cmd.exe
Then try C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release /p:Platform=Win32 Myproject2012.sln
Then create a shell that have elevated permissions and retry.
Should help see if its a permissions thing or a path thing. Ive tried building C++ as system and it seems PK.
Or it could be this:
MSBUILD MSB4018 error
I found the problem
The System Account has a default temp directory which msbuild doesn't like
I changed it to "c:\temp" no it works!
If someone else has the problem, you can change it in the registry
HKEY_USERS\.DEFAULT\Environment

OpenSSL build odd behaviour

Its kinda an odd story. I'm trying to build the openssl library. Well, it is not the first time I'm doing it and until now it was fine. however, I've desided to add a build configuration to TeamCity (actually the problem has nothing to do with TeamCity)to build all my third parties libraries on-demand. So, I created a step with common set of openssl build commands:
perl Configure VC-WIN64A
ms\do_win64a.bat
nmake /d /f ms\ntdll.mak
... and the build failed while assembling the very first asm file. So I ran same commands in VS2012 x64 command prompt and the build succedeed, as expected. It took a while untill I figured out that the problem is in output redirection. Teamcity redirects output from build step to the teamcity build log, so did I by adding ">1.txt" to "nmake /d /f ms\ntdll.mak" command, and the build failed. I would say it is somewhat unexpected reason for build to fail.
So far, I've tried:
Building the same from VS2010 command prompt with redirection,
failed.
Building the same from VS2010 command prompt without
redirection, succeded.
Building the same from VS2010/VS2012 command
prompt with redirection to file and forcing redirection to CON (nmake
/d /f ms\ntdll.mak >CON >1.txt) failed.
Googling for "nmake problems
when console output is redirected" - nothing
Googling for "openssl
build problems when console output is redirected" - nothing
My setup
- Win2008R2, virtual machine.
- VS2010, latest updates
- VS2012, Update 1
Actual error:
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\ml64.EXE"' : return code '0x1'
ml64.exe complains about the asm file stating it should end with "END" statement. It does, but...
Any ideas?
Ok, since the problem is in perl and writing files to stdout and then redirecting it you have to change following files to build x64 version:
crypto\aes\asm\aes-x86_64.pl
crypto\bn\asm\modexp512-x86_64.pl
crypto\bn\asm\x86_64-gf2m.pl
crypto\bn\asm\x86_64-mont.pl
crypto\bn\asm\x86_64-mont5.pl
crypto\md5\asm\md5-x86_64.pl
crypto\modes\asm\ghash-x86_64.pl
crypto\rc4\asm\rc4-md5-x86_64.pl
crypto\rc4\asm\rc4-x86_64.pl
crypto\sha\asm\sha1-x86_64.pl
crypto\sha\asm\sha512-x86_64.pl
crypto\whrlpool\asm\wp-x86_64.pl
crypto\x86_64cpuid.pl
engines\asm\e_padlock-x86_64.pl
you have to open these files and change all "open STDOUT "whateverfile"" to something like "open my $asmfile "whaeverfile"", then take care of string concatenation (only in x86_64cpuid.pl) and then print it to the file instead of STDOUT, something like "print $code" to "print $asm $code"
and of course, dont forget to close the file, in another words change the "close STDOUT" to "close $asmfile"
Obviously when building target other than x64 one will have to change another set of files.
Will try to communicate it to openssl maintainer.