Problem in compiling Z3 for Java in Windows 8 64bit

Feb 5, 2014 at 10:04 AM
Hi,

I have been trying to compile Z3 for Java following the instruction in http://leodemoura.github.io/blog/2012/12/10/z3-for-java.html

I used nmake tool of VS 2013 ultimate to build Z3 but it was fail with the message:

fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

I am using Windows 8 64bit. I have tried both Python for Windows x64 and x86, Visual Studio Command Prompt x64 and x86, but the problem can not be solved! Could you please help me to do that?

Thank you very much!
Coordinator
Feb 5, 2014 at 10:23 AM
This error message means that some of the object files were compiled for x86 and some others were compiled for x64. If you'd like to build a binary for x64, then on Windows you need to use the x64 command prompt, which configures the compiler to emit code for x64 by default. Note that all the tools should be x64, and this includes python and java. The best way to proceed is to remove your `build' directory and start from python scripts/mk_make.py --java using a 64-bit python version and a 64-bit java distribution.
Feb 5, 2014 at 1:31 PM
I have done every thing you tell me but the problem still exists. I used Python 2.7.6 Windows X86-64, Java 1.7.0.40 64bit, Microsoft Visual Studio 2013 Ultimate 32bit (my university just supplied 32bit edition for all version of Visual Studio). I also tried all versions of VS2013 Tools Command Prompt: x64 Native, x64 Cross, x86 Native, but it did not make sense.

Here is the end of the message after running python:
.....
Generated 'z3poly.pyc'
Generated 'z3printer.pyc'
Generated 'z3test.pyc'
Generated 'z3types.pyc'
64-bit: True
Java Home: C:\Program Files\Java\jdk1.7.0_40
Java Compiler: javac
Java VM: java
Writing build\Makefile
Copied Z3Py example 'example.py' to 'build'
Makefile was successfully generated.
compilation mode: Release
platform: x86
To build Z3, open a [Visual Studio Command Prompt], then
type 'cd C:\Implementation\GIT\z3\build && nmake'

Remark: to open a Visual Studio Command Prompt, go to: "Start > All Programs > V
isual Studio > Visual Studio Tools"

I also took a look into Makefile in build folder and found out that there is "x86" in line 2639.
csc /out:dotnet_example$(EXE_EXT) /reference:Microsoft.Z3.dll /debug:full /reference:System.Numerics.dll /platform:x86 ..\examples\dotnet\Program.cs
I tried replacing it by "x64", but nothing changed.

Could you please help me?
Thank you very much!
Feb 6, 2014 at 10:33 AM
Hi,

I had a similar issue. I think you can modify the Python scripts so that it only produces
64 makefile (there was a flag for 64 bit at the beginning of mk_util.py) and rebuild everything.
However, the easiest way seems to download the 64 binaries from codeplex and link the
com.microsoft.z3.jar in the build path. Then set the environment variable PATH to the location
of DLLs. In my case I had to restart Eclipse but may not be necessary.

Hope that helps...
Feb 6, 2014 at 12:22 PM
fturkmen wrote:
Hi,

I had a similar issue. I think you can modify the Python scripts so that it only produces
64 makefile (there was a flag for 64 bit at the beginning of mk_util.py) and rebuild everything.
However, the easiest way seems to download the 64 binaries from codeplex and link the
com.microsoft.z3.jar in the build path. Then set the environment variable PATH to the location
of DLLs. In my case I had to restart Eclipse but may not be necessary.

Hope that helps...
I changed mk_util.py and now the problem has been solved!
Thank you very much!