caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] OcamlMakefile not working for me...
@ 2001-08-27  4:39 Michael Leary
  2001-08-27  8:16 ` Michael Leary
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Leary @ 2001-08-27  4:39 UTC (permalink / raw)
  To: caml

There must be something simple I'm not doing...

"cgi.cmxa" and the LIBDIRS should appear on the "ocamlopt..." line (see below)

and if I try from the commandline, I get lots of other errors:

[0 leary@jean pleac]$ ocamlopt -c cgi.cmxa -I /usr/local/lib/ocaml/site-lib/netstring 19.1.ml
/tmp/camlasm1.s: Assembler messages:
/tmp/camlasm1.s:2: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:3: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:5: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:6: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:9: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:10: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:14: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:15: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:20: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:21: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:27: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:28: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:31: Error: ignoring junk `$2e1_2' after expression
/tmp/camlasm1.s:35: Error: ignoring junk `$2e1' after expression
/tmp/camlasm1.s:37: Error: ignoring junk `$2e1_1' after expression
/tmp/camlasm1.s:44: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:45: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:47: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:48: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:50: Error: Rest of line ignored. First ignored character is `1'.
/tmp/camlasm1.s:51: Error: Rest of line ignored. First ignored character is `1'.
Assembler error, input left in file /tmp/camlasm1.s

Bad build of ocaml?


# begin Makefile
# Set these variables to the names of the sources to be processed and
# the result variable. Order matters during linkage!

OCAMLMAKEFILE = ./OcamlMakefile

SOURCES = 19.1.ml

RESULT = 19.1

LIBS = cgi

LIBDIRS = /usr/local/lib/ocaml/site-lib/netstring

all: native-code

-include $(OCAMLMAKEFILE)

# end Makefile

[0 leary@jean pleac]$ make
make[1]: Entering directory `/home/leary/dev/pleac'
making ._d/19.1.d from 19.1.ml
make[1]: Leaving directory `/home/leary/dev/pleac'
make[1]: Entering directory `/home/leary/dev/pleac'
ocamlopt -c       19.1.ml
File "19.1.ml", line 25, characters 0-8:
Unbound module Cgi
make[1]: *** [19.1.cmi] Error 2
make[1]: Leaving directory `/home/leary/dev/pleac'
make: *** [native-code] Error 2

-- 
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] OcamlMakefile not working for me...
  2001-08-27  4:39 [Caml-list] OcamlMakefile not working for me Michael Leary
@ 2001-08-27  8:16 ` Michael Leary
  2001-08-27  9:59   ` Michael Leary
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Leary @ 2001-08-27  8:16 UTC (permalink / raw)
  To: caml

On Sun, Aug 26, 2001 at 09:39:23PM -0700, Michael Leary wrote:
> There must be something simple I'm not doing...
> [0 leary@jean pleac]$ ocamlopt -c cgi.cmxa -I /usr/local/lib/ocaml/site-lib/netstring 19.1.ml
> /tmp/camlasm1.s: Assembler messages:

OK, filenames can't be numbers.  :o}  One down.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] OcamlMakefile not working for me...
  2001-08-27  8:16 ` Michael Leary
@ 2001-08-27  9:59   ` Michael Leary
  2001-08-27 10:11     ` Michael Leary
  2001-08-27 12:01     ` Alain Frisch
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Leary @ 2001-08-27  9:59 UTC (permalink / raw)
  To: caml

OK, figured out the rest of it... I wasn't familar with the method for
using a package.  Roughly:

(* nineteen_one.ml *)
open Printf;;
open Cgi;;
parse_arguments default_config;
let value = argument_value("foo");;
header;;
printf "%s" value;;

# makefile
OCAMLMAKEFILE = ./OcamlMakefile
SOURCES = nineteen_one.ml
RESULT = nineteen_one
LIBS = str netstring
INCDIRS = /usr/local/lib/ocaml/site-lib/netstring
all: native-code
-include $(OCAMLMAKEFILE)

$> make nc
...

All good 'till now, but it doesn't run right:

$> ./nineteen_one
Fatal error: uncaught exception Failure("Cgi.parse_arguments: unknown method")


I tried:

try
	Cgi.parse_arguments default_config;
with x ->
	raise x;;


but that helped not at all... what other simple thing have I missed?  The
method is in the cgi.mli.


