[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: odd build error



On Fri, Aug 12, 2011 at 9:12 AM, Richard Mortier
<Richard.Mortier@xxxxxxxxxxxxxxxx> wrote:
> i'm making a start at an openflow implementation in mirage. Âjust starting to 
> get dave's packet parsing mpl ported over to bitstring. Âam hitting a compile 
> error that i don't understand:
>
> /usr/local/bin/ocamldep.opt -pp 'camlp4o -I ../../../syntax/_build pa_lwt.cma 
> pa_bitstring.cma pa_js.cma' -modules openflow/ofpacket.ml > 
> openflow/ofpacket.ml.depends
> + /usr/local/bin/ocamldep.opt -pp 'camlp4o -I ../../../syntax/_build 
> pa_lwt.cma pa_bitstring.cma pa_js.cma' -modules openflow/ofpacket.ml > 
> openflow/ofpacket.ml.depends
> File "ghost-location", line 448, characters 40--13388 (end at line 1, 
> character 0):
> Failure: "invalid long identifier type"
> Preprocessing error on file openflow/ofpacket.ml
> Command exited with code 2.
> make[1]: *** [node-socket-node] Error 10
>
> all checked in on openflow branch; code around that line is:
>
> """
> type phy_port = {
> Â Â Â Âport_no: uint16;
> Â Â Â Âhw_addr: eaddr;
> Â Â Â Âname: string;
> Â Â Â Âconfig: port_config;
> Â Â Â Âstp_forward: bool;
> Â Â Â Âstp_learn: bool;
> Â Â Â Âlink_down: bool;
> Â Â Â Âcurr: phy_port_feature;
> Â Â Â Âadvertised: phy_port_feature;
> Â Â Â Âsupported: phy_port_feature;
> Â Â Â Âpeer: phy_port_feature;
> }
>
> type port_status_reason = [ ADD | DEL | MOD ] Â<======= this is line 448
> let port_status_reason_of_int = function
> Â| 0 -> ADD
> Â| 1 -> DEL
> Â| 2 -> MOD
> and int_of_port_status_reason = function
> Â| ADD -> 0
> Â| DEL -> 1
> Â| MOD -> 2
> and string_of_port_status_reason = function
> Â| ADD -> sp "ADD"
> Â| DEL -> sp "DEL"
> Â| MOD -> sp "MOD"
> """
>
> hints, suggestions, answers welcome :)

You probably want to loose the brackets:
type port_status_reason = ADD |  DEL | MOD

Alternatively (but it doesn't look like you need it) you can use
polymorphic variants, in which case you want to keep the brackets but
add backquotes:
type port_status_reason = [ `ADD | `DEL | `MOD ]

Polymorphic variants are only useful if you want to use a sub/super
type of port_status_reason. Eg. if at some point you can restrict the
values to be either ADD or DEL but not MODâ




-- 
_______
Raphael



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.