Bug 891909

Summary: Can't make install with non-standard prefix as non-root
Product: [Community] Virtualization Tools Reporter: Matthew Booth <mbooth>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Booth 2013-01-04 12:24:53 UTC
./configure ... -prefix=$(pwd)/install-root
make install

I have found failures in the ocaml and python directories. There are probably others, but I stopped looking.

In the ocaml directory, the issue is:

  $(OCAMLFIND) install \
    -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
    guestfs \
    META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli

It tries to install to $(OCAMLLIB), which was obtained from 'ocamlc -where', and therefore points to the system location rather than a directory under $(prefix). Note that DESTDIR is orthoganal to this issue.

Similarly, the issue in the python directory relates to the use of PYTHON_INSTALLDIR which was obtain from the system tool, and is therefore not a directory under $(prefix).

Comment 1 Richard W.M. Jones 2013-01-16 08:49:28 UTC
Yeah I suspect there are lots of issues with using a prefix.
We have never tested this.  (DESTDIR OTOH *does* work, since that's
what we use to build RPMs).

Anyhow, patches welcome!

(In reply to comment #0)
> In the ocaml directory, the issue is:
> 
>   $(OCAMLFIND) install \
>     -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
>     guestfs \
>     META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
> 
> It tries to install to $(OCAMLLIB), which was obtained from 'ocamlc -where',
> and therefore points to the system location rather than a directory under
> $(prefix). Note that DESTDIR is orthoganal to this issue.

About this, I don't really think you would want this to
obey $(prefix).  The correct place to install OCaml libraries
is in `ocamlc -where`.  If you install them some other place
then you end up having to set environment variables.

Comment 2 Daniel Berrangé 2013-01-18 15:35:39 UTC
(In reply to comment #1)
> > In the ocaml directory, the issue is:
> > 
> >   $(OCAMLFIND) install \
> >     -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
> >     guestfs \
> >     META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
> > 
> > It tries to install to $(OCAMLLIB), which was obtained from 'ocamlc -where',
> > and therefore points to the system location rather than a directory under
> > $(prefix). Note that DESTDIR is orthoganal to this issue.
> 
> About this, I don't really think you would want this to
> obey $(prefix).  The correct place to install OCaml libraries
> is in `ocamlc -where`.  If you install them some other place
> then you end up having to set environment variables.

IMHO if you are trying to build into a non-standard prefix, then setting environment variables is to be expected. eg if you build into $HOME/libguestfs you'll already need to set $PATH, $LD_LIBRARY_PATH for the binaries/libraries. Setting other things like PERL5LIB, PYTHONPATH, and whatever for OCAML is totally reasonable.