z3 ocaml 绑定不起作用(Windows 7)
我无法在 Windows 7 上使用 z3 ocaml 绑定。 这是我遵循的过程。
- 安装 Objective 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”
# #load "z3.cma";; 字符-1--1: #加载“z3.cma”;; 错误:外部函数“get_theory_callbacks”不可用 # Z3.mk_context;; 字符-1--1: Z3.mk_context;; 错误:外部函数“camlidl_z3_Z3_mk_context”不可用
有人能给我一些提示吗?
编辑1: 在“Z3-3.0\examples\ocaml”中构建示例:
摘自build.cmd
set XCFLAGS=/nologo /MT /DWIN32
ocamlopt -ccopt "%XCFLAGS%" -o test_mlapi.exe -I ..\..\ocaml ole32.lib %OCAMLLIB%\libcamlidl.lib z3.cmxa test_mlapi.ml
我在执行build.cmd时遇到以下错误在 Visual Studio 2008 命令提示符中
** Fatal error: Cannot find file "/nologo"
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
删除 -ccopt "%XCFLAGS%"
时,它工作正常。生成的exe也按预期执行。 (请注意,我的 PATH 中有 flexdll )。知道为什么会发生这种情况吗?
I am not getting the z3 ocaml binding working on windows 7.
Here is the process I followed.
- Installed Objective Caml version 3.11.0 (Microsoft toolchain)
- Installed camlidl-1.05 (built it using Microsoft Visual Studio 2008 + cygwin)
- Installed z3-3.0
- Built z3 ocaml binding by running "build.cmd".The build was successful.
- Copied the files generated by "build.cmd" from z3/ocaml to ObjectiveCaml/lib
Launched ocaml interactive and loaded "z3.cma"
# #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
Can someone please give me some hints?
EDIT 1:
Building the example in "Z3-3.0\examples\ocaml":
Excerpt from build.cmd
set XCFLAGS=/nologo /MT /DWIN32
ocamlopt -ccopt "%XCFLAGS%" -o test_mlapi.exe -I ..\..\ocaml ole32.lib %OCAMLLIB%\libcamlidl.lib z3.cmxa test_mlapi.ml
I got the following error on executing build.cmd in the Visual Studio 2008 Command Prompt
** Fatal error: Cannot find file "/nologo"
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
On removing the -ccopt "%XCFLAGS%"
, it works fine. The generated exe also executes as expected. ( Note that I have flexdll in PATH ). Any idea why this might be happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
OCaml 版本 3.11 及更高版本通过 flexdll 调用链接器,它不需要或不知道“/nologo /MT /DWIN32”标志。 ocaml\build.cmd 脚本测试 ocaml 版本并适当设置 XCFLAGS。我想应该更改 example\ocaml\build.cmd 来执行相同的操作。
如果我通过从 Z3 ocaml 绑定目录执行“ocamlmktop -o ocamlz3 z3.cma”创建自定义顶层,那么从顶层使用 Z3 对我有用。
OCaml version 3.11 and later call the linker through flexdll, which does not need or know about the "/nologo /MT /DWIN32" flags. The ocaml\build.cmd script tests the ocaml version and sets XCFLAGS appropriately. I guess that examples\ocaml\build.cmd should be changed to do the same.
Using Z3 from the toplevel works for me if I create a custom toplevel by executing 'ocamlmktop -o ocamlz3 z3.cma' from Z3 ocaml bindings directory.
以下是对我有用的方法(Windows 7):
BINLIB
和OCAMLLIB
变量Makefile
make all
make install
C:\Program Files\flexdll\
和C:\Program Files\Microsoft Research\Z3-\bin\
添加到 Path 变量C:\Program Files\Microsoft Research\Z3-\ocaml
build.cmd
%CD%
变量build.cmd
z3/ocaml
复制到%OCAMLLIB%
尝试
simple_example();;
最后一步应从 Z3 产生有效输出。
对于 Debian/Ubuntu:
1.
sudo apt-get install camlidl
git clone git://github.com/polazarus/z3-installer.git
(来自 Mickaël Delahaye)cd z3-installer
make
# 下载 Z3 并构建 Ocaml 库(本机和字节)sudo make install
# 安装 Z3 二进制文件、DLL 和 Ocaml 库sudo cp z3/lib/libz3.so /usr/lib/
cd z3/ocaml
ocamlmktop -o ocamlz3 z3.cma
/ocamlz3
Here is what worked for me (Windows 7):
config/Makefile.win32
toconfig/Makefile
config/Makefile
with an editor
BINLIB
andOCAMLLIB
variables
Makefile
make all
from CamlIDL root directory
make install
C:\Program Files\flexdll\
andC:\Program Files\Microsoft Research\Z3-<version-number>\bin\
to the Path variable
C:\Program Files\Microsoft Research\Z3-<version-number>\ocaml
build.cmd
with an editor
%CD%
variable from the last two commands
build.cmd
build.cmd
z3/ocaml
to%OCAMLLIB%
ocamlmktop -o ocamlz3 z3.cma %OCAMLLIB%\libcamlidl.lib ole32.lib
ocamlz3.exe
#use "../examples/ocaml/test_mlapi.ml";;
Try
simple_example();;
The last step should produce a valid output from Z3.
For Debian/Ubuntu:
1.
sudo apt-get install camlidl
git clone git://github.com/polazarus/z3-installer.git
(from Mickaël Delahaye)cd z3-installer
make
# download Z3 AND build the Ocaml library (native and byte)sudo make install
# install Z3 binary, DLL and the Ocaml librarysudo cp z3/lib/libz3.so /usr/lib/
cd z3/ocaml
ocamlmktop -o ocamlz3 z3.cma
/ocamlz3