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

Re: [MirageOS-devel] Help using V1.CLOCK



On 2 Sep 2014, at 21:33, Jacob Mitchell <jacob.d.mitchell@xxxxxxxxx> wrote:

> Thanks, Dave.
> 
> On Tue, Sep 2, 2014 at 1:09 PM, Dave Scott <Dave.Scott@xxxxxxxxxx> wrote:
>> Hi,
>> 
>> On 2 Sep 2014, at 20:48, Jacob Mitchell <jacob.d.mitchell@xxxxxxxxx> wrote:
>> 
>>> Goal: print the current time to the console; repeat until termination.
>>> 
>>> I think I'm close, but when I call "make" the compiled main.ml file
>>> results in an "Unbound value clock" error. Refer to
>>> https://gist.github.com/anonymous/90f4107cf5008b12d356 for my source
>>> code, the main.ml file, and the build log.
>>> 
>>> Any pointers? I haven't found any tests or sample code to demonstrate
>>> how to use non-polymorphic first-class modules like CLOCK, TIME, and
>>> RANDOM.
>> 
>> It looks to me like a mismatch between the generated code (in main.ml) and 
>> the mirage-clock code. The other devices (block, network, console) have a 
>> ‘connect’ function to connect to an instance, but the clock[1] is a 
>> singleton. So I think we just need to omit all references to “clock” (the 
>> instance) in the generated fragment:
>> 
>>>>>> 
>> module M1 = Unikernel.Main(Console)(Clock)
>> 
>> let t1 () =
>>  clock () >>= function
>>  | `Error e -> fail (Failure "clock")
>>  | `Ok clock ->
>>  console1 () >>= function
>>  | `Error e -> fail (Failure "console1")
>>  | `Ok console1 ->
>>  M1.start console1 clock
>> <<<<
>> 
> 
> The problem may extend to first-class modules that aren't DEVICEs
> (e.g. RANDOM). I ran into the same sort of error when I tried printing
> a random int on each line instead of the current time. The code I
> tried follows:

Hm, yes I see what you mean.

I have a tentative fix here:

https://github.com/mirage/mirage/pull/290

You could try it by

opam remove mirage
opam pin git://github.com/djs55/mirage#clock-random
opam install mirage

and then re-run ‘mirage configure —unix’

Cheers,
Dave
_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

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