installation notes: ocamljs, orpc on ubuntu 9.04

7 views
Skip to first unread message

ben kuin

unread,
Nov 18, 2009, 2:32:05 PM11/18/09
to ocamljs discuss
hi
after sneaking around the skydeck blog and its source projects for too
long, I finally decided to do it. Installing the ocamljs orpc combo.

Several hours and a stiff neck later I come to the conclusion that the
installation process is a bit harder than expected.

So here are a few notes. Maybe they are helpfull for another ubuntu
user. Maybe you see stupid thing on my behalf and help me to correct
it.

All in all I have to say that working (not coding) with ocaml
libraries feels like walking on broken glas.

Ok a quick recapitulation of the biggest stumble blocks so far:

my host:
>$ cat /etc/lsb-release
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION="Ubuntu 9.04"

== OCAMLJS
Ocaml version
------------------
1. the most recent ocaml rel 3.11.1 is not working.
2. the next compatible version is 3.11.0 which in turn can not be
installed by godi. (I've tried it with './bootstrap -prefix $HOME/godi
-section 3.11.0' )

3. ocamljs / ocaml / godi
-----------------------------
I was not happy the idea to wipe godi of my system so I tried to
install it parallel and separate godi and the base system (ocaml). It
didn't work because of later problems with ocamlbuild and it seemed
complicated to really to it right, so I removed everything ocaml
related including godi and started from scratch.

4. Installation of Ocaml 3.11.0 from scratch
-----------------------------------------------------
the clean new installation of 3.11.0, I'm used to do it with
./configure
make world
make opt
sudo make install
wasn't enough if you want install ulex later. The problem have
something to do with ocamlbuild, because there were errors about
missing ocamlbuild.cmx. Also messages like:
:make inconsistent assumptions over implementation Ocamlbuild_pack:
Simply running make in the 'ocamlbuild' directory of ocaml-3.11.0 and
manualy copying the file didn't solve the problem. After after a lot
of try and error and running 'make all' and 'make world.opt' it
worked.so you have to install ocaml-3.11.0:
./configure
make all
make world.opt
sudo make install

5. Installation of ulex-1.1
--------------------------------
Again: In order to build ulex from scratch you have to make sure the
file ocamlbuild.cmx is in in your library ( eg: /usr/local/lib/ocaml/
ocamlbuild/ocamlbuild.cmx)

6. Installation of ocamljs
--------------------------------
I couldn't use the latest code from svn because of unsolvable errors
when compiling the examples ('make examples'):
File "canvas.ml", line 25, characters 22-35:
Error: Unbound value Ocamljs.jsfun

(maybe I'll make a separate post for this error)

Using the release ocamljs-0.2 solved the problem.

7. Installation of ocamlnet (orpc2)
-----------------------------------
Ok, next pain point: orpc needs ocamlnet1, which seems to be obsolete
nowadays. But the much worse problem was that I couldn't build
ocamlnet 2.2.9, 2.2.8, 2.2.7, ... always the same error:
rpclocal.c: In function ‘unix_get_peer_credentials’:
rpclocal.c:40: error: storage size of ‘credentials’ isn’t known
rpclocal.c:42: error: invalid application of ‘sizeof’ to incomplete
type ‘struct ucred’
rpclocal.c:40: warning: unused variable ‘credentials’
rpclocal.c: In function ‘unix_peek_peer_credentials’:
rpclocal.c:91: error: dereferencing pointer to incomplete type
rpclocal.c:135: error: dereferencing pointer to incomplete type
rpclocal.c:136: error: dereferencing pointer to incomplete type
rpclocal.c:91: warning: unused variable ‘buf’
make[1]: *** [rpclocal.o] Error 2

After hours I've spent trying different things out I found one line to
add on top of rpclocal.c, to make it work:
#define _GNU_SOURCE

the next error I get is something I'm not able to solve, so the
journey end with:

error: Unbound type constructor Nethttpd_services.dynamic_service

(maybe I'll make a separate post for this error)

phew




Jake Donham

unread,
Nov 18, 2009, 3:02:19 PM11/18/09
to ocamljs...@googlegroups.com
On Wed, Nov 18, 2009 at 11:32 AM, ben kuin <ben...@gmail.com> wrote:
> after sneaking around the skydeck blog and its source projects for too
> long, I finally decided to do it. Installing the ocamljs orpc combo.
>
> Several hours and a stiff neck later I come to the conclusion that the
> installation process is a bit harder than expected.

HI Ben, thanks for the attempt, sorry that it was so painful.

>  DISTRIB_DESCRIPTION="Ubuntu 9.04"

I have not tried to build any of this on Ubuntu 9.04, but I think I
can get a VMWare image of it so I will try that.

> == OCAMLJS
> Ocaml version
> ------------------
> 1. the most recent ocaml rel 3.11.1 is not working.

On Ubuntu you mean? The trunk ocamljs should work with 3.11.1 (modulo
the examples problem below).

> 3. ocamljs / ocaml / godi
> -----------------------------
> I was not happy the idea to wipe godi of my system so I tried to
> install it parallel and separate godi and the base system (ocaml). It
> didn't work because of later problems with ocamlbuild and it seemed
> complicated to really to it right, so I removed everything ocaml
> related including godi and started from scratch.

I don't have any advice on using GODI with ocamljs; I haven't tried to
make a GODI package for it.

> 4. Installation of Ocaml 3.11.0 from scratch
> -----------------------------------------------------
> the clean new installation of 3.11.0, I'm used to do it with
>  ./configure
>  make world
>  make opt
>  sudo make install
> wasn't enough if you want install ulex later.  The problem have
> something to do with ocamlbuild, because there were errors about
> missing ocamlbuild.cmx. Also messages like:
>  :make inconsistent assumptions over implementation Ocamlbuild_pack:

This sounds like maybe you had some old stuff from the GODI install
lying around. You might try configuring to a fresh prefix path to be
sure there is nothing else around. It works OK for me (on Fedora); I
will attempt on Ubuntu and see if there is some problem there.

> 6. Installation of ocamljs
> --------------------------------
> I couldn't use the latest code from svn because of unsolvable errors
> when compiling the examples ('make examples'):
>  File "canvas.ml", line 25, characters 22-35:
>  Error: Unbound value Ocamljs.jsfun
>
> (maybe I'll make a separate post for this error)
>
> Using the release ocamljs-0.2 solved the problem.

Sorry, I made a breaking API change and didn't update the examples
yet. I will try to get to that ASAP.

Aside from this problem, I recommend the trunk over the 0.2 release
since there have been many improvements. I make no claims about
stability of the trunk or the 0.2 version. (Actually I am surprised
you even got it to compile on 3.11.x.)

> 7. Installation of ocamlnet (orpc2)
> -----------------------------------
> Ok, next pain point: orpc needs ocamlnet1, which seems to be obsolete
> nowadays.

Huh, what makes you say that? I develop orpc with 2.2.9.

> But the much worse problem was that I couldn't build
> ocamlnet 2.2.9, 2.2.8, 2.2.7, ... always the same error:
>  rpclocal.c: In function ‘unix_get_peer_credentials’:
> rpclocal.c:40: error: storage size of ‘credentials’ isn’t known
> rpclocal.c:42: error: invalid application of ‘sizeof’ to incomplete
> type ‘struct ucred’
> rpclocal.c:40: warning: unused variable ‘credentials’
> rpclocal.c: In function ‘unix_peek_peer_credentials’:
> rpclocal.c:91: error: dereferencing pointer to incomplete type
> rpclocal.c:135: error: dereferencing pointer to incomplete type
> rpclocal.c:136: error: dereferencing pointer to incomplete type
> rpclocal.c:91: warning: unused variable ‘buf’
> make[1]: *** [rpclocal.o] Error 2
>
> After hours I've spent trying different things out I found one line to
> add on top of rpclocal.c, to make it work:
>  #define _GNU_SOURCE

This sounds like an Ubuntu thing. Not sure what it is all about. You
might try the Ocamlnet list at

http://sourceforge.net/mailarchive/forum.php?forum_name=ocamlnet-devel

> the next error I get is something I'm not able to solve, so the
> journey end with:
>
>  error: Unbound type constructor Nethttpd_services.dynamic_service
>
> (maybe I'll make a separate post for this error)

Huh, you must somehow not have Ocamlnet installed correctly; that is a
standard type. I will double-check the findlib dependencies though.

> phew

Again, sorry for your pain, and thanks for sticking with it. If you
are still interested, I'd like to help you get things built and figure
out how to make the process easier for the next person.

Jake

ben kuin

unread,
Nov 18, 2009, 4:44:27 PM11/18/09
to ocamljs discuss
thanks for the quick reply

> > Ok, next pain point: orpc needs ocamlnet1, which seems to be obsolete
> Huh, what makes you say that? I develop orpc with 2.2.9.
Sorry for the typo, I meant netcgi1. If you do a fresh svn checkout
from , you see netcgi1 resides in a folder 'OBSOLETE' (lib-ocamlnet2/
trunk/code/OBSOLETE/netcgi1).
Netcgi1 is not going to be installed the latest svn version, the
latest release ocamlnet-2.2.9 is needed.

> > error: Unbound type constructor Nethttpd_services.dynamic_service
> Huh, you must somehow not have Ocamlnet installed correctly; that is a
> standard type. I will double-check the findlib dependencies though.

Would you mind give me a hint how I can find out what is wrong with my
ocamlnet installation?

On Nov 18, 9:02 pm, Jake Donham <jake.don...@gmail.com> wrote:

Dave Benjamin

unread,
Nov 18, 2009, 4:48:49 PM11/18/09
to ocamljs...@googlegroups.com, ocamljs discuss
The svn trunk of ocamlnet is version 3, which isn't released yet.
Netcgi1 is being phased out with this version, along with a few other
BC-breaking changes.

--
Dave Benjamin
> --
>
> You received this message because you are subscribed to the Google
> Groups "ocamljs discuss" group.
> To post to this group, send email to ocamljs...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ocamljs-discuss?hl=en
> .
>
>

Jake Donham

unread,
Nov 18, 2009, 4:51:31 PM11/18/09
to ocamljs...@googlegroups.com
On Wed, Nov 18, 2009 at 1:44 PM, ben kuin <ben...@gmail.com> wrote:
>> > Ok, next pain point: orpc needs ocamlnet1, which seems to be obsolete
>> Huh, what makes you say that? I develop orpc with 2.2.9.
> Sorry for the typo, I meant netcgi1. If you do a fresh svn checkout
> from , you see netcgi1 resides in a folder 'OBSOLETE' (lib-ocamlnet2/
> trunk/code/OBSOLETE/netcgi1).
> Netcgi1 is not going to be installed the latest svn version, the
> latest release ocamlnet-2.2.9 is needed.

Ah, OK. Ocamlnet 3 is not released yet so I am going to stick with
2.2.9 for now. But I will certainly upgrade orpc for Ocamlnet 3.

>> >  error: Unbound type constructor Nethttpd_services.dynamic_service
>> Huh, you must somehow not have Ocamlnet installed correctly; that is a
>> standard type. I will double-check the findlib dependencies though.
>
> Would you mind give me a hint how I can find out what is wrong with my
> ocamlnet installation?

Well, you might check the compile line for whatever file gives you
this error, make sure the right directory is included with -I, etc. It
is useful to use ocamlfind ocamlc -verbose to see exactly what is
passed to ocamlc.

Jake

ben kuin

unread,
Nov 18, 2009, 5:50:57 PM11/18/09
to ocamljs discuss
>> > error: Unbound type constructor Nethttpd_services.dynamic_service
>> Huh, you must somehow not have Ocamlnet installed correctly; that is a
>> standard type.

I think I found the solution...

7. Installation of ocamlnet (orpc2)
-----------------------
You have to explicitely enable the nethttpd library on ocamlnet-2.2.9,
otherwise you get the following error from 'make' when running the
orpc2 installation:
+ ocamlfindjs ocamlc -c -package jslib -package ulex -syntax \
camlp4o -o orpc_js_server.cmi orpc_js_server.mli
File "orpc_js_server.mli", line 40, characters 36-97:
Error: Unbound type constructor Nethttpd_services.dynamic_service

therefore, before running 'make all', configure with:
$ ./configure -with-nethttpd

and voila, orpc2 finished without errors - yay.

Ok - next step, install orpc2 examples

$ make examples
...
+ ocamlfindjs ocamldep -package lwt-equeue -package netplex -package
orpc-onc -modules client.ml > client.ml.depends
ocamlfind: Package `ssl' not found - Required by `lwt-equeue.ssl'
Command exited with code 2.
make[2]: *** [all] Error 10

next problem: installing ssl for ocaml, hmmm...


ben kuin

unread,
Nov 18, 2009, 6:19:47 PM11/18/09
to ocamljs discuss
in order to build the examples in the orpc2 folder, you have to
install ocaml-ssl and enable it in ocamlnet:

ocaml-ssl 0.4.3 from http://sourceforge.net/projects/savonet/files/
$ ./configure && make && install

then in ocamlnet-2.2.9
$ ./configure -with-net lekuin:~/install/ocamljs/openssl-0.9.8l
httpd -enable-ssl && make all && make opt && sudo make install

finally in orpc2
$ sudo make uninstall && make clean && make all && sudo make install
$ make examples

Jake Donham

unread,
Nov 18, 2009, 7:29:28 PM11/18/09
to ocamljs...@googlegroups.com
On Wed, Nov 18, 2009 at 2:50 PM, ben kuin <ben...@gmail.com> wrote:
> You have to explicitely enable the nethttpd library on ocamlnet-2.2.9,

Oops.

> ocamlfind: Package `ssl' not found - Required by `lwt-equeue.ssl'

And oops. Huh, the whole point of the separate lwt-equeue.ssl package
was to avoid this dependency. Oh well.

I can do a better job of checking requirements in the configuration
script. If you feel like filing a bug report at

http://code.google.com/p/orpc2/issues/entry

that would help me remember to fix this. A patch would of course be
welcome as well. Thanks again for the feedback.

Jake

Jake Donham

unread,
Nov 24, 2009, 12:08:45 AM11/24/09
to ocamljs...@googlegroups.com
On Wed, Nov 18, 2009 at 4:29 PM, Jake Donham <jake....@gmail.com> wrote:
> On Wed, Nov 18, 2009 at 2:50 PM, ben kuin <ben...@gmail.com> wrote:
>> You have to explicitely enable the nethttpd library on ocamlnet-2.2.9,
>
> Oops.
>
>> ocamlfind: Package `ssl' not found - Required by `lwt-equeue.ssl'
>
> And oops. Huh, the whole point of the separate lwt-equeue.ssl package
> was to avoid this dependency. Oh well.

I have fixed these two dependency issues in the trunk. Thanks for the report.

Jake Donham

unread,
Nov 24, 2009, 12:15:45 AM11/24/09
to ocamljs...@googlegroups.com
On Wed, Nov 18, 2009 at 12:02 PM, Jake Donham <jake....@gmail.com> wrote:
> On Wed, Nov 18, 2009 at 11:32 AM, ben kuin <ben...@gmail.com> wrote:
>> 6. Installation of ocamljs
>> --------------------------------
>> I couldn't use the latest code from svn because of unsolvable errors
>> when compiling the examples ('make examples'):
>>  File "canvas.ml", line 25, characters 22-35:
>>  Error: Unbound value Ocamljs.jsfun

This is fixed in the ocamljs and orpc examples.

>> But the much worse problem was that I couldn't build
>> ocamlnet 2.2.9, 2.2.8, 2.2.7, ... always the same error:
>>  rpclocal.c: In function ‘unix_get_peer_credentials’:
>> rpclocal.c:40: error: storage size of ‘credentials’ isn’t known

This is apparently due a glibc change; the latest Ocamlnet #defines
_GNU_SOURCE to work around it, as you discovered. More at

http://sourceware.org/bugzilla/show_bug.cgi?id=6545

Thanks again for the reports.

Jake
Reply all
Reply to author
Forward
0 new messages