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
6
votes
1 answer

Basic Oasis or Opam file for a simple OCaml project

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…
Andrea
  • 20,253
  • 23
  • 114
  • 183
6
votes
1 answer

How to pass -S flag to ocamlopt with ocamlbuild?

I'd like to pass the -S flag to ocamlopt when building with the ocamlbuild and corebuild commands. I understand doing ocamlbuild -cflag -S ... won't work since -S flag does only exist for ocamlopt and not ocamlc. How can I do this using _tags files?
Antoine
  • 1,782
  • 1
  • 14
  • 32
6
votes
2 answers

How to make OCamlbuild compile and link a C file into an OCaml project?

I'm trying to build an OCaml binary main.native from main.ml that also relies on a single C file custom.c to implement a new primitive. This C file needs to be compiled and linked. Is there a way to do this just with a _tags file? The obvious…
Christian Lindig
  • 1,216
  • 1
  • 9
  • 24
5
votes
1 answer

OCaml corebuild cannot link to Core.Std

My problem is similar to this, however, in my case .ocamlinit is set. Here is my ocaml version. mymac:Desktop myusr$ ocaml --version The OCaml toplevel, version 4.08.1 Here is my opam version. mymac:Desktop myusr$ opam --version 2.0.5 Here is my…
Matthew James Briggs
  • 2,085
  • 2
  • 28
  • 58
5
votes
1 answer

What's the purpose of _tags file with OCaml, and how to interpret the contents?

From Building OCaml code that uses list comprehension post, I can use _tags file to execute ocamlbuild with less build options. $ cat _tags <**/*> : package(camlp4),syntax(camlp4o),package(pa_comprehension) From the Batteries introduction, I also…
prosseek
  • 182,215
  • 215
  • 566
  • 871
5
votes
1 answer

Linking a library via ocamlbuild/ocamlfind

I have a locally pinned OPAM project called ojasmine which I want to compile as a library to be used by another project called test_tournabox (ultimately compiling to javascript). However, the compilation of test_tournabox is failing with a link…
Lyn Headley
  • 11,368
  • 3
  • 33
  • 35
5
votes
2 answers

Telling ocamlbuild to use Core

In my project I have a file that uses Core.Std stuff, so I have run opam install core and added open Core.Std in my file. When I run ocamlbuild myprogram.native it says: Error: Unbound module Core pointing to line with the open statement…
Calle
  • 366
  • 6
  • 17
5
votes
2 answers

OCamlbuild and camlp4 options

I'm using camlp4.macro to enable conditional compilation. I'm having problems informing OCamlbuild that certain files tagged with "use_jscore" must be preprocessed with a given camlp4 option. Here's what I have currently: let _ = dispatch begin…
Jon Smark
  • 2,528
  • 24
  • 31
4
votes
4 answers

Ocamlopt and missing crt2.o file

Having installed OCaml on Windows 7, 64 bit (self-installer), I tried to create a simple exe file with ocamlopt HelloWorld.ml -o HelloWorld As required I used the native-code compiler (ocamlopt) with Visual C++ (I have Visual Studio 10 installed)…
user1060986
  • 141
  • 1
  • 1
  • 3
4
votes
1 answer

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

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…
Surikator
  • 1,463
  • 9
  • 26
4
votes
1 answer

How to load .ml file with its corresponding .mli file in utop?

Simply put, let us say I have an implementation file called moduleExample.ml and an interface file in the same directory called moduleExample.mli. How could I load them together in such a way that the functions not listed in the interface…
Gigi Bayte 2
  • 838
  • 1
  • 8
  • 20
4
votes
3 answers

oasis picks up wrong ocamlbuild

I try to compile an Ocaml project with an Ocaml version provided by Opam. My ocamlbuild, ocamlfind, and oasis seem OK : /Users/fred/.opam/4.02.1/bin/ocamlbuild dhcp-182-73:compil fred$ which…
Godev
  • 316
  • 1
  • 4
  • 12
4
votes
3 answers

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

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…
Txin
  • 43
  • 4
4
votes
2 answers

How to traverse typed abstract syntax tree in OCaml compiler

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…
4
votes
2 answers

Oasis build configuration with subdirectories

I am using oasis to build my ocaml project, with the source code present in a directory called src. The oasis build file looks like that: OASISFormat: 0.4 Name: Test Version: 0.1 Synopsis: no Authors: Me License: …
lambda.xy.x
  • 4,918
  • 24
  • 35
1
2
3
10 11