Z3 build error using Visual Studio compilers - visual-studio

I'm trying to build the Z3 theorem prover on Windows 7 64 Professional 64 bit using the Visual Studio 2010 compilers. I followed the README instructions up until I went into the "build" directory and hit nmake. After a while, I get the following:
cl /Fez3.exe /nologo /MD shell/datalog_frontend.obj shell/dimacs_frontend.obj shell/install_tactic.obj shell/main.obj shell/smtlib_frontend.ob
j shell/z3_log_frontend.obj api/api.lib parsers/smt/smtparser.lib tactic/portfolio/portfolio.lib tactic/ufbv/ufbv_tactic.lib tactic/smtlogics/smtlogic
_tactics.lib muz_qe/muz_qe.lib tactic/sls/sls_tactic.lib smt/tactic/smt_tactic.lib tactic/fpa/fpa.lib tactic/bv/bv_tactics.lib smt/user_plugin/user_pl
ugin.lib smt/smt.lib smt/proto_model/proto_model.lib ast/rewriter/bit_blaster/bit_blaster.lib ast/proof_checker/proof_checker.lib ast/macros/macros.li
b ast/pattern/pattern.lib parsers/smt2/smt2parser.lib cmd_context/extra_cmds/extra_cmds.lib cmd_context/cmd_context.lib solver/solver.lib tactic/aig/a
ig_tactic.lib math/subpaving/tactic/subpaving_tactic.lib nlsat/tactic/nlsat_tactic.lib tactic/arith/arith_tactics.lib sat/tactic/sat_tactic.lib tactic
/core/core_tactics.lib ast/normal_forms/normal_forms.lib ast/simplifier/simplifier.lib front_end_params/front_end_params.lib math/euclid/euclid.lib ma
th/grobner/grobner.lib parsers/util/parser_util.lib ast/substitution/substitution.lib tactic/tactic.lib model/model.lib ast/rewriter/rewriter.lib ast/
ast.lib math/subpaving/subpaving.lib math/interval/interval.lib nlsat/nlsat.lib sat/sat.lib math/polynomial/polynomial.lib util/util.lib /link /DEBUG
/MACHINE:X86 /SUBSYSTEM:CONSOLE /INCREMENTAL:NO /STACK:8388608 /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT
shell/datalog_frontend.obj : fatal error LNK1112: Modul-Computertyp "x64" steht in Konflikt mit dem Zielcomputertyp "X86".
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.EXE"": Rückgabe-Code "0x2"
Stop.
The error message is in German, unfortunately, but it roughly says the following: "module machine type 'x64' conflicts with target machine type 'X86'"
I got the code by git clone https://git01.codeplex.com/z3. Any hints on what to do?

This error typically happens if you try to build x64 binary from a x86 command line environment.
Do one of the following:
To build Z3 under 64 bits:
a) open a 64 bit Visual studio command line window.
The VS distribution comes with some pre-configured shortcuts
to command-line windows for either 32 or 64 bits.
b) configure a build environment for Z3 using a command of the form scripts\mk_make.py --x64 -b release_x64. This creates a directory release_x64 where you can build a 64 bit version of Z3.
c) cd release_x64 d) nmake
TO build Z3 under 32 bits:
a) open a 32 bit VS command line window.
b) configure a build environment using a command scripts\mk_make.py -b release_x86.
c) cd release_x86 d) nmake

I just had the same problem (my computer is 64bit) and what helped was the combination of a few things.
everything Nikolaj Bjorner said but additionally, running nmake as:
nmake CFG=release ARCH=x64

Related

/bin/sh: cl: command not found usig make within cygwin

I'm working with Intel Pin on a Windows 7 machine. As suggested on Pin user guide, I downloaded Cygwin with the packages I need, such as gcc, g++ and make, but when I try to execute the command "make" in order to build one tool (Insmix in this case, but it is the same with any other Pin tool) I get the following error:
make[1]: Entering directory '/cygdrive/c/Users/IEUser/Downloads/pin-3.2-81205-msvc-windows/source/tools/Insmix'
cl /MT /EHs- /EHa- /wd4530 /DTARGET_WINDOWS /DBIGARRAY_MULTIPLIER=1 /nologo /Gy /Oi- /GR- /GS- /D__PIN__=1 /DPIN_CRT=1 /D_WINDOWS_H_PATH_="" /D__i386__ /DTARGET_IA32 /DHOST_IA32 /I../../../source/include/pin /I../../../source/include/pin/gen -I../../../extras/stlport/include -I../../../extras -I../../../extras/libstdc++/include -I../../../extras/crt/include -I../../../extras/crt -I../../../extras/crt/include/arch-x86 -I../../../extras/crt/include/kernel/uapi -I../../../extras/crt/include/kernel/uapi/asm-x86 /FIinclude/msvc_compat.h /I../../../extras/components/include /I../../../extras/xed-ia32/include/xed /I../../../source/tools/InstLib /O2 /c /Foobj-ia32/insmix.obj insmix.cpp
**/bin/sh: cl: command not found**
make[1]: *** [../../../source/tools/Config/makefile.default.rules:192: obj-ia32/insmix.obj] Error 127
I tried to Google it with no success. Does anyone know how to fix this issue?
Thank you very much for you help
cl is prettymuch a Microsoft tool. Install some Visual Studio version, and you'll have that cl tool somewhere in the bin directory in C:\Program Files\Microsoft Visual Studio\...\bin\ Now you set that directory in the environment Path variable. Voila. That works.

