caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] oasis building out-of-src and camlp4
@ 2015-09-22 21:12 Magnus Therning
  2015-09-23  7:48 ` Anil Madhavapeddy
  2015-09-23  7:56 ` Anil Madhavapeddy
  0 siblings, 2 replies; 14+ messages in thread
From: Magnus Therning @ 2015-09-22 21:12 UTC (permalink / raw)
  To: OCaml List

[-- Attachment #1: Type: text/plain, Size: 2622 bytes --]

I've been trying to get oasis to build completely out-of-source.
Basically I want to use it as an ExternalProject in a C/C++ project that
uses CMake.

If I have the following files

~~~ oasis-simple/_oasis
OASISFormat : 0.4
Name : oasis-simple
Version : 0.0
Synopsis : A simple test of building oasis
Authors : Magnus Therning
License : BSD-3-clause

Executable "oasis-simple"
    Path : src
    MainIs : main.ml
    BuildTools : ocamlbuild
    BuildDepends : oasis
~~~

~~~ oasis-simple/src/main.ml
let () = print_string "Hello, World!"
~~~

then I can build out-of-source using the following steps:

    % mkdir ../oasis-simple-build; cd ../oasis-simple-build
    % oasis setup -oasis ../oasis-simple/_oasis
    % ocaml setup.ml -C $PWD/../oasis-simple -configure
    % ocaml setup.ml -C $PWD/../oasis-simple -build -build-dir $PWD/build

If I make it a little more complicated, by adding a syntax extension:

~~~ oasis-camlp4/_oasis
OASISFormat : 0.4
Name : oasis-camlp4
Version : 0.0
Synopsis : A slightly more complicated test of building oasis
Authors : Magnus Therning
License : BSD-3-clause

Executable "oasis-camlp4"
    Path : src
    MainIs : main.ml
    BuildTools : ocamlbuild
    BuildDepends : oasis, core, sexplib.syntax, threads
~~~

~~~ oasis-camlp4/src/main.ml
open Core.Std

type colour = Red | Green | Blue
    with sexp

let () = printf "Hello, World! (%s)\n" (sexp_of_colour Green |> Sexp.to_string)
~~~

Then I follow the same formula as above:

    % mkdir ../oasis-camlp4-build; cd ../oasis-camlp4-build
    % oasis setup -oasis ../oasis-camlp4/_oasis
    % ocaml setup.ml -C $PWD/../oasis-camlp4 -configure
    % ocaml setup.ml -C $PWD/../oasis-camlp4 -build -build-dir $PWD/build

Which results in an error:

~~~
+ /usr/bin/ocamldep.opt -modules src/main.ml > src/main.ml.depends
File "src/main.ml", line 12, characters 4-8:
Error: Syntax error
Command exited with code 2.
Compilation unsuccessful after building 1 target (0 cached) in 00:00:00.
E: Failure("Command ''/usr/bin/ocamlbuild' src/main.byte -tag debug -build-dir /home/magnus/devo/tmp/oasis-camlp4-build/build' terminated with error code 10")
~~~

What am I missing here, how do I get the second example to build?

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus@therning.org   jabber: magnus@therning.org
twitter: magthe               http://therning.org/magnus

There does not now, nor will there ever, exist a programming language
in which it is the least bit hard to write bad programs.
     -- Flon's Axiom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-10-02  9:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22 21:12 [Caml-list] oasis building out-of-src and camlp4 Magnus Therning
2015-09-23  7:48 ` Anil Madhavapeddy
2015-09-23  8:19   ` Magnus Therning
2015-09-23  8:38     ` Gabriel Scherer
2015-09-23  8:54       ` Magnus Therning
2015-09-23  9:19         ` Gabriel Scherer
2015-09-23  9:44           ` Magnus Therning
2015-09-29 22:59             ` Sylvain Le Gall
2015-09-30 11:49               ` Magnus Therning
2015-10-01  6:46                 ` Sylvain Le Gall
2015-10-01  7:23                   ` Magnus Therning
2015-10-02  9:32                     ` Sylvain Le Gall
2015-10-02  9:38                       ` Magnus Therning
2015-09-23  7:56 ` Anil Madhavapeddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).