How to build OpenSSL in Visual Studio 2013?
I try to compile in this lesson, but there is an error:
Assembling: tmp32\x86_64cpuid.asm
tmp32\x86_64cpuid.asm(1) : error A2088:END directive required at end of file
NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual Studio 12.0\
I compiled under x64. What could be the problem? Thank you in advance.
I wrote a note to build OpenSSL here (Unix and Windows).
Make sure you use the original OpenSSL source (do not re-use the compiled source code).
Open the Visual Studio x64 Win64 Command Prompt (2010) (in the Start menu)
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" amd64
perl Configure VC-WIN64A --prefix=C:\openssl_x64 no-asm no-shared enable-tlsext enable-static-engine
ms\do_win64a
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
I remember encountering also the same error building OpenSSL 1.0.2d as a static library. A solution that worked for me is the following :
In a new command line window build OpenSSL and install it into C:\build\bin\openssl-1.0.2d-x64 directory:
cd C:\build\src\openssl-1.0.2d-x64
set PATH=%PATH%;C:\nasm
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
perl Configure VC-WIN64A --prefix=C:\build\bin\openssl-1.0.2d-x64 enable-static-engine
ms\do_win64a
nmake /f ms\nt.mak
nmake /f ms\nt.mak test
nmake /f ms\nt.mak install
Resulting build is located in C:\build\bin\openssl-1.0.2d-x64 directory.
Hope that helps !
Take this answer updated for visual studio 2015
1 - Make sure to use the 1.0.2h openssl source.
2 - Make sure that you install (Old) nasm (NOT THE LATEST): use version 2.11 [1]:http://www.nasm.us/pub/nasm/releasebuilds/2.11/ from 2013 and put it on your path.
3 - Open any normal Command Prompt (cmd) - administrator is preferred - and execute these commands in the root directory of the downloaded source.
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" amd64
perl Configure VC-WIN64A --prefix=C:\openssl_x64 no-asm no-shared enable-tlsext enable-static-engine
ms\do_win64a
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
Update for Visual Studio 2017:
1) I used the 1.0.2h openssl source. I have not tried other versions.
2) Have perl installed and in your PATH.
3) Install NASM and add it to your PATH (e.g. to C:\NASM and/or edit the PATH setup below). The latest version (2.13.1) worked fine for me.
4) Check and, if needed, edit the path to vcvarsall.bat used below.
5) (optional) Edit the install folder in the command bellow (set via --prefix).
6) Open Command Prompt in the root directory of the downloaded source, (edit and) execute the following commands:
set PATH=%PATH%;C:\nasm
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"" amd64
perl Configure VC-WIN64A --prefix=C:\openssl_x64 no-asm no-shared enable-tlsext enable-static-engine
ms\do_win64a
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
7) (Optional) In case you have multiple versions of VS installed, you might want to verify that the correct version of nmake was executed (14.10.* and not e.g. 14.0* or 12.*)
Related
I'm currently trying to build curl for VS2017, when setting things up with x86 Native Tools Command Prompt, I run the command:
nmake /f Makefile.vc mode=static vc=15 debug=yes
When it gets to the part "Copying libs" it gives me the error:
NMAKE: fatal error U1073: don't know how to make '..\src\tool_hugehelp.c'
As well as another error below:
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
Does anyone know why these errors would be occurring? Or how to resolve them?
If the first answer did not clear things up(if though it is the right.)
Download the lib curl from Github.
Steps for building x64 Debug:
Open x64 Native Tools Command Prompt VS 2019
cd into the repo.
open the repo in file explorer and double click buildconf.bat
file.
cd into \buildtools in x64 Native Tools Command Prompt VS
2019
Type, set RTLIBCFG=static, Press enter.
6.Type, nmake /f Makefile.vc mode=static vc=16 debug=yes
For Release
Type, nmake /f Makefile.vc mode=static vc=16 debug=no
after download and unzip curl files , u find in Curl directory buildconf.bat , run them and u get tool_hugehelp.c for nmake
I am trying to build a cuda/c++ program in Visual Studio 2017. It might be worth noting that my computer also has VS 2013 installed. I have tried placing vsvars32.bat in the same directory as it is for VS 2013 but the error did not change. I don't know where it's supposed to go because of the x64/../../..
>------ Build started: Project: CMakeLists, Configuration: Debug ------
[1/5] cmd.exe /C "cd /D "D:\Users\adm_lab\CMakeBuilds\3f75e69e-932c-9435-a942-a027b1514a1d\build\x64-Debug (default)\CMakeFiles\voxelizer.dir" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E make_directory "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//." && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -D verbose:BOOL=OFF -D build_configuration:STRING=Debug -D "generated_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj" -D "generated_cubin_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj.cubin.txt" -P "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//voxelizer_generated_main.cu.obj.Debug.cmake""
FAILED: CMakeFiles/voxelizer.dir/voxelizer_generated_main.cu.obj
cmd.exe /C "cd /D "D:\Users\adm_lab\CMakeBuilds\3f75e69e-932c-9435-a942-a027b1514a1d\build\x64-Debug (default)\CMakeFiles\voxelizer.dir" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E make_directory "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//." && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -D verbose:BOOL=OFF -D build_configuration:STRING=Debug -D "generated_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj" -D "generated_cubin_file:STRING=D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj.cubin.txt" -P "D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug (default)/CMakeFiles/voxelizer.dir//voxelizer_generated_main.cu.obj.Debug.cmake""
nvcc fatal : Visual Studio configuration file 'vsvars32.bat' could not be found for installation at 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/../../..'
CMake Error at voxelizer_generated_main.cu.obj.Debug.cmake:219 (message):
Error generating
D:/Users/adm_lab/CMakeBuilds/3f75e69e-932c-9435-a942-a027b1514a1d/build/x64-Debug
(default)/CMakeFiles/voxelizer.dir//./voxelizer_generated_main.cu.obj
ninja: build stopped: subcommand failed.
Build failed.
edit: thought I should add that the computer this is on does not have an internet connection so I used the local cache method outlined here to install VS.
Please, double-check your Visual Studio 2017 instance is up to date. Then repair your Visual Studio instance via the Visual Studio Installer:
Start Visual Studio Installer.
Click the Details icon icon in front of your Visual Studio 2017 installation, and then click Repair.
Read Microsoft Docs | Repair Visual Studio for more information.
I was trying to #include <openssl/hmac.h> in my C++ app. So I tried to follow this instructiosn:
http://www.askyb.com/windows/compiling-and-installing-openssl-for-32-bit-windows/comment-page-1/#comment-47532
I succesfully did this much:
Create a new folder C:\openssl-1.0.1c
Downloaded 1.1.0c from github - https://github.com/openssl/openssl/tree/91eaf079b7430cb4ebb7f3ccabe74aa383b27c4e
Extracted it to C:\openssl-1.0.1c
I downloaded and installedinstall ActiveState Perl
Added C:\perl\bin to my path like this in my screenshot - http://i.imgur.com/QOhKUwl.png
Create a new folder C:\openssl-1.0.1c-bin
Opened command prompt with Win+R then typed cmd
Then pasted with quotes "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat", which is the correct path, it exists on my system
It ran then I did perl Configure VC-WIN32 no-asm – -prefix=C:\openssl-1.0.1c-bin (no quotes), it told me to ppm install dmake to get nmake so I did that - http://i.imgur.com/SuC65oo.png
I typed nmake as per this issue - https://github.com/curl/curl/issues/1002 - it is no longer possible to do nmake -f ms\ntdll.mak, this took like 15minutes
It worked then I did nmake test
All tests passed, however my C:\openssl-1.0.1c-bin directory is empty and doing #include <openssl/hmac.h> is not working my visual studio.
I'm a newbie to writing c++.
Thanks
You missed a step at the end, Run this command “nmake -f ms\ntdll.mak install”. It will copy all the libraries to C:\openssl-1.0.1g-bin.
If you do that it will work as expected. I just tried it locally with windows 7 and visual studio 2015 and it worked fine.
The warning about nmake is spurious you can continue using nmake ok.
I am trying to automate the build process for one of my QT-project. I used the following command in my batch file for non-QT projects
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" "myproject.sln" /build "Debug|x64" /projectconfig Debug
but it is not working for my QT project. Am I missing something?
Here is an example on how to do that (command by command):
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
cd <my_project_directory>
qmake
nmake
The first command sets up the environment for using Visual Studio tools.
Second command changes the current directory to one where your Qt project file is (you have to have one).
Third command runs Qt's qmake.exe utility to generate make files.
And finally nmake will build your project.
However, if you don't use Qt project files and have only VisualStudio solution, you can use MSBuild utility, like:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
MSBuild your_solution.sln /p:Configuration=Debug
You can also set additional environment variables, such as QTDIR if it does not find your Qt installation.
If somebody finds this question looking for an answer on how to automate the build process of a QT project, and wants to do it using a BATCH file as the original question states, here is the BATCH script that I used to automate my building process:
#echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
cd %path_to_your_repo%
nmake /f Makefile.Release clean && qmake.exe %path_to_your_.pro% -spec win32-msvc "CONFIG+=qtquickcompiler"
nmake qmake_all
nmake -f Makefile.Release
It is important to call the vcvarsall.bat the first thing, as this will set the environment for all visual studio tools. Also make sure to launch it with call, if you just start the batch file as in #vahancho's answer it will stop your script after executing vcvarsall.bat.
The clean step is not necessary but it is a good practice to use it before building.
It is important to select the -spec and CONFIG (if any) during the qmake step, as this will allow you to select the compiler and required configuration if you are using some extra QT configuration.
I am trying to build GDAL (1.9.2) in x64.
In the instructions, I see:
# Uncomment the following if you are building for 64-bit windows
# (x64). You'll need to have PATH, INCLUDE and LIB set up for 64-bit
# compiles.
!IF "$(PLATFORM)" == "x64"
WIN64=YES
!ENDIF
And then, lower,
# Under win64, symbols for function names lack the underscore prefix
# present on win32. Also the STDCALL calling convention is not used.
!IFDEF WIN64
!UNDEF STDCALL
!ELSE
SYM_PREFIX=_
!ENDIF
Can't find a PATH, INCLUDE and LIB specific for x64, or anything else that I should do...
I can build in Win32.
In x64, I get linker errors:
LINK : error LNK2001: unresolved external symbol _OGRFeatureStylePuller
LINK : error LNK2001: unresolved external symbol _OSRValidate
...
gdal19.dll : fatal error LNK1120: 74 unresolved externals
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\BIN\link.EXE"' : return code '0x460'
I put (to build in Win32)
!IFNDEF PLATFORM
PLATFORM=WIN32
!ENDIF
Modified to
!IFNDEF PLATFORM
PLATFORM=x64
!ENDIF
(to build in x64) - And it worked. But only if I build from inside Visual Studio.
I would like to be able to use a bat file (and build alll platform/configurations)
The above - while it builds in VS, it will not build from command line
(with commands:
start /b /wait nmake -f makefile.vc clean
start /b /wait nmake.exe /f makefile.vc PLATFORM=x64
start /b /wait nmake.exe /f makefile.vc devinstall PLATFORM=x64
The exact same thing builds in Win32...
I can't figure out what is wrong...
I managed to build x64 version of GDAL under Visual Studio 2012 using steps from http://dominoc925.blogspot.ru/2013/03/build-64-bit-gdal-for-windows.html:
Download gdal-1.9.2.tar.gz (or other version of sources) from http://download.osgeo.org/gdal/
Unpack to some directory, e.g. C:\tmp\gdal-1.9.2\
If you tried to build GDAL previously (e.g. x86), make sure that the build directory (C:\warmerda\bld\) and the source directory are clean from previous build attempt. If unsure, try to unpack sources in a new directory.
Start VS2012 x64 Native Tools Command Prompt:
Start -> All Programs -> Microsoft Visual Studio 2012 -> Visual Studio Tools -> Open VS2012 x64 Native Tools Command Prompt
Or run
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64).
Change directory to the directory with unpacked GDAL sources:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>cd /D C:\tmp\gdal-1.9.2
D:\trn4\gdal-1.9.2>
Build GDAL with development files:
nmake /f makefile.vc MSVC_VER=1700 WIN64=YES
nmake /f makefile.vc MSVC_VER=1700 WIN64=YES install
nmake /f makefile.vc MSVC_VER=1700 WIN64=YES devinstall
You can get your MSVC_VER number from here. GDAL will be built and installed to C:\warmerda\bld\.
To build with nmake command line I had to run the command from a command shell that has the appropriate variables set to build for 64 bits.
This is what I did to set up the 64 bits building environment:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
You should first somehow make clear to readers of this thread that over the 6 edits you've done yet, the focus of your question changed more than once, as one can see from the revision history
Anyway:
Now it's just a batch vs ide build job issue; try exporting the makefile from VS
EXPORTING! NOT just opening the package orginal makefile.vc in an editor window!
, save it under a name different from the package's "makefile.vc" and use that in your batch.
"I can build in Win32."
Have you had built for Win32 BEFORE your Win64 built attempt?
If so, pls attend
http://trac.osgeo.org/gdal/ticket/4636, bottom of the reply list:
Just to note for anyone else having the issue.. I'll try to look more
into this when I can.. but in the meantime, a clean build is not
really doing a "clean" so make sure you manually delete your files if
you do a 32 bit build before your 64bit build.
You could also try to simply extract the source again at a different directory, in order to have a clean tree and try to build there for Win64.