Binding z3 ocaml绑定不工作(windows 7)
我无法在Windows7上使用Z3OCAML绑定。 以下是我遵循的过程Binding z3 ocaml绑定不工作(windows 7),binding,windows-7,ocaml,z3,Binding,Windows 7,Ocaml,Z3,我无法在Windows7上使用Z3OCAML绑定。 以下是我遵循的过程 已安装的目标Caml版本3.11.0(Microsoft工具链) 已安装camlidl-1.05(使用Microsoft Visual Studio 2008+cygwin构建) 已安装的z3-3.0 通过运行“build.cmd”构建了z3 ocaml绑定。构建成功 将“build.cmd”生成的文件从z3/ocaml复制到ObjectiveCaml/lib 启动ocaml交互式并加载“z3.cma” 有人能给我一些提示
在删除
-ccopt“%XCFLAGS%”
时,它可以正常工作。生成的exe也按预期执行。(请注意,路径中有flexdll)。知道为什么会发生这种情况吗?OCaml 3.11版及更高版本通过flexdll调用链接器,flexdll不需要或不知道“/nologo/MT/DWIN32”标志。ocaml\build.cmd脚本测试ocaml版本并适当设置XCML标志。我想examples\ocaml\build.cmd也应该做同样的更改
如果我通过从Z3 ocaml绑定目录执行“ocamlmktop-o ocamlz3 Z3.cma”来创建自定义的顶级,那么从顶级使用Z3对我来说是可行的。ocaml版本3.11和更高版本通过flexdll调用链接器,flexdll不需要或不知道“/nologo/MT/DWIN32”标志。ocaml\build.cmd脚本测试ocaml版本并适当设置XCML标志。我想examples\ocaml\build.cmd也应该做同样的更改
如果我通过从Z3 ocaml绑定目录执行“ocamlmktop-o ocamlz3 Z3.cma”来创建自定义的toplevel,那么从toplevel使用Z3对我有效。以下是对我有效的方法(Windows 7):
config/Makefile.win32
重命名为config/Makefile
李>
config/Makefile
李>
BINLIB
和ocamlib
变量
李>
Makefile
李>
make all
李>
makeinstall
李>
C:\Program Files\flexdll\
和C:\Program Files\Microsoft Research\Z3-\bin\
添加到Path变量中
李>
C:\Program Files\Microsoft Research\Z3-\ocaml
李>
build.cmd
李>
%CD%
变量
李>
build.cmd
李>
build.cmd
李>
z3/ocaml
复制到%ocamlib%
李>
ocamlmktop-o ocamlz3 z3.cma%OCAMLLIB%\libcamlidl.lib ole32.lib
李>
ocamlz3.exe
李>
#使用“./examples/ocaml/test#mlapi.ml”代码>
李>
试试simple_example();;代码>
最后一步应该从Z3生成一个有效的输出
对于Debian/Ubuntu:
安装OCAML3.09+
1. <代码>sudo apt get安装camlidl代码>
git克隆git://github.com/polazarus/z3-installer.git
(摘自米卡·德拉哈耶)
cd z3安装程序
make
#下载Z3并构建Ocaml库(本机和字节)
sudo make安装
#安装Z3二进制文件、DLL和Ocaml库
sudo cp z3/lib/libz3.so/usr/lib/
cd z3/ocaml
ocamlmktop-o ocamlz3 z3.cma
./ocamlz3
请尝试以下代码段:
让simple_example()=
开始
Printf.Printf“\n示例\n”代码>
让ctx=Z3.mk_context_x(Array.append[|(“MODEL”,“true”)|][| |]在
Printf.Printf“上下文:\n%sEND OF CONTEXT\n”(Z3.CONTEXT\u to\u string ctx)代码>
Z3.delu context ctx代码>
结束代码>
simple_example();;代码>
以下是对我有效的方法(Windows 7):
下载并安装Ocaml 3.08+
李>
下载安装VisualStudioC++
李>
下载并解压缩CamlIDL
李>
下载并安装cygwin,安装时在“选择软件包”窗口中选择make软件包以及您最喜欢的linux编辑器软件包。
李>
开放式cygwin
李>
在cygwin中,转到CamlIDL根目录
李>
将config/Makefile.win32
重命名为config/Makefile
李>
用编辑器打开config/Makefile
李>
编辑BINLIB
和ocamlib
变量
李>
保存并退出Makefile
李>
设置
# #load "z3.cma";;
Characters -1--1:
#load "z3.cma";;
Error: The external function `get_theory_callbacks' is not available
# Z3.mk_context;;
Characters -1--1:
Z3.mk_context;;
Error: The external function `camlidl_z3_Z3_mk_context' is not available
set XCFLAGS=/nologo /MT /DWIN32
ocamlopt -ccopt "%XCFLAGS%" -o test_mlapi.exe -I ..\..\ocaml ole32.lib %OCAMLLIB%\libcamlidl.lib z3.cmxa test_mlapi.ml
** Fatal error: Cannot find file "/nologo"
File "caml_startup", line 1, characters 0-1:
Error: Error during linking