alavrik / piqi

Piqi – universal schema language: JSON, XML, Protocol Buffers data validation and conversion
http://piqi.org
Apache License 2.0
246 stars 36 forks source link

root permissions required for make deps #1

Closed joelreymont closed 13 years ago

joelreymont commented 13 years ago

Setting PIQI_ROOT to /usr/local...

make deps make -C deps set -e; \ for i in ulex-1.1 easy-format-1.0.0 xmlm-1.0.2; do \ make -C $i; \ make -C $i install; \ done ocamlbuild -byte-plugin pa_ulex.cma ulexing.cma Finished, 1 target (0 cached) in 00:00:00. Finished, 18 targets (0 cached) in 00:00:00. ocamlbuild -byte-plugin pa_ulex.cma ulexing.cma pa_ulex.cmxa ulexing.cmxa Finished, 0 targets (0 cached) in 00:00:00. Finished, 25 targets (18 cached) in 00:00:00. ocamlbuild -byte-plugin pa_ulex.cma ulexing.cma Finished, 0 targets (0 cached) in 00:00:00. Finished, 18 targets (18 cached) in 00:00:00. cd _build && make -f ../Makefile realinstall ocamlfind install ulex ../META ulexing.mli utf8.mli ulexing.cmi utf8.cmi ulexing.cmx utf8.cmx pa_ulex.cma ulexing.a ulexing.cma ulexing.cmxa ocamlfind: Cannot mkdir /usr/local/lib/ocaml/ulex: Permission denied

alavrik commented 13 years ago

Instead of setting $PIQI_ROOT, you need to modify the following lines in the configurable section of setenv.sh. These variables tell ocamlfind where to install packages and where to look for them.

# installation and search path for OCaml libraries
OCAMLFIND_DESTDIR=$PIQI_PREFIX/lib/ocaml
OCAMLPATH=$OCAMLFIND_DESTDIR
export OCAMLFIND_DESTDIR OCAMLPATH
joelreymont commented 13 years ago

Not quite.

'make deps' tries to install ulex and some other bits using ocamlfind. When PIQI_ROOT is set to /usr/local, ocamlfind needs root permissions to install into /usr/local/.

I do want to install into /usr/local and that's what my ocamlfind uses. I'm thinking that, perhaps, there should be a dependency on or an explicit step to install ulex, etc., rather than do it as part of 'make deps'.

alavrik commented 13 years ago

Installation of ulex and other dependencies is necessary only for Piqi build. They are not used afterwards even if you intend to use Piqi for OCaml.

Btw, if you are trying out Piqi for OCaml -- I'll be changing OCaml interfaces a little bit in the next couple of days to match the existing Erlang interfaces. For instance, piqic ocaml will produce <mod>_piqi.ml instead of <mod>.ml and gen_* functions produced by piqic ocaml will take only one argument instead of two.

joelreymont commented 13 years ago

We are trying to use piqi as part of a big project since it's the only thing for OCaml that produces code compatible with Protocol Buffers. Well, the only thing I could dig up anyway.

alavrik commented 13 years ago

I'm not aware of any other OCaml implementation of Protocol Buffers.

Can the issue be closed now? Or you still have concerns about it? The only thing I can think of is the ocaml-install target in the top directory's Makefile. It still uses those ocamlfind's variables and therefore will not install OCaml libraries (i.e. piqirun) where you need them. I can introduce another config variable that will define installation path for the piqirun OCaml library.

In the meantime, you can build Piqi, then change the ocamlfind's variables and then run make ocaml-install.

joelreymont commented 13 years ago

Fair enough.

alavrik commented 13 years ago

I've just made some changes that address the reported issue and improve the build and installation procedure for OCaml in general. With the exception of a much cleaner setenv.sh, the installation procedure didn't change.

BTW, thanks for the bug report!