caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* nonresolved .cma files and errors
@ 2007-04-11  3:06 Jeff Henrikson
  2007-04-11  6:58 ` [Caml-list] " Martin Jambon
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jeff Henrikson @ 2007-04-11  3:06 UTC (permalink / raw)
  To: caml-list

Hello caml-list,

I recently had a shocking realization about why some of my experiments 
with camlp4 weren't compiling.  I had been linking camlp4.cma, which was 
the old name of the library.  Now camlp4.cma doesn't exist and there are 
multiple flavors Camlp4xxx.cma where the xxx is the same flavor notation 
of the the preprocessor binaries.  So the trouble is, why was linking 
such a library not a fatal?  Apparently all missing .cma and .cmo files 
passed on the command line are considered non-errors.  It seems intutive 
to me that both should be fatals!

~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.cma 
camlp4orf.cma -c dynamic_functor_example3.ml
~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.cmo 
camlp4orf.cma -c dynamic_functor_example3.ml
~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.ml 
camlp4orf.cma -c dynamic_functor_example3.ml
I/O error: "junk.ml: No such file or directory"
Preprocessor error

This is the behavior in 3.09.3 as well.  What is the rationale behind 
this design choice?

Regards,


Jeff Henrikson



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

* Re: [Caml-list] nonresolved .cma files and errors
  2007-04-11  3:06 nonresolved .cma files and errors Jeff Henrikson
@ 2007-04-11  6:58 ` Martin Jambon
  2007-04-11  8:04 ` Alain Frisch
  2007-04-11 11:35 ` Nicolas Pouillard
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Jambon @ 2007-04-11  6:58 UTC (permalink / raw)
  To: Jeff Henrikson; +Cc: caml-list

On Tue, 10 Apr 2007, Jeff Henrikson wrote:

> Hello caml-list,
>
> I recently had a shocking realization about why some of my experiments with 
> camlp4 weren't compiling.  I had been linking camlp4.cma, which was the old 
> name of the library.  Now camlp4.cma doesn't exist and there are multiple 
> flavors Camlp4xxx.cma where the xxx is the same flavor notation of the the 
> preprocessor binaries.  So the trouble is, why was linking such a library not 
> a fatal?  Apparently all missing .cma and .cmo files passed on the command 
> line are considered non-errors.  It seems intutive to me that both should be 
> fatals!
>
> ~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.cma 
> camlp4orf.cma -c dynamic_functor_example3.ml
> ~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.cmo 
> camlp4orf.cma -c dynamic_functor_example3.ml
> ~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.ml 
> camlp4orf.cma -c dynamic_functor_example3.ml
> I/O error: "junk.ml: No such file or directory"
> Preprocessor error

In general, a syntax extension that (like before) uses quotations in the 
revised syntax would be compiled using such a command:

ocamlc -c -I +camlp4 -pp camlp4orf pa_foo.ml

It replaces

ocamlc -c -I +camlp4 -pp 'camlp4o pa_extend.cmo q_MLast.cmo' pa_foo.ml


There might be some slight error in the commands I just wrote (it 
happens). You can have a look at my updated json-static package that 
you'll find on my web site. It supports both the old and the new camlp4, 
and it works for sure with 3.10.0+beta [it uses two different source files 
of course].


Martin

--
Martin Jambon
http://martin.jambon.free.fr


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

* Re: [Caml-list] nonresolved .cma files and errors
  2007-04-11  3:06 nonresolved .cma files and errors Jeff Henrikson
  2007-04-11  6:58 ` [Caml-list] " Martin Jambon
@ 2007-04-11  8:04 ` Alain Frisch
  2007-04-12  6:42   ` Jeff Henrikson
  2007-04-11 11:35 ` Nicolas Pouillard
  2 siblings, 1 reply; 6+ messages in thread
From: Alain Frisch @ 2007-04-11  8:04 UTC (permalink / raw)
  To: Jeff Henrikson; +Cc: caml-list

Jeff Henrikson wrote:
> I recently had a shocking realization about why some of my experiments
> with camlp4 weren't compiling.  I had been linking camlp4.cma, which was
> the old name of the library.  Now camlp4.cma doesn't exist and there are
> multiple flavors Camlp4xxx.cma where the xxx is the same flavor notation
> of the the preprocessor binaries.  So the trouble is, why was linking
> such a library not a fatal?  Apparently all missing .cma and .cmo files
> passed on the command line are considered non-errors.

.cma and .cmo files are not used during compilation. They make sense
only for link operations (including -pack and -a). One might argue that
the compiler should issue a warning when useless .cma and .cmo are given
on the command line.

-- Alain


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

* Re: [Caml-list] nonresolved .cma files and errors
  2007-04-11  3:06 nonresolved .cma files and errors Jeff Henrikson
  2007-04-11  6:58 ` [Caml-list] " Martin Jambon
  2007-04-11  8:04 ` Alain Frisch
