Building an interactive bitstring toplevel in 3.11

19 views
Skip to first unread message

Phil Tomson

unread,
Mar 18, 2010, 9:13:13 PM3/18/10
to bitstring
Someone asked this a year or so ago (for 3.10). This was the reply
from Jessica Hamilton:

"Hi,

I have this working with ocaml-3.10.2. I don't have 3.11.0 on this
machine atm.

First you need to ln -s camlp4lib.cma to Camlp4.cma to make mkcamlp4
work -- prolly need to sudo/su to do that.

Second, command is: mkcamlp4 -I +camlp4 unix.cma toplevellib.cma
camlp4of.cma bitstring.cma bitstring_persistent.cma pa_bitstring.cmo
topstart.cmo -o ocaml-bitstring

And you'll have your interactive toplevel with bitmatch in it.

Kindest Regards,

Jessica "

I'm trying with 3.11 without much success. I'm getting:

$ mkcamlp4 -I .. -I +camlp4 ../dynlink.cma unix.cma
toplevellib.cma ../dynlink.cma camlp4of.cma ../../pkg-lib/bitstring/
bitstring.cma ../../pkg-lib/bitstring/bitstring_persistent.cma
pa_bitstring.cmo topstart.cmo -o ocaml-bitstring
/home/phil/godi-3.11/lib/ocaml/std-lib/extract_crc -I /home/phil/
godi-3.11/lib/ocaml/std-lib/camlp4 -I . -I .. -I +camlp4 > /tmp/
crc_ff4b47.ml
ocamlc -I /home/phil/godi-3.11/lib/ocaml/std-lib/camlp4 camlp4lib.cma /
tmp/crc_ff4b47.ml -I . -I .. -I +camlp4 ../dynlink.cma unix.cma
toplevellib.cma ../dynlink.cma camlp4of.cma ../../pkg-lib/bitstring/
bitstring.cma ../../pkg-lib/bitstring/bitstring_persistent.cma
pa_bitstring.cmo topstart.cmo -o ocaml-bitstring Camlp4Bin.cmo -
linkall


File "/tmp/crc_ff4b47.ml", line 1, characters 0-1:
Error: Error while linking camlp4lib.cma(Camlp4):
Reference to undefined global `Dynlink'
rm -f /tmp/crc_ff4b47.ml /tmp/crc_ff4b47.cmi /tmp/crc_ff4b47.cmo
Fatal error: exception Failure("Exit: 2")


Is it possible to use ocamlmktop?

Phil

Jessica Hamilton

unread,
Mar 18, 2010, 10:39:56 PM3/18/10
to bits...@googlegroups.com
Hi Phil,

To me it looks like mkcamlp4 is out of date. The autogenerated ocamlc
line should include dynlink.cma (and maybe the include path).

I've never tried ocamlmktop :)

I would file a bug with ocaml at http://caml.inria.fr/mantis to fix
mkcamlp4 or remove it completely if it has been superseded by some
other method like ocamlmktop.

Jessica

> --
> You received this message because you are subscribed to the Google
> Groups "bitstring" group.
> To post to this group, send email to bits...@googlegroups.com
> To unsubscribe from this group, send email to
> bitstring+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/bitstring?hl=en
> Project home page: http://code.google.com/p/bitstring/
>
> To unsubscribe from this group, send email to bitstring+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

Jessica Hamilton

unread,
Mar 19, 2010, 2:25:20 AM3/19/10
to bits...@googlegroups.com
Hi Phil,

Just run the following, add -I flags where necessary to get everything found:

/home/phil/godi-3.11/lib/ocaml/std-lib/extract_crc \
-I /home/phil/godi-3.11/lib/ocaml/std-lib/camlp4 \


-I . -I .. -I +camlp4 > /tmp/crc_ff4b47.ml

ocamlc -I /home/phil/godi-3.11/lib/ocaml/std-lib/camlp4 \
unix.cma dynlink.cma camlp4lib.cma /tmp/crc_ff4b47.ml \
-I . -I .. -I +camlp4 toplevellib.cma camlp4of.cma \
../../pkg-lib/bitstring/bitstring.cma


../../pkg-lib/bitstring/bitstring_persistent.cma \
pa_bitstring.cmo topstart.cmo -o ocaml-bitstring Camlp4Bin.cmo -linkall

mkcamlp4 doesn't do anything particularly special other than run the
extract_crc command

Jessica

Phil Tomson

unread,
Mar 19, 2010, 11:41:19 AM3/19/10
to bits...@googlegroups.com
Thanks, that worked.

Phil

On Thu, Mar 18, 2010 at 10:25 PM, Jessica Hamilton

Reply all
Reply to author
Forward
0 new messages