title: using OCaml Batteries Included as a vanilla cma
body: <p>I am a bit frustrated and confused by the OCaml Batteries Included concept and the way most tutorials I could find proceed. Before I get to use "productivity" tools like GODI or replace invocations of <em>ocamlc</em> with <em>ocamlfind batteries/ocamlc</em> (which is, at this point, too magical for me) I was hoping to be able to simply use OCaml Batteries Included core set of libraries like any other library. To that end I downloaded the latest source from <a href="https://github.com/ocaml-batteries-team/batteries-included.git">git</a> (head hash: 9f94ecb) and did a <em>make all</em>. I noticed that I got three <em>.cma</em> libraries at <strong>./_build/src/</strong> together with 102 <em>.cmi</em> files in the same directory. So I assumed that compiling with the -I switch pointing to that directory and linking with one of the three <em>.cma</em> libraries found there would be enough without needing to "install" the Batteries or use the platform tools. To test that, I set out to produce an executable for the following simple program I found somewhere:</p>
  
  <pre><code>(* file euler001.ml *)
  open BatEnum      
  open BatPervasives
  let main () = 
   (1--999)
  |&gt; BatEnum.filter (fun i -&gt; i mod 3 = 0 || i mod 5 == 0)
  |&gt; BatEnum.reduce (+) 
  |&gt; BatInt.print stdout
  
  let _ = main ()
  </code></pre>
  
  <p>I was able to compile it with:</p>
  
  <pre>
  ocamlc -c -I ../batteries-included/_build/src/ euler001.ml
  </pre>
  
  <p>but when I tried to link with:</p>
  
  <pre>
  ocamlc -o euler001 unix.cma nums.cma ../batteries-included/_build/src/batteries.cma  euler001.cmo
  </pre>
  
  <p>I got:</p>
  
  <pre>
  File "_none_", line 1, characters 0-1:
  Error: Error while linking ../batteries-included/_build/src/batteries.cma(BatBigarray):
  The external function `caml_ba_reshape' is not available
  </pre>
  
  <p>The <strong>nums.cma</strong> and <strong>unix.cma</strong> I added at the command line because the linker complained about missing references to undefined global <strong>Big_int</strong> and (when that was added) to <strong>Unix</strong>. But after these two modules were added on the linker invocation I received the last message (on the missing external function 'caml_ba_reshape') which proved blocking for me. So I would like to ask:</p>
  
  <ol>
   <li>how does one proceed in this particular case?
   <li>how does one proceed in the general case (i.e. when the linker complains about a missing external function)
   <li>is it viable to use Batteries Included in this fashion? Before I rely on platform tools I want to have the assurance that I can use the underlying artifacts (cma and cmi/mli files) with the standard OCaml compiler and linker if I run into problems.
  
  </ol>