How to compile OpenSSL on Windows? - c++

I have been following the instructions in the OpenSSL User Guide, which links to a guide by 3noch for compiling OpenSSL. Here are the tools/versions I am using:
ActiveState Perl v5.20.2
Microsoft Visual Studio 2012
Netwide Assembler (NASM) v2.12.02
OpenSSL 1.0.2j (source tarball)
Following the instructions, I am able to execute the following commands without issue:
perl Configure VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32
ms\do_ms
Then, when I go on to execute
nmake -f ms\nt.mak
I receive the following
Assembling: tmp32\sha1-586.asm
tmp32\sha1-586.asm(1432) : error A2070:invalid instruction operands
tmp32\sha1-586.asm(1576) : error A2070:invalid instruction operands
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\ml.EXE"' : return code '0x1'
Stop.
After looking into that issue, I found a blog post by HostageBrain that mentions that exact error, stating to use nasm to perform the compiling. So, I switched to this command sequence:
perl Configure VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32
ms\do_nasm
nmake -f ms\nt.mak
However, once switching to the NASM variation, I receive the following errors:
tmp32\sha1-586.asm:1: error: parser: instruction expected
tmp32\sha1-586.asm:2: error: parser: instruction expected
tmp32\sha1-586.asm:3: error: parser: instruction expected
tmp32\sha1-586.asm:4: warning: label alone on a line without a colon might be in error
tmp32\sha1-586.asm:5: warning: label alone on a line without a colon might be in error
tmp32\sha1-586.asm:6: warning: label alone on a line without a colon might be in error
tmp32\sha1-586.asm:7: error: symbol `IF' redefined
tmp32\sha1-586.asm:7: error: parser: instruction expected
tmp32\sha1-586.asm:8: error: parser: instruction expected
tmp32\sha1-586.asm:9: error: comma expected after operand 1
What I am looking for is to be able to compile OpenSSL into .lib files that I can then link to from other C++ projects, such as when compiling FreeTDS.

On the same my blog page which you refer I also describe 'no-asm' case - this case is simpler for compiling (it won't require nasm at all), but drawback is - some algorithms performance will be 2x-4x slower than assembler versions.
If your case can accept this performance - try to compile 'no-asm' case.
perl Configure VC-WIN32 no-asm --prefix=C:\Build-OpenSSL-VC-32

I built the library from a regular command prompt on Windows 10 with VS 2015 with the following commands (debug build shown):
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
perl Configure debug-VC-WIN64A --prefix=C:\Path\to\target\folder
ms\do_win64a
nmake -f ms\ntdll.mak
cd out32dll.dbg
..\ms\test
cd ..
nmake -f ms\ntdll.mak install

I know this is an old post, but for others having the problem with NASM parsing errors, here's the solution:
Once you run either ms\do_ms.bat (to use masm) or ms\do_nasm.bat (to use nasm), you can't just switch to the other one without first clearing out the tmp32 directory, otherwise perl will never regenerate the .asm files correctly. The parser errors you're getting are from nasm trying to assemble a masm-formatted file.
The easiest way to clean out tmp32 is to run "nmake -f ms\nt.mak clean".

Answering to this very old question. There are a couple of problems associated with building it under x64 that way including hitting "assemblers not found", downloading NASM and adding to path etc. There is a very good and simple solution using MSYS2.
Install MSYS2. Ensure you get the toolchain needed (see the guide for pacman). Then follow below steps
$Launch msys2_shell.cmd -mingw64
$wget -c ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/openssl-1.0.2o.tar.gz
$tar -xzvf openssl-1.0.2o.tar.gz openssl-1.0.2o/
$cd openssl-1.0.2o/
$./configure shared mingw64
$make
That's it. In apps directory you will get openssl executable along with the libraries.
-Sreejith. D. Menon

Related

*** internal error: unable to open jobserver semaphore '3,4': (Error 2: The system cannot find the file specified. ). Stop

I am trying to compile an existing qt application's code using mingw compiler.
During compilation I am getting an error "*** internal error: unable to open jobserver semaphore '3,4': (Error 2: The system cannot find the file specified. ). Stop".
My current project is a makefile based project. Here I have one make file (parent.mk) that compiles all primary modules and then
parent.mk
compilation steps
.
.
.
make $QT_CODE_DIR
Here in this QT code directory I have another makefile (child.mk) which has following content:
child.mk
cd "qtcode_compilation_out_dir"
qmake.exe "product.pro" -r -spec win32-g++
CONFIG+=release
mingw32-make -w
If I try to run the make command manually for QT code then it works fine.
#Alexander: Thanks for the suggestion.
Please suggest if anyone has any idea about it.
Thanks.
Finally, I found out the exact reason of the problem and solution as well.
Reason for failure:
The compilation command that I am using is "make" which is been aliased to "make -j2"and along with "mingw32-make -w" it was producing the error because mingw32-make is an obsolete make command and it doesn't support multi threaded compilation.
Solution:
I just replaced the mingw32-make with make.

Can build Mysql Connector C++ on vs 2017?

I tried to build mysql-connector-c++ from source to static library.
Referring the official spec here, I generated the Visual studio solution by the following command:
cmake -DMYSQL_DIR="E:\mysql-5.7.21-winx64" -DWITH_BOOST="E:\libs\boost_1_67_0_BUILDED" -DWITH_JDBC=ON -G "Visual Studio 15 2017 Win64" ../
Then, I opened the vs solution generated by cmake.Run build, got the two libs: mysqlcppconn8-static-mt.lib, mysqlcppconn-static-mt.lib, and copied them to my project.
When I built my project (also vs2017 version), I got the error:
mysqlcppconn-static-mt.lib(net_serv.obj) : error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1800”不匹配值“1900”(ActionProcessor.obj 中)
I am confused. They're all built in vs2017, and platform toolset are all set to "Visual Studio 2017 (v141)". I can't understand where 1800_MSC_VER has come from.
Here is what I did
Specs
Visual Studio 15, (2017)
x64
Static (.lib)
With static runtime (/MT)
Tools
CMAKE
Bison (In a folder without spaces)
Perl (ActiveState or Strawberry)
OpenSSL 1.0.2q.tar.gz
Add CMAKE, Bison and pearl to your system path
Check to see if you got all setup correctly
C:\>cmake --version
cmake version 3.9.6
C:\>bison --version
bison (GNU Bison) 2.4.1
C:\>m4 --version
m4 (GNU M4) 1.4.13
C:\>perl -version
This is perl 5, version 24, subversion 3 (v5.24.3)
Step 1: Build OpenSSL 1.0.x
Note: if you want to build OpenSSL 1.1.x steps will be a bit different
Extract to: C:\mysql-8.0.15\openssl-1.0.2q
Run: x64 Native Tools Command prompt for VS 2017
cd C:\mysql-8.0.15\openssl-1.0.2q
Release
perl Configure VC-WIN64A no-shared --openssldir=.\rel64
ms\do_win64a
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
Debug
nmake -f ms\nt.mak clean
perl Configure debug-VC-WIN64A no-shared --openssldir=.\dbg64
ms\do_win64a
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
Step 2: Build MySQL (Yes the actual database)
Extract to: C:\mysql-8.0.15
Run: x64 Native Tools Command prompt for VS 2017
cd C:\mysql-8.0.15\
cmake . -G "Visual Studio 15 2017 Win64" ^
-DWITH_BOOST=C:/mysql-8.0.15/boost ^
-DDOWNLOAD_BOOST=1 ^
-DBUILD_CONFIG=mysql_release ^
-DWITH_SSL=C:\mysql-8.0.15\openssl-1.0.2q\rel64 ^
-DLINK_STATIC_RUNTIME_LIBRARIES=1
Copy m4.exe to C:\mysql-8.0.15\sql\ this avoids any m4.exe errors during built
Open MySQL.sln and build for release x64
Copy binary_log_funcs.h and binary_log_types.h from mysql-8.0.15\libbinlogevents\export to mysql-8.0.15\include
The library should be located at:
Static release library: C:\mysql-8.0.15\archive_output_directory\Release\mysqlclient.lib
Step 3: Build MySQL Connector C++
Copy C:\mysql-8.0.15-dbg\archive_output_directory\Debug\mysqlclient.lib
to C:\mysql-8.0.15-dbg\lib\vs14
Run CMAKE GUI
Browse to the path of the MySQL Connector Project.
Click Configure, Select Visual studio 15 2017 Win64, native compilers
Tick BUILD_STATIC
Tick STATIC_MSVCRT
TICK WITH_JDBC
remove WIN_SSL_YASL from CONFIG_VARS
WITH_SSL = C:\mysql-8.0.15\openssl-1.0.2q\rel64
WITH_BOOST= C:\mysql-8.0.15\boost\boost_1_66_0
MYSQL_DIR=C:\mysql-8.0.15
Open MySQL_CONCPP.sln build for Release x64
The library is located at:
C:\mysql-connector-c++-8.0.15\jdbc\install\lib\mysqlcppconn-static-mt.lib
C:\mysql-connector-c++-8.0.15\Release\mysqlcppconn8-static-mt.lib
Step 4: Test it
Note: This test is for the JDBC style API. If you are not maintaining an existing application, use the new xdevapi API.
Create a new project and put the following in main.cpp
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#define STATIC_CONCPP
#define CONCPP_BUILD_STATIC
#define CPPCONN_PUBLIC_FUNC
#include <driver.h>
#include <connection.h>
#include <statement.h>
#include <exception.h>
sql::Driver *mDriver;
sql::Connection *mConnection;
int main() {
mDriver = get_driver_instance(); //or use: new MySQL_Driver()
try {
mConnection = mDriver->connect("host", "username", "password");
mConnection->close();
}catch(sql::SQLException& ex) {
std::cout << ex.what();
}
delete mConnection;
return 0;
}
Set: Linker > Input > Additional Dependecies:
libeay32.lib;mysqlclient.lib;mysqlcppconn8-static-mt.lib;mysqlcppconn-static-mt.lib;ssleay32.lib;%(AdditionalDependencies)
Set: Configuration Properties > VC++ Directories
Include Directories.
Library Directories.
I don't even know where to start explaining to be honest. Building this was a massive pain.
Before you begin to read this, please ensure you have the following:
C:\boost
C:\OpenSSL-Win32
C:\OpenSSL-Win64
Because I was writing my own "wrapper" and trying to make UNICODE work properly, I was getting weird exceptions, and I was unable to debug anything because I downloaded the latest package which is built without debug information (https://dev.mysql.com/downloads/connector/cpp/)
This is the first time I try to build this, so I went to their Github repository and grabbed the latest "master": https://github.com/mysql/mysql-connector-cpp
BUT! This does not contain the "JDBC" sources, which is by the way the "native" connector as they call it. So I grabbed it from the branch: https://github.com/mysql/mysql-connector-cpp/tree/jdbc and then copied the files into "mysql-connector-cpp-master\jdbc".
OK. I opened "x64 Native Tools Command Prompt for VS 2017" and navigated to "mysql-connector-cpp-master". At this point I still had no idea what I am doing and how to build it, all I could understand from the docs and different articles here is to run:
cmake -DWITH_JDBC=ON --build .
This started to configure things and build OK, but it stopped here:
-- Searching for static libraries with the base name(s) "mysqlclient"
CMake Error at FindMySQL.cmake:524 (message):
Could not find "mysql.h" from searching "/usr/include/mysql
/usr/local/include/mysql /opt/mysql/mysql/include
/opt/mysql/mysql/include/mysql /usr/local/mysql/include
/usr/local/mysql/include/mysql C:\Program Files/MySQL/*/include
C:/MySQL/*/include"
Call Stack (most recent call first):
CMakeLists.txt:332 (INCLUDE)
OK. So what now... where is "mysql.h" ?! After searching... and searching, I found this: Missing mysql.h and trying to find mysql-devel
And I quote:
Grab the MySQL Community Server and install it on your system. It
contains a directory called include in which you find the mysql.h.
Ok, great we need more stuff. So I download: https://dev.mysql.com/downloads/mysql/ and run the command again.
Happy days, something happened but no libs yet. I did get however a VS 2017 solution called: "MYSQLCPPCONN.sln".
This contains VS 2017 configuration to build the library for Win32. And of course trying to build with this solution will give you A LOT of unresolved external symbols.
So I run again the cmake but with static option added:
cmake -DWITH_JDBC=ON -DBUILD_STATIC=ON --build .
This time when I open "MYSQLCPPCONN.sln" I can see another project "mysqlcppconn-static" and this builds fine without issues.
However, in my case I need x64. I just created a new configuration for x64 by copying the exiting configuration fron Win32.
So that's it, I have both Win32 and x64 "mysqlcppconn-static.lib".
Overall Conclusion at this time:
Quite hard to build, without experience you will spend some time...
time.
No proper documentation, their existing documentation is poorly
written and very confusing.
No UNICODE support, yes the projects compile as Multi-Byte
Character Set.
I will see if I can debug and find out why am I getting exceptions in the library when using this (from their documentation):
sql::ConnectOptionsMap connection_properties;
connection_properties["hostName"] = "";
connection_properties["port"] = "";
connection_properties["userName"] = "";
connection_properties["password"] = "";
connection_properties["schema"] = "";
connection_properties["OPT_CONNECT_TIMEOUT"] = 10;
connection_properties["CLIENT_MULTI_STATEMENTS"] = (true);
connection_properties["OPT_CHARSET_NAME"] = "utf8";
connection_properties["OPT_SET_CHARSET_NAME"] = "utf8";
I hope you can build your library with this information, and hopefully in the future it will become more easier and clear.
Good Luck.

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.

Install mod_wsgi with Python 2.7 on Windows 64 bit

I'm trying to deploy my Django website, which is written using Python 2.7, on a windows 64 bit machine (Windows Server 2008 R2). I installed the pre-compiled version of Apache (Apache 2.4.16 x64) from https://www.apachehaus.com/cgi-bin/download.plx (due to lack of option provided by Apache Lounge***), and have checked that Python 2.7 runs on 64 bit and compiles with VC9. I wasn't able to find a pre-built binary for mod_wsgi (for Windows 64 bit and compiled with VC9), so I downloaded the source code for mod_wsgi from https://github.com/GrahamDumpleton/mod_wsgi/releases/tag/4.4.13 and followed the direction from https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst, changing the ap24py27-win64-VC9.mk file to point at the right directories for APACHE_ROOTDIR and PYTHON_ROOTDIR, and using C++ 2008 64-bit Command Prompt to run the command nmake -f ap24py27-win64-VC9.mk clean. However, this gave me the error:
wsgi_memory.obj : error LNK2019: unresolved external symbol GetProcessMemoryInfo referenced
in function getPeakRSS
mod_wsgi.so : fatal error LINK1120: 1 unresolved externals
NMAKE : fatal error U1077: `"...\Visual C++ for Python\9.0\VC\Bin\amd64\c1.EXE"` :
return code `0x2`
Stop.
I have read the installation and configuration documents for mod_wsgi multiple times and have searched the web including SO for the past few hours to no avail. What am I doing wrong here and how could I fix it?
***I know the official document for installing mod_wsgi warns against using binaries from other sources than Apache Lounge but I don't seem to be able to find the right compiled version (for VC9 and Windows 64 bit) from the site. Could this be a problem and if so, how could I fix it?
Update: following Adelin's suggestion, I was able to get namke -f ap24py27-win64-VC9.mk clean to run. However, when I try running namke -f ap24py27-win64-VC9.mk or namke -f ap24py27-win64-VC9.mk install, I get pages of warnings that say: warning C4820: '...' : '...' bytes padding added after data member '...' until the compiler quits with
fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
...\mod_wsgi-4.4.13\src\server\wsgi_memory.c<124> : warning C4711: function 'getCurrentRSS' selected for automatic inline expansion
NMAKE: fatal error U1077: '"C:\...\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\c1.EXE"' : return code '0x2'
Stop.
Does anyone have any idea why this might be and how I should go about fixing it?
I had this same error.
The problem is that the cl.exe doesn't find the psapi.lib. This lib includes the function referenced in wsgi_memory.c - GetProcessMemoryInfo.
To fix this, you should follow these steps:
Locate psapi.lib (run a search on C:\)
Open the ap24py27-win64-VC9.mk file you are using to compile, with
any text editor
See what other .mk file it includes. Most probably common-VC9.mk
Open that file (common-VC9.mk) with any text editor
Under LDFLAGS, append yet another line of /LIBPATH:"PATH_FOUND_AT_STEP_1"\
Save changes and retry
What a pain in the ass this was for me too :)
P.S. If you don't find psapi.lib anywhere, it's because you don't have the Windows SDK. I installed both Windows 7 and Windows 8 SDKs and eventually had the psapi.lib located here C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64
Edit:
To give you a solution for your newest errors in a somewhat general way, whenever nmake throws "No such file" errors, the location for the file is not properly referenced in common-VC9.mk file.
There are two types of files nmake will look for: .h or .lib.
If a .h is not found, the corresponding path should be properly referenced under the CPPFLAGS variable of common-VC9.mk file.
If a .lib is not found, you need to update LDFLAGS path accordingly.
How? The same way you included the path for psapi.lib: locate the file and append the corresponding path to the proper variable: CPPFLAGS or LDFLAGS.

Compiling source Qt 4.7.4 on windows 7 error qmake is not an internal or external command

Edit 2 -
I don't have the application file qmake in the /bin folder and this is the error I am getting.
Path environment variable : C:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-src-4.7.4\bin\
Command Prompt - visual studio 2005
Source folder - C:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-src-4.7.4
Steps -
Downloaded src
Extracted the files to folder – qt-everywhere-opensource-src-4.7.4(C:\development\referencebuilds\qt\4.7.4)
configure.exe -opensource -fast -no-accessibility -no-qt3support -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-webkit -no-scripttools -platform win32-msvc2005 -D “_BIND_TO_CURRENT_VCLIBS_VERSION=1”
4.nmake
The error I get is
Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
C:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-src-4.7
.4\bin\qmake C:/development/referencebuilds/qt/4.7.4/qt-everywhere-opensource-sr
c-4.7.4/\projects.pro -o Makefile -spec win32-msvc2005
'C:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-src-4.7.4\bin\
qmake' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'C:\development\referencebuilds\qt\4.7.4\qt-everywher
e-opensource-src-4.7.4\bin\qmake' : return code '0x1'
Stop.
I know I dont have the app files for qmake and many other appfiles in my \bin folder. How do I get them?
Edit 1
Well, after trying out all the answers, the situation still remains the same. I think i should add more details to what I am doing.
I am copying bin files(.dll , Appplication, Application Extension, Incremental Linker File, Program Debug Database, ) from another machine and the version of Qt was 4.7.2
My questions are -
1. Do you see that as the cause for all the issues here? If yes, how do I get all the above files? If I just congigure as above and then run nmake I get
Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
C:\development\referencebuilds\qt\4.7.4\bin\qmake
C:/development/referen cebuilds/qt/4.7.4/\projects.pro -o Makefile
-spec win32-msvc2008
'C:\development\referencebuilds\qt\4.7.4\bin\qmake' is not recognized
as an inte rnal or external command, operable program or batch file.
NMAKE : fatal error U1077:
'C:\development\referencebuilds\qt\4.7.4\bin\qmake' : return code
'0x1' Stop.
1, Downloaded the source file named
qt-everywhere-opensource-4.7.4 and saved it in folder c:\development\referencebuilds\qt\4.7.4\
2, uncompressed the zip file and the files extracted into folder
c:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-4.7.4
3, Copied back all files from the folder
c:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-4.7.4 to c:\development\referencebuilds\qt\4.7.4\
4, ran
configure.exe -opensource -fast -no-acce ssibility -no-qt3support
-no-multimedia -no-audio-backend -no-phonon -no-phonon- backend
-no-webkit -no-scripttools -platform win32-msvc2008 -D
"_BIND_TO_CURRENT
_VCLIBS_VERSION=1"
5, nmake and now I get the following errors.
C:\development\referencebuilds\qt\4.7.4\bin\qmake
C:/development/referen cebuilds/qt/4.7.4/\projects.pro -o Makefile
-spec win32-msvc2008 Could not find mkspecs for your
QMAKESPEC(win32-msvc2008) after trying:
C:\Qt\4.7.2\mkspecs Error processing project file:
C:/development/referencebuilds/qt/4.7.4//projects .pro NMAKE : fatal
error U1077: 'C:\development\referencebuilds\qt\4.7.4\bin\qmake.EX E'
: return code '0x3' Stop.
I have no clue as to why it is refering to C:\Qt\4.7.2\mkspecs . How do I get over this error? what is exactly happening. How do I prevent such issues in future?
Your install directory is:
c:\development\referencebuilds\qt\4.7.4\qt-everywhere-opensource-4.7.4
Let's call it $(QTDIR). Now:
Extend your PATH variable to include $(QTDIR)\bin
Specify the QMAKESPEC environment variable to be win32-msvc2005
Open a Visual Studio command prompt to get the Visual Studio environment variables
Run configure
Run nmake
This procedure usually gets the Qt build to work for me.
Make sure that you don't have any existing QT directories in your path before you call configure and nmake.
It looks like you have a previous version of Qt installed. "C:\Qt\4.7.2\". And it would seem you have it setup in your system variables. Look for a variable called QTDIR in your system environment variables. Which is why you are getting an error, basically your 4.7.2 Qt is trying to build the new version.
Two options:
Un-install your old Qt via add/remove software in the control panel.
or
Remove your QTDIR system variable for the time being (will require a re-login) so that when you try to build from source it will use the correct binaries from the source folder.
Then just follow this guide:
http://en.wikibooks.org/wiki/Opticks_Developer_Guide/Getting_Started/Building_Qt_From_Source