ocamlbuild

OCaml warning 31, compiler-libs, and ppx

纵然是瞬间 提交于 2020-01-13 19:47:31
问题 I'm porting my application from OCaml 4.02.3 to 4.03.0. Say you have the following in lexer.ml : type t = T [@@deriving sexp] let () = sexp_of_t |> ignore; print_endline "hai" I'm trying to run it as following: ocamlbuild -use-ocamlfind -pkg ppx_sexp_conv -cflags '-w @a-4-31' lexer.byte -- But I'm getting the following error: Warning 31: files lexer.cmo and /Users/vladimir/.opam/4.03.0+flambda/lib/ocaml/compiler-libs/ocamlcommon.cma(Lexer) both define a module named Lexer File "_none_", line

LLVM tutorial OCaml Compilation Assembler Error

断了今生、忘了曾经 提交于 2019-12-25 07:22:04
问题 I have been working through the LLVM Kaleidoscope Tutorial for OCaml. On the third part of the tutorial, I have navigated to the example code in the folder OCaml-Kaleidoscope\Chapter3 I am encountering an issue when compiling with ocamlbuild toy.byte on cygwin. This is the code given in the tutorial to compile. The error I am getting is mkdir 'C:\Users\setup\Compiler\llvm\examples\OCaml-Kaleidoscope\Chapter3\_build' ''ocamlopt.opt unix.cmxa -I 'C:\OCaml\lib\ocamlbuild' 'C:\OCaml\lib

OCamlbuild fails to compile complaining implementation of Netsys is not provided when it is

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 13:02:40
问题 I'm trying to compile an XML-RPC server written using the xmlrpc-light library in OCaml with ocamlbuild but I get: $ ocamlbuild server.native Finished, 0 targets (0 cached) in 00:00:00. + ocamlfind ocamlopt -linkpkg -package xmlrpc-light -package unix -package threads -package netsys -thread server.cmx -o server.native File "_none_", line 1, characters 0-1: Error: No implementations provided for the following modules: Netsys referenced from /usr/lib/ocaml/equeue/equeue.cmxa(Uq_engines)

How to traverse typed abstract syntax tree in OCaml compiler

本小妞迷上赌 提交于 2019-12-23 12:33:07
问题 I'm trying to dump type information of all identifiers in an OCaml project, basically it's the same as traversing the typed abstract syntax tree(https://github.com/ocaml/ocaml/blob/trunk/typing/typedtree.mli). Since I'm new to OCaml compiler's codebase, I'm not sure whether the Compiler has provided apis so we could easily write a plugin to do the job or we have to hack the compiler code? Also how does this interact with OCamlbuild? Thanks for any hints or advices. 回答1: Assuming you have

Properly compiling modules in subfolders (ocamlbuild)

[亡魂溺海] 提交于 2019-12-21 03:54:06
问题 I recently decided to organize the files in my project directory. I moved the parsers I had for a few different file types into their own directory and also decided to use ocamlbuild (the as the project was getting more complicated and the simple shell script was not sufficient any longer). I was able to successfully include external projects by modifying myocamlbuild with some basic rules (calling ocaml_lib , I'll use ocamlfind some other time), but I am stuck on how to include the folder as

How to configure _oasis for OCaml to set 'Profile' flag

笑着哭i 提交于 2019-12-12 11:26:38
问题 I have an existing project in OCaml and one _oasis file. I don't know where to enable the profiling flag for ocamlbuild . I looked up Oasis manual and the code, and found there was a variable profile available in setup.data. I assume this was what Oasis auto generated. Where and what should I include in _oasis to set profile to true ? 回答1: You can activate the ocamlbuild_more_args feature. On top of your _oasis file: AlphaFeatures: ocamlbuild_more_args Then, in your Package:

Calling functions in other files in OCaml

落花浮王杯 提交于 2019-12-11 13:16:16
问题 I have hello.ml that has a length function: let rec length l = match l with [] -> 0 | h::t -> 1 + length t ;; call.ml that uses the function: #use "hello.ml" ;; print_int (length [1;2;4;5;6;7]) ;; In interpreter mode (ocaml), I can use ocaml call.ml to get the results, but when I tried to compile it with ocamlc or ocamlbuild, I got compilation error. File "call.ml", line 1, characters 0-1: Error: Syntax error Then, how to modify the caller, callee, and build command to compile the code into

Optional dependencies with ocamlbuild

ⅰ亾dé卋堺 提交于 2019-12-11 06:38:37
问题 I have an OCaml project that is currently built using OCamlMake. I am not happy with the current build system since it leaves all build artefacts in the same directory as source files, plus it also requires to manually specify order of dependencies between modules. I would like to switch to a build system that does not suffer from these issues. I decided to give Oasis a try but have run into issues. The problems arise from the fact that the project is built in a very specific way. It supports

Basic Oasis or Opam file for a simple OCaml project

一笑奈何 提交于 2019-12-10 13:08:46
问题 I am a new OCaml user. I have asked a question to learn how to set up a basic OCaml project, but I still have issues. Jump to the end for a TL;DR For instance, I am trying to learn Irmin. On the home page of Irmin I see I have to do opam install irmin git cohttp Doing so, I end up with Irmin version 0.8.3. Unfortunately, I cannot follow their examples, because apparently Irmin is at version 0.9.4, and it looks like the API has changed. So, I would like to start a clean project having as

ocamlbuild specify output location/name

三世轮回 提交于 2019-12-08 04:20:02
问题 Can I specify the build location and file name with the ocamlbuild tool? I would like to be able to say (in pseudocode): ocamlbuild myapp.ml -b native -o bin/myapp 回答1: There is no such option, but ocamlbuild is extensible and allows you to add your own options with Options.add . Of course, you will also need to add some implementation. Basically, hijacking the rule for native and extending it with installation procedure may work. To extend ocamlbuild you should write a plugin (other option