make: cl: Command not found

I'm trying to install Google OR-Tools for Java in Visual Studio 2015. When I run make all in the OR-Tools directory, as required, I get
E:\My_files\VS\BC\or-tools_VisualStudio2015-64bit_v6.4.4495>make all
cl /EHsc /MD /nologo /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -nologo /O2 -DN
DEBUG -DUSE_CBC -DUSE_CLP /D__WIN32__ /Iinclude\\src\\windows
/DGFLAGS_DLL_DECL=
/DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /Iinclude /I. -
DUSE_GLOP -
DUSE_BOP -c examples\\cpp\\costas_array.cc /Foobjs\\costas_array.obj
make: cl: Command not found
make: *** [objs\\costas_array.obj] Error 127
I read somewhere to run vcvarsall.bat to set variables, but there is no such file on this path
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
Plus I'm supposed to run it in Native Tools Command Prompt, but I cannot find this for VS2015, only for VS2017, so I run it in Developer Command Prompt. Might this be the issue?
Apparently, I did not add C++ tools when installing Visual Studio.
File -> New -> Project -> Visual C++ and there's the install option. Maybe it will help someone.

Missing standard C libraries in cl

I have a Windows project that came with a Makefile.vc. I would like to import this into Visual Studio 10.0. My initial effort is to run nmake and invoke the cl.exe compiler.
After getting some paths straights my first run generates this message:
cl /nologo /W3 /O1 -I..\./ -I..\charset/ -I..\windows/ -I..\unix/ -I..\macosx/ /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500 /DHAS_GSSAPI /DSECURITY
_WIN32 /c ..\be_all_s.c
be_all_s.c
..\be_all_s.c(6) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.EXE"' : return code '0x2'
Stop.
Now I know where the VC stdio.h header is, on my PC it's at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include. So it would be a simple matter to add a -I to the makefile and include this directory.
But durn burn it I don't think I should have to! Other build systems don't make me do this and why doesn't the command line compiler know where its standard headers are installed? So I'm asking if there's a config file, an .ini file or something else that cl reads that tells it where to look for the standard C library. I've been browsing the internet and Visual Studio help with no success.
Just after I posted the question I found the answer.
Start > All Programs > Microsoft Visual 10.0 > Microsoft Visual Studio Tools > Visual Studio Command Prompt
This gives me a command prompt with all the paths, env. variables etc. set.
Why didn't I find that earlier?

Set up x64 in Visual C++ 2010

I am trying to learn x64 assembly using Visual Studion 2010.
I was following this video tutorial : x64 Assembly and C++ Tutorial 1: Getting into x64 ASM from C++
As it says, I installed Visual Studio 2010, windows 7 SDK 3.5 (ISO install) and edited the configuration.
But when I compile the code, I get following error :
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml64.exe /c /nologo /Zi /Fo"x64\Debug\asm.obj" /W3 /errorReport:prompt /Taasm.asm" exited with code 1.
What is this problem, and how can I solve it?
Look at the assembler output above that line, or build the .asm file by itself.
You should see warnings generated by the assembler
eg. "somefile.asm(564): warning A6004: procedure argument or local not referenced :"
Deal with those warnings. The "exited with code 1" is not very explanatory.

Qt 4.8.3 Windows 7 Compile Using Visual Studio Express 2012

I'm still new to Qt. In the past I used to download Qt on a computer and install it without any problems and I get immediate access to all Qt SDK resources including QtCreator.
Now, I downloaded Qt SDK 4.8.3 and after some reading I ended up installing Windows SDK 7. Then I extracted Qt files to C:\Qt. I also added C:\Qt\4.8.3\ to the system path. Then I ran configure which is concluded with no errors. Then I attempted to run nmake which failed with the following error:
Generating Code...
link /LIBPATH:"c:\Qt\4.8.3\lib" /LIBPATH:"c:\Qt\4.8.3\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /BASE:0x67000000 /DEBUG /DLL /MANIFEST /MANIFESTFILE:"tmp\obj\debug_shared\QtCored.intermediate.manifest" /VERSION:4.83 /OUT:....\lib\QtCored4.dll #C:\Users\MELKAM~1\AppData\Local\Temp\nm5A03.tmp
Creating library ....\lib\QtCored4.lib and object ....\lib\QtCored4.exp
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\link.EXE"' : return code '0x463'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
Now I have tried the above twice with no luck. Any pointer where should I look? any suggestions are appreciated.
Thanks.
What are you compiling with? MSVC or mingw? If the former, I have found this link incredibly helpful...
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/
I have followed his instructions for 64bit and 32bit builds many times.
Edit: You have your qt build configured for a MSVC2010 (1600) build, so it's looking in the "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" directory, which doesn't exist if you only have MSVC2012 (which is version 11.0).
Qt 4.8 doesn't officially support MSVC2012 (yet?), but if you really want to use 2012 then you can try the suggestions at this link. It's complicated, especially if this is your first source build, but seems do-able if you're willing to tinker with the Qt source code.
I had the same issue. the problem was installing visual studio 2012 on a machine with visual studio 2010.
May be this can help https://stackoverflow.com/a/15132209/1933829
Did you run configure from the 64bit tools command tool in vs?
Did you add -platform win32-msvc2010 to the configure commandline (yes even for 64bit builds you need -win32- )

Resources