-- 
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] OcamlMakefile not working for me...
  2001-08-27  9:59   ` Michael Leary
@ 2001-08-27 10:11     ` Michael Leary
  2001-08-27 12:01     ` Alain Frisch
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Leary @ 2001-08-27 10:11 UTC (permalink / raw)
  To: caml

On Mon, Aug 27, 2001 at 02:59:06AM -0700, Michael Leary wrote:
> $> ./nineteen_one
> Fatal error: uncaught exception Failure("Cgi.parse_arguments: unknown method")

from cgi.mli:

val parse_arguments : config -> unit
val arguments : unit -> (string * argument) list
    (* - let () = parse_arguments config:
     * Decodes the CGI arguments. 'config' specifies limits and processing
     * hints; you can simply pass default_config (see below).


val default_config : config
    (* maximum_content_length = maxint
     * how_to_process_arguments = "use always Memory"
     * tmp_directory = "/var/tmp"
     * tmp_prefix = "cgi"
     * workarounds = [ Work_around_MSIE_content_type_bug;
     *                 Work_around_backslash_bug;
                                                                                                

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] OcamlMakefile not working for me...
  2001-08-27  9:59   ` Michael Leary
  2001-08-27 10:11     ` Michael Leary
@ 2001-08-27 12:01     ` Alain Frisch
  2001-08-27 22:10       ` Michael Leary
  2001-08-28  0:39       ` Gerd Stolpmann
  1 sibling, 2 replies; 7+ messages in thread
From: Alain Frisch @ 2001-08-27 12:01 UTC (permalink / raw)
  To: Michael Leary; +Cc: caml

On Mon, 27 Aug 2001, Michael Leary wrote:

> All good 'till now, but it doesn't run right:
> 
> $> ./nineteen_one
> Fatal error: uncaught exception Failure("Cgi.parse_arguments: unknown method")

This function expects the program to be called with the CGI interface;
when you call it directly on the command line, the Cgi module can't tell
what the CGI arguments are and which _HTTP_ method you use.

(Perl's CGI has something interesting for debugging: when the program is
called on the command line, the module asks the user for 'name=value'
bindings on the standard input; maybe this could be an useful feature
for Cgi)

> try
> 	Cgi.parse_arguments default_config;
> with x ->
> 	raise x;;
> 
> 
> but that helped not at all...

This can't help for any problem at all: this construction catches the
exception and raises it again immediatly; except for the backtrace stack,
it is as if you did 'Cgi.parse_arguments default_config'.



  Alain

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] OcamlMakefile not working for me...
  2001-08-27 12:01     ` Alain Frisch
@ 2001-08-27 22:10       ` Michael Leary
  2001-08-28  0:39       ` Gerd Stolpmann
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Leary @ 2001-08-27 22:10 UTC (permalink / raw)
  To: Alain Frisch; +Cc: caml

On Mon, Aug 27, 2001 at 02:01:48PM +0200, Alain Frisch wrote:
> This function expects the program to be called with the CGI interface;
> when you call it directly on the command line, the Cgi module can't tell
> what the CGI arguments are and which _HTTP_ method you use.
> 
> (Perl's CGI has something interesting for debugging: when the program is
> called on the command line, the module asks the user for 'name=value'
> bindings on the standard input; maybe this could be an useful feature
> for Cgi)

Here's what I ended up with.  Works from the command line even, and
functions more or less like "errors to browser" in Perl.  In practice, I'd
probably do some matching on 'value', and Do The Right Thing, i.e. maybe
request user input ala CGI.pm, but this at least works.  :)

open Printf;;
open Cgi;;

let value =
	try
		parse_arguments default_config;
		argument_value("foo")
	with
		Not_found -> "key not found";
		| Failure x -> "Failure: " ^ x;;
	
header "text/html";;

printf "<html><body>foo: %s</body></html>" value;;



-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] OcamlMakefile not working for me...
  2001-08-27 12:01     ` Alain Frisch
  2001-08-27 22:10       ` Michael Leary
@ 2001-08-28  0:39       ` Gerd Stolpmann
  1 sibling, 0 replies; 7+ messages in thread
From: Gerd Stolpmann @ 2001-08-28  0:39 UTC (permalink / raw)
  To: caml

On Mon, 27 Aug 2001, Alain Frisch wrote:
>On Mon, 27 Aug 2001, Michael Leary wrote:
>
>> All good 'till now, but it doesn't run right:
>> 
>> $> ./nineteen_one
>> Fatal error: uncaught exception Failure("Cgi.parse_arguments: unknown method")
>
>This function expects the program to be called with the CGI interface;
>when you call it directly on the command line, the Cgi module can't tell
>what the CGI arguments are and which _HTTP_ method you use.
>
>(Perl's CGI has something interesting for debugging: when the program is
>called on the command line, the module asks the user for 'name=value'
>bindings on the standard input; maybe this could be an useful feature
>for Cgi)

I've added it to the Wish List. That should be simple to implement.

Gerd
-- 
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 45             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de
Germany                     
----------------------------------------------------------------------------
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-08-28  0:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-27  4:39 [Caml-list] OcamlMakefile not working for me Michael Leary
2001-08-27  8:16 ` Michael Leary
2001-08-27  9:59   ` Michael Leary
2001-08-27 10:11     ` Michael Leary
2001-08-27 12:01     ` Alain Frisch
2001-08-27 22:10       ` Michael Leary
2001-08-28  0:39       ` Gerd Stolpmann

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