- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试构建一个需要 camlp4 扩展(在本例中为 pa_deriving)的 ocaml 项目。这是我的 Makefile:
include ./Makefile.config
OCAMLC := ${OCAMLFIND} ocamlc
OCAMLOPT := ${OCAMLFIND} ocamlopt
OCAMLDEP := ${OCAMLFIND} ocamldep
PP := -package camlp4 -ppopt /home/p/godi-3.12.1.0/lib/ocaml/site-lib/deriving-ocsigen/pa_deriving.cma -syntax camlp4o
LIBS := -I /home/p/godi-3.12.1.0/lib/ocaml/site-lib/deriving-ocsigen -package unix -package oUnit
OCAMLFLAGS = -w Aef
SOURCES = logic.ml \
fsm.ml \
test_logic.ml
test_logic: ${SOURCES:.ml=.cmo}
${OCAMLC} -o $@ ${LIBS} -linkpkg deriving.cma $^
# Common rules
%.cmi: %.mli
${OCAMLC} ${OCAMLFLAGS} ${PP} ${LIBS} -c $<
%.cmo: %.ml
${OCAMLC} ${OCAMLFLAGS} ${PP} ${LIBS} -c $<
%.cmx: %.ml
${OCAMLOPT} ${OCAMLFLAGS} ${PP} ${LIBS} -c $<
# Clean up
clean:
-rm -f *.cm[ioax] *.cmxa *.cmxs *${OBJEXT} *${LIBEXT} *.annot
-rm -f tests${EXEEXT}
distclean: clean
-rm -f *~ \#* .\#*
# Dependencies
depend:
${OCAMLDEP} ${PP} *.ml *.mli > .depend
-include .depend
这个 Makefile 有效;它完成了工作,但问题是我上面有硬编码路径,例如:/home/p/godi-3.12.1.0/lib/ocaml/site-lib/deriving-ocsigen/pa_deriving.cma 指的是我的 OCaml 安装。我想摆脱这些,以便我可以分发代码和 Makefile,这样任何人都可以使用它进行构建。
我应该为此使用 omake 还是 ocamlbuild?我想使用 omake 并且我已经为此使用了 OMakefile,但无法使任何工作正常进行 - 任何建议将不胜感激。
更新:我尝试将 ocamlbuild 与以下 _tags 文件一起使用:
<*.ml>: package(unix), package(oUnit), package(deriving-ocsigen.syntax), syntax(camlp4o)
使用以下 ocamlbuild 命令: ocamlbuild -use-ocamlfind test_logic.native -经典显示
然后我得到:
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamldep -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -modules fsm.ml > fsm.ml.depends
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamldep -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -modules logic.ml > logic.ml.depends
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlc -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o logic.cmo logic.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlc -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o fsm.cmo fsm.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o logic.cmx logic.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o fsm.cmx fsm.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -linkpkg -linkpkg logic.cmx fsm.cmx test_logic.cmx -o test_logic.native
+ /home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -linkpkg -linkpkg logic.cmx fsm.cmx test_logic.cmx -o test_logic.native
File "_none_", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Deriving_Show referenced from test_logic.cmx
Deriving_Enum referenced from test_logic.cmx
OUnit referenced from test_logic.cmx
我需要在 _tags 文件中添加什么来纠正这个问题?
最佳答案
我看到您使用 ocamlbuild
解决了您的解决方案,它是美好的。在一般情况下,您可以使用 ocamlfind 查询
scripts/Makefile作为查询信息的命令行界面关于 findlib 包,特别是避免硬编码路径。
$ ocamlfind query deriving-ocsigen
/usr/lib/ocaml/deriving-ocsigen
$ ocamlfind query deriving-ocsigen -i-format
-I /usr/lib/ocaml/deriving-ocsigen
$ ocamlfind query deriving-ocsigen -predicates byte -a-format
deriving_num.cma
$ ocamlfind query deriving-ocsigen.syntax -predicates syntax,preprocessor -a-format
pa_deriving.cma
$ ocamlfind query deriving-ocsigen.syntax -predicates syntax,preprocessor -format "-I %d %a"
-I /usr/lib/ocaml/deriving-ocsigen pa_deriving.cma
关于makefile - 我的 Makefile 中有硬编码路径 - 如何使用 ocamlfind 消除这些路径? (或如何改用 ocamlbuild 或 omake),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8696016/
我对 ocaml 几乎一无所知,但我想安装 Coccinelle (在 cygwin 上),它依赖于二进制文件 ocamlfind . 但是,安装 ocaml-3.11.0-win-mgw.exe 或
我已经安装了core使用 opam ,将 opam 配置添加到 bash 环境中, 但我无法使用核心模块编译程序(模块已安装): $ opam install core [NOTE] Package
我在安装依赖于 ocamlfind 的软件包时遇到问题,但我在制作时遇到了 ocamlfind: command not found 错误。 我已经使用 ocaml 包管理器安装了 ocamlfind
我有一个名为 ojasmine 的本地固定 OPAM 项目,我想将其编译为一个库,供另一个名为 test_tournabox 的项目使用(最终编译为 javascript)。但是,test_tourn
我试图保持我的项目自包含,在项目存储库中构建和引用所有主要的 3rd 方库依赖项。我项目的主要 ocaml 部分依赖于 ocamlbuild。 但是对于像 Batteries Included 这样的
我正在使用 ocamlbuild 通过 mylib.mllib 文件编译 OCaml 库,该文件列出了构成库的模块。之后我想使用 ocamlfind 安装库文件。与使用 ocamlbuild 构建的二
我正在尝试从 Ubuntu 17.04 (Zesty) 上的存储库 (6aa64) 安装 Frama-C gui Phosphorus。 Frama-C opam 工作正常,但据我所知,它缺少 GUI
我正在尝试将 ocamlfind 与 OCaml 编译器和顶层一起使用。据我了解,我需要将所需的库放在项目根目录的 _tags 文件中,以便 ocamlfind 工具负责加载它们 - 允许我在模块中打
刚买了一台新 Mac,Mountain Lion 和我希望设置所有与 ocaml 相关的东西。 我使用了以下命令: opam switch 4.00.1 opam install findlib op
配置:m4 不在 PATH 中;这是必需的 我想知道如何解决这个问题。 非常感谢! (我试图将 m4 文件夹复制到该路径,但它不起作用) ==== ERROR [while installing oc
我按照说明操作 here用于设置使用 ocamlfind install 在 site-lib 中安装库。我有两个库:一个叫做 logic ,另一个叫做 boolean。在每种情况下,我都在库中安装了
我正在尝试构建一个需要 camlp4 扩展(在本例中为 pa_deriving)的 ocaml 项目。这是我的 Makefile: include ./Makefile.config OCAMLC
我是一名优秀的程序员,十分优秀!