caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] problems with ocamlbuild in 3.12
@ 2011-04-18 12:14 evil sloot
  2011-04-21  7:32 ` xclerc
  0 siblings, 1 reply; 2+ messages in thread
From: evil sloot @ 2011-04-18 12:14 UTC (permalink / raw)
  To: caml-list

Hi,

I'm upgrading from ocaml 3.11 to 3.12 and I'm facing some problems with my ocamlfind buildscripts. 

In essence, I see the following.

- static linking gives problems when you have multiple libraries with dependencies amongst each other. The gcc linker needs to have them in correct order or it will fail. I have to revert to tricks like this in my ocamlbuild.ml file:

 flag ["ocaml";"link";"is_main"](
      S[A"-linkpkg";
    A"src/otc/libotc.a"; (* depends on libtokyocabinet, so must come before (really) on the linking line *)
        A"-ccopt"; A("-L" ^ tc_home);
        A"-cclib"; A"-ltokyocabinet";
       ]);
to force the order in which the arguments are processed. 
  Is there a more

- building of .cmxa libraries fails in combination with package(...) tags
  for example, I have
  true:package(lwt) in my _tags file

  and the build of my library gives:
  ocamlbuild -use-ocamlfind my_lib.cmxa

  + /usr/bin/ocamlfind ocamlopt -a -linkpkg ...  -package lwt ....
    -o my_lib.cmxa
   File "_none_", line 1, characters 0-1:
   Error: /usr/lib/ocaml/unix.cmxa
   is not a compilation unit description.
   Command exited with code 2.

  the -linkpkg should not be there.... 
  So how do I avoid this?

Since I can't find these things in the documentation, I think I can ask here.

Also, how do I make it so that ocamlbuild always uses ocamlfind so I
don't have to type
ocamlbuild -use-ocamlfind ... 
all the time ? (I could not find it anywhere in the documentation)
  
tia,

Romain

PS

- ocamlbuild & ocamlfind are part of the core but the reference manual
  (http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html) 
  doesn't even mention them. 
- The ocamlbuild manual does not mention the recent developments such as
  package(...), and the new way of handling syntax extensions,
- ocamlbuild wiki mostly has old examples.

- I see that lwt is  moving towards Oasis, should I do this too?


 




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

* Re: [Caml-list] problems with ocamlbuild in 3.12
  2011-04-18 12:14 [Caml-list] problems with ocamlbuild in 3.12 evil sloot
@ 2011-04-21  7:32 ` xclerc
  0 siblings, 0 replies; 2+ messages in thread
From: xclerc @ 2011-04-21  7:32 UTC (permalink / raw)
  To: Caml List


Le 18 avr. 2011 à 14:14, evil sloot a écrit :

> Hi,
> 
> I'm upgrading from ocaml 3.11 to 3.12 and I'm facing some problems with my ocamlfind buildscripts. 
> 
> In essence, I see the following.
> 
> - static linking gives problems when you have multiple libraries with dependencies amongst each other. The gcc linker needs to have them in correct order or it will fail. I have to revert to tricks like this in my ocamlbuild.ml file:
> 
> flag ["ocaml";"link";"is_main"](
>       S[A"-linkpkg";
>     A"src/otc/libotc.a"; (* depends on libtokyocabinet, so must come before (really) on the linking line *)
>         A"-ccopt"; A("-L" ^ tc_home);
>         A"-cclib"; A"-ltokyocabinet";
>        ]);
> to force the order in which the arguments are processed. 
>   Is there a more
> 
> - building of .cmxa libraries fails in combination with package(...) tags
>   for example, I have
>   true:package(lwt) in my _tags file
> 
>   and the build of my library gives:
>   ocamlbuild -use-ocamlfind my_lib.cmxa
> 
>   + /usr/bin/ocamlfind ocamlopt -a -linkpkg ...  -package lwt ....
>     -o my_lib.cmxa
>    File "_none_", line 1, characters 0-1:
>    Error: /usr/lib/ocaml/unix.cmxa
>    is not a compilation unit description.
>    Command exited with code 2.
> 
>   the -linkpkg should not be there.... 
>   So how do I avoid this?
> 
> Since I can't find these things in the documentation, I think I can ask here.

Sure, but also filling a bug report at <http://caml.inria.fr/mantis> is a good
idea to ensure tracking, and that developers are notified that a bug has to
be fixed.

Providing a minimal source file along with the used "_tags" file is also
a great help in order to quickly fix a bug.


> Also, how do I make it so that ocamlbuild always uses ocamlfind so I
> don't have to type
> ocamlbuild -use-ocamlfind ... 
> all the time ? (I could not find it anywhere in the documentation)

I don't think you can do so. The "canonical" way of using "ocamlbuild"
is to call it from a minimal makefile of shell script. Doing this way, you
only pay once the extra "-use-ocamlfind ..." characters.


> - ocamlbuild & ocamlfind are part of the core but the reference manual
>  (http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html) 
>  doesn't even mention them. 

The "ocamlfind" tool was created and is maintained by Gerd Stolpmann,
hence its absence from the Objective Caml manual.

At the opposite, the "ocamlbuild" tool was created by Nicolas Pouillard and
Berke Durak inside the INRIA and is maintained by the Gallium team.
Its absence from the Objective Caml manual stems from the fact that it is not
(yet) a first-class citizen tool in the distribution. The medium-term goal is
clearly to make it a first-class citizen tool.


> - The ocamlbuild manual does not mention the recent developments such as
>  package(...), and the new way of handling syntax extensions,
> - ocamlbuild wiki mostly has old examples.

I acknowledge the problem; nevertheless, this allows us to be unbound by
compatibility issues... Not that the tool will dramatically change in its behavior,
but we are not tightly tied by backward compatibility issues.
In the move to make "ocamlbuild" a first-class citizen tool, having a proper and
up-to-date documentation is part of the requirements.


> - I see that lwt is  moving towards Oasis, should I do this too?

From my limited understanding, "ocamlbuild" is a building tool while Oasis[-db]
is a packaging tool. Moreover, if memory serves, Oasis can use "ocamlbuild" in
order to compile a package / project.


Regards,

Xavier Clerc



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

end of thread, other threads:[~2011-04-21  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-18 12:14 [Caml-list] problems with ocamlbuild in 3.12 evil sloot
2011-04-21  7:32 ` xclerc

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).