Questions tagged [ocamlbuild]

OCamlbuild is a generic build tool, that has built-in rules for building OCaml library and programs.

OCamlbuild is a generic build tool, that has built-in rules for building library and programs.

Useful resources

160 questions
1
vote
1 answer

Interface of arbitrary types for OCaml Plugin

I am using ocaml_plugin to write calculator which is able to evaluate OCaml expressions at run time. This is my plugin interface. open Ocaml_plugin.Std module type S = sig val f : unit -> float end let univ_constr : (module S)…
Yixing Liu
  • 2,179
  • 1
  • 20
  • 36
1
vote
1 answer

ocamlbuild error unbound value

So let's be brief. I learn OCaml for a course I'm currently following, and I'm trying to get intellisense working for the setup I have with VS code on Linux. For that, I have to build my files first. Problem is, when I try to build my file…
1
vote
1 answer

OCaml error an expression was expected of type int (confusing error)

My code: let safe_log10 = function x -> if (x <= 0.) then None else Some (log10 x);; With input -1.0, this gives: safe_log10 -1.0;; Error: This expression has type float -> float option but an expression was expected of type int However,…
1
vote
1 answer

Change the name of the produced executable with Oasis

Well, title says it all, I want to change the name of my executable because right now I have Executable myexec Path: . BuildTools: ocamlbuild MainIs: main.ml CompiledObject: best And it produces…
Lhooq
  • 4,281
  • 1
  • 18
  • 37
1
vote
2 answers

Require specific OCaml version in makefile

My OCaml program uses some functions in the OCaml standard library that were only introduced in version 4.01.0. How can I arrange that when my user compiles my code, the compiler emits an error if the OCaml compiler's version is not 4.01.0 or…
John Wickerson
  • 1,204
  • 12
  • 23
1
vote
1 answer

Ocaml Error : Unbound module when compiling

I'm learning Ocaml and currently I'm building a graphical interface for a game. I used Graphics and camlimages but now I would like to add some buttons. So I searched for Gtk2 and I'm having problems to compile now. This is a part of my code: open…
Gh0stm4chine
  • 11
  • 1
  • 2
1
vote
1 answer

Ocamlbuild: use two preprocessors on the same file

I'm trying to unleash power of two preprocessors in ocamlbuild. I tried flag ["ocaml"; "use_m4"] (S [ A"-pp"; Px"m4 macro.m4" ; A"-pp"; Px"camlp5o pr_o.cmo camlp5/pa_gt.cmo" ]);…
Kakadu
  • 2,837
  • 19
  • 29
1
vote
3 answers

Optional dependencies with ocamlbuild

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…
Jan Stolarek
  • 1,409
  • 1
  • 11
  • 21
1
vote
1 answer

Ubuntu Ocaml llvm unbound module ExecutionEngine

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\Chapter4 I am encountering an issue when compiling with ocamlbuild…
1
vote
1 answer

Is there a way to tell ocamlbuild to run my file instead of just produce an executable?

Right now, if I want to recompile and run an ml file I use ocamlbuild -pkg containers myfile.byte && ./myfile.byte Is there a shorter way to do this? In haskell you can run things just by saying runghc myfile.hs and I wonder if ocamlbuild or…
hugomg
  • 68,213
  • 24
  • 160
  • 246
1
vote
1 answer

Compiling with ocamlbuild and camlp5

I am trying to make a project I am working on compile with ocamlbuild, in order to avoid the use of a regular Makefile, which I find to be slightly more complicated. Specifically, I have a syntax extension file (extend.ml), which I need to be…
michalis-
  • 38
  • 1
  • 7
1
vote
2 answers

How to tell _oasis or OCamlbuild to generate annotations?

The issue is simple: I can't find anywhere in the OCamlBuild or Oasis manual how to tell the tool to automatically generate annotation files (.cmt) at compilation time. Annotation files are useful because Merlin eats them up when it comes time to…
Adam Miller
  • 1,756
  • 1
  • 25
  • 44
1
vote
2 answers

ocamlbuild specify output location/name

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
eatonphil
  • 13,115
  • 27
  • 76
  • 133
1
vote
2 answers

OCamlfind local library unbound module

I am trying to use ocamlfind to install a library. I am using OCamlMakeFile. Here is my Makefile: OCAMLMAKEFILE = OCamlMakeFile RESULT = owebl SOURCES = src/utils.ml src/verb.ml src/request.ml src/template.ml src/response.ml src/rule.ml…
eatonphil
  • 13,115
  • 27
  • 76
  • 133
1
vote
1 answer

Include signature (.mli) file in library

I have a library were the common datatypes are defined in a signature-only module (copying that signature to an implementation does not make sense, since it does not contain any functionality): (* b.mli *) type bar = A of int | B of float (* a.ml:…
choeger
  • 3,562
  • 20
  • 33