I'm interested in playing around with the MaxSAT/MaxSMT c example (specifically, maxsat.c) provided on the z3 (Microsoft Research) website. Using Visual Studio 2010, I eventually got the example to compile (using a fresh install of z3 4.0). However, I can't get any of my (SMT 2.0) models to run using them. Further, I cannot get the example posted in this question to work either.
In the first case, my compiled program crashes when it tries to call Z3_get_smtlib_num_formulas in get_hard_constraints of the file. I don't know why, instead, I get the standard windows 7 "this program has stopped working" popup.
In the second case, it reports unsupported ;benchmark.
In order to help me to get this work, I was wondering if
(a) Has anyone had similar issues when compiling this code, and if so, how did you resolve them?
or
(b) How can I debug either compilation of the file (assuming it is correct)? Namely, can someone enumerate the correct libraries (and library versions - e.g., z3 4.0?) to include in the compiler options to get this example working?
In either case, information on the error reported in the second case would also be appreciated: what does it mean exactly? The keyword was not valid? That the SMT input is the wrong version? Or something else?
Thanks.
The MaxSAT example has not been updated to SMTLIB 2.0 yet. It uses the function Z3_parse_smtlib_file to parse the input, which means that it supports only SMTLIB 1.0 at the moment.
This example is distributed alongside Z3, i.e., you should have received a copy in Z3-4.0/examples/maxsat/, which also contains compilation and execution scripts.
Compilation should be straight-forward by running build.cmd in a Visual Studio Command Prompt, or build.sh on Linux.
Related
I am trying to use the Dafny-to-Python compiler that is suggested in Dafny's reference (25.7.7): http://dafny.org/dafny/DafnyRef/DafnyRef.html#2577-python
However, I cannot run the first step for it in the terminal: dafny build --target:py A.dfy, since I get the error: Dafny: Error: unknown switch: --target. I use Use /help for available options as they suggest, but have no idea on how to solve.
Just in case, I also attempted using the old version of the command (see 25.8.11. in the same reference): dafny Hello.dfy -compileTarget:py but then got message Dafny: Error: Invalid argument "py" to option compileTarget.
Any idea? Note that the authors themselves clearly state that The Dafny-to-Python compiler is still under development.
PS: I usually use Dafny in Visual Studio and not in the terminal, so maybe I lack some kind of library or something.
Neither the new CLI nor the Python compiler are supported by the very outdated version of Dafny you are using. You are presumably not using the correct VS Code extension, so I would start there. As of today, this should install 3.10.0 at /Users/$USER/.vscode/extensions/dafny-lang.ide-vscode-3.0.3/out/resources/3.10.0/github/dafny/Dafny.dll. To see how to use the dll, try hitting F5 with a Dafny file opened in VS Code. The Python compiler is complete and passes all tests these days.
Is it technically possible (I don't think this would be restricted), and how do you go about it?
I got my little test app building fine, but when I run it I get a failure dialog.
The debug output is slightly more informative:
The thread 0xe4c has exited with code -1073741515 (0xc0000135).
The program '[3400] OpenCVTest2.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.
Then I created a Win8 Desktop app, which also built fine but failed to run.
MSVP100D.dll is part of the VC++ 2010 Redistributable which is not compatible with Win8. (Being a hacker I tried it anyway, the installer runs to completion - but the bits aren't installed.)
Is there a compiler flag I can try? Possibly a custom build of OpenCV would fix it, but that would be a last resort, and it might only fix the desktop app.
This guy shows an example of using OpenCV library for performing face detection in a Windows 8 Store app written using C++/CX:
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/DEV322
Also, at the below post he also describes how the C++ Runtime works for Windows 8Store apps:
http://blogs.msdn.com/b/vcblog/archive/2012/09/28/10354327.aspx
MSVP100D is not a part of VC10 redist. Note the "D" at the end of its name. That package only includes release builds. Your release builds should work fine. But mixing libraries from different VC versions might get you in trouble. See this. Your best chance is to build from source with VC11.
Hello I downloaded Z3 from http://z3.codeplex.com/ and then opened the Z3 solution in Visual Studio 2012. (While I'm not totally new to VS I haven't used it in over 10 years). There are 9 projects in this solution but I am having a hard time telling which I ought to be using. I can guess at some of them, but others aren't very clear. Eg. what is the difference between Microsoft.Z3 and Microsoft.Z3V3 ? Can anyone briefly explain what the different projects are and which ones to build?
Anyway just for kicks I tried building the top level solution but got the following errors
Error 1 error RC1015: cannot open include file 'afxres.h'. C:\Projects\z3-src-4.1.2\z3\dll\dll.rc 10 1 dll
Error 2 (same as Error 1 except in shell.rc)
Error 3 error LNK1104: cannot open file 'C:\Projects\z3-src-4.1.2\z3\Debug\z3_dbg.lib' C:\Projects\z3-src-4.1.2\z3\test_capi\LINK test_capi
Trying to build just the MS.Z3 project still gives me Error 1.
My eventual goal is to invoke Z3 from say an F# program. Can someone provide some guidance for how to do this?
Any help would be appreciated.
EDIT
This answer reflects the directory structure used in Z3 version <= 4.1.1. In version 4.3, the code base has been reorganized/simplified.
END EDIT
Which version of Visual Studio are you using? I'm asking because I want to reproduce the behavior you described.
The easiest way to build Z3 is described here.
You should use the Visual Studio Command Prompt, and execute msbuild. It seems you tried that, and got errors. Here is a short description of each project folder:
lib: the Z3 source code is here. This is the important folder. For visual studio users, it generated a static library.
dll: project for wrapping the static library as a Windows DLL. This is irrelevant for users in other platforms.
shell: uses the static library from lib to build z3.exe.
test: a bunch of unit tests. It produces test.exe.
Microsoft.Z3: .Net API. It is the official .Net API (C#, Visual Basic, F#, etc) for Z3. This is the API you should use with F#.
Microsoft.Z3V3: It is the old .NET API. It was the API available in Z3 3.x. We maintain it because some users still use it.
test_capi: Application that tests the Z3 C API.
maxsat: Small application that implements two maxsat algorithms on top of the Z3 API.
I'm trying a long-time to find algorithm PSOLA (Pitch Synchronous Overlap Add) or WSOLA (Waveform Similarity Overlap Add) which are Acoustic or Signal Processing Algorithms.
I found it in c++, but I have no experience in c++ and is difficult to pass it to Pascal. Anyone have this code in Pascal or know where to find it to copy?
Something like this example that is in c++
http://sourceforge.net/projects/mffmtimescale/files/v3%20stable/v3.9/WSOLA.v.3.9.zip/download?use_mirror=ufpr
Try the SoundTouch DLL, it comes with a Delphi import unit, so you can use the DLL directly. It should not be too hard to compile it. Just download the free VC++ Express from the MS download site and compile it with that or ask someone with VC++ to compile it for you.
FWIW, who knows, with a few modifications, it might also compile with C++Builder.
About one decade ago, I've used praat in FSeqEdit (Delphi program) to do these type of calculations, but I think the same approach would still work fine today.
I wrote some praat-scripts and execute them via praatcons.exe (console version of praat). You can download the console version from this page:
http://www.fon.hum.uva.nl/praat/download_win.html
That works pretty good.
I usually take this approach:
I manually check what type of conversions and calculations need to be done via the GUI version of praat. Once I find what I need, I create a script for it, and run that with the console version.
Praat is very powerful, so if you didn't know about it yet, make sure to check it out.
There's a page that shows how to work with PSOLA resynthesis here:
http://www.ling.ohio-state.edu/~kyoon/praat-tut/praat-tut2.html
Let me know if you want to see some example code on how to integrate it into your Delphi application (it's pretty straightforward actually).
I may have this completely wrong, but my understanding is that the --standalone compiler option tells the compiler to include the F# core and other dependencies in the exe, so that you can run it on another machine without installing any 'runtime'.
However, I can't get this to work in the CTP - it doesn't even seem to change the size of the output file (docs I've read say about 1M extra).
"Google may know, but if it does, it ain't telling, or I'm not looking in the right place"
UPDATE:
It seems to work with latest CTP update 1.9.6.2
UPDATE2:
I have since experienced another error:
FSC(0,0): error FS0191: could not resolve assembly Microsoft.Build.Utilities.
If you get errors like this when trying to compile --standalone, you need to explicitly include them as references in your project.
Answer from MS:
There is a CTP update 1.9.6.2 that fixed some --standalone bugs.
I'm reinstalling now...
UPDATE:
Works for me - so the my accepted answer is download CTP update 1.9.6.2.
F# manual: Statically linking the F# library using "--standalone"
Did you try to run peverify.exe utility?
This has been a pet hatred of mine for a long time (it has been broken in every CTP release ever including the latest 1.9.6.16 May 2009 release). The "solution" is essentially to write your own build system that is not broken.
This is a real problem for me because I have accumulated hundreds of great F# programs that I would like to put on our site but it takes hours to build each one into a standalone executable.