@ 2007-04-11 11:35 ` Nicolas Pouillard
  2 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pouillard @ 2007-04-11 11:35 UTC (permalink / raw)
  To: Jeff Henrikson; +Cc: caml-list

On 4/11/07, Jeff Henrikson <jehenrik@yahoo.com> wrote:
> Hello caml-list,
>
> I recently had a shocking realization about why some of my experiments
> with camlp4 weren't compiling.  I had been linking camlp4.cma, which was
> the old name of the library.  Now camlp4.cma doesn't exist and there are
> multiple flavors Camlp4xxx.cma where the xxx is the same flavor notation
> of the the preprocessor binaries.  So the trouble is, why was linking
> such a library not a fatal?  Apparently all missing .cma and .cmo files
> passed on the command line are considered non-errors.  It seems intutive
> to me that both should be fatals!
>
> ~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.cma
> camlp4orf.cma -c dynamic_functor_example3.ml
> ~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.cmo
> camlp4orf.cma -c dynamic_functor_example3.ml
> ~/src/camlp4-beta jehenrik$ ocamlc -I +camlp4 -pp camlp4orf junk.ml
> camlp4orf.cma -c dynamic_functor_example3.ml
> I/O error: "junk.ml: No such file or directory"
> Preprocessor error
>

Good answers are already here, I just takes the lasts bits...

There is a list of libraries provided with camlp4:

camlp4{o,of,orf,r,rf}.cma are toplevel libs there are only made to be
loaded in the ocaml toplevel

camlp4lib.cma contains the Camlp4 module which holds the camlp4 kernel.

camlp4fullilb.cma contains modules of camlp4lib.cma plus all parsers
and filters.

-- 
Nicolas Pouillard


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

* Re: [Caml-list] nonresolved .cma files and errors
  2007-04-11  8:04 ` Alain Frisch
@ 2007-04-12  6:42   ` Jeff Henrikson
  2007-04-12  7:05     ` Alain Frisch
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Henrikson @ 2007-04-12  6:42 UTC (permalink / raw)
  To: Alain Frisch, caml-list

 > .cma and .cmo files are not used during compilation.

Ah, of course.  Rechecking my commands, your assertion is still 
consistent.  I thought I had counterintuitively gotten errors without 
the .cma, and had subconsciously filed in my brain under "weird inlining 
or something . . ."  Well nice to know axiomatically that .cmo / .cma is 
mutually exclusive with -c.

Yes if that's the case then I definitely think it should at least be a 
warning to include such a file with -c.

OTOH, I see from the list archive that I'm not making up this inlining 
across files thing . . .

http://caml.inria.fr/pub/old_caml_site/caml-list/0117.html

So if I understand correctly then, cross-file function inlining must by 
design be delayed until link time?


Regards,


Jeff Henrikson


Alain Frisch wrote:
> .cma and .cmo files are not used during compilation. They make sense
> only for link operations (including -pack and -a). One might argue that
> the compiler should issue a warning when useless .cma and .cmo are given
> on the command line.
>
> -- Alain
>   

Jeff Henrikson wrote:

> I recently had a shocking realization about why some of my experiments
> with camlp4 weren't compiling.  I had been linking camlp4.cma, which was
> the old name of the library.  Now camlp4.cma doesn't exist and there are
> multiple flavors Camlp4xxx.cma where the xxx is the same flavor notation
> of the the preprocessor binaries.  So the trouble is, why was linking
> such a library not a fatal?  Apparently all missing .cma and .cmo files
> passed on the command line are considered non-errors.
>   


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

* Re: [Caml-list] nonresolved .cma files and errors
  2007-04-12  6:42   ` Jeff Henrikson
@ 2007-04-12  7:05     ` Alain Frisch
  0 siblings, 0 replies; 6+ messages in thread
From: Alain Frisch @ 2007-04-12  7:05 UTC (permalink / raw)
  To: Jeff Henrikson; +Cc: caml-list

Jeff Henrikson wrote:
> OTOH, I see from the list archive that I'm not making up this inlining
> across files thing . . .
> 
> http://caml.inria.fr/pub/old_caml_site/caml-list/0117.html
> 
> So if I understand correctly then, cross-file function inlining must by
> design be delayed until link time?

No. The native compiler looks for .cmx files to perform inlining and
other cross-module optimizations. The -I options control in which
directories these files are searched for. The .cmx files provided on the
command line are again ignored.

-- Alain


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

end of thread, other threads:[~2007-04-12  7:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-11  3:06 nonresolved .cma files and errors Jeff Henrikson
2007-04-11  6:58 ` [Caml-list] " Martin Jambon
2007-04-11  8:04 ` Alain Frisch
2007-04-12  6:42   ` Jeff Henrikson
2007-04-12  7:05     ` Alain Frisch
2007-04-11 11:35 ` Nicolas Pouillard

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