qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Ross <justin.r...@gmail.com>
Subject Re: Dynamic language install and CMAKE_INSTALL_PREFIX
Date Thu, 05 Dec 2013 20:26:23 GMT
On Thu, Dec 5, 2013 at 1:57 PM, Rafael Schloming <rhs@alum.mit.edu> wrote:
> The primary benefit is that the build will adapt itself to the user's
> environment. If the user has some custom python/ruby interpreter in their
> path, it will configure and built itself against it and get the user up and
> running right away. This makes for a very simple and idiot proof README for
> someone wanting to get up and running quickly from a source build, and for
> much the same reason it is also very handy for testing. I depend on it
> myself quite a bit since I have a number of differently configured VMs that
> I use for install testing, and for each one I can simply log in and use the
> same incantation and be confident I'm running/testing the code that I
> expect. There is also a second order testing benefit since having a dirt
> simple and robust build option lets us give a source tarball to other
> people to test easily and not have to explain to them how to set up custom
> search paths for each language before they can get bootstrapped into
> running test code.
> The drawbacks that have been pointed out are that when you do specify a
> CMAKE_INSTALL_PREFIX, it is unintuitive for things to be placed outside
> that prefix, and this can happen if the QUERIED_LOCATION for a given
> interpreter happens to be outside the specified prefix. It's also been
> pointed out that if you happen to have an rpm installed version of proton
> then with the existing trunk behaviour you could could end up accidentally
> overwriting it since rpm installs proton code into the QUERIED_LOCATION
> also.

Yes, indeed.  These are coming from me.  I want:

1. A relatively easy way to do test builds under a single prefix.
What's there now requires a tediously long command line that repeats
the prefix for each binding, and my scripts would surely break if
someone added a new binding.

2. A safely isolated default prefix: It's more than "you could end up
accidentally overwriting". It's really quite likely, because the
out-of-the-box, no-extra-steps behavior will write to OS-reserved
locations.  Down below you talk about doing harm.  *This* is harm.

> Based on my reading, the change you've pointed to removes the ability to
> install directly to the QUERIED_LOCATION and instead uses the
> CONSTRUCTED_LOCATION. It also adds a consistent control interface for
> providing a custom location, i.e. the {LANG}_INSTALL_PREFIX variables.
> Assuming I've read this correctly, I have the following comments.
> First, I'm not ok with losing the ability to install directly to the
> queried location. I don't mind if it's not the default, but I want a simple
> and easy way to get back that behaviour as it is of significant value in
> the scenarios I've mentioned above.

As a note in passing (since I'm not really proposing you change back):
most autotools- or cmake-based projects don't have this behavior, and
we all get along fine.  For instance, qpid-cpp has for a long time.
That's because in the end it really isn't difficult to explain to
users that they need to edit their interpreter's search path to match
the install path they choose.  All the value you get in those test
scenarios is still easily had by doing this.  Indeed, that's why all
those other projects haven't felt pressure to add query-based install

> Second, I think it's important to realize that the CONSTRUCTED_LOCATION is
> almost guaranteed to be meaningless and quite possibly harmful if it is at
> all different from the QUERIED_LOCATION. To understand this you can take a
> look at the values from example 1 above. The queried interpreter is the
> system interpreter installed under /usr, but the binding code is installed
> under /usr/local. In the best case scenario, this code will never be found
> because nothing under /usr/local is in the default python search path. In
> the worst case scenario there may be other python interpreters installed
> under /usr/local that will find and attempt to load the code but will fail
> because the code was built against a differently configured python (the
> python version could be different, or it could even be the same version but
> with a different build configuration).

I think this is getting things quite backward.  It's not meaningless,
because it's a well-known location.  It's an *expected* target for
integration.  There's tons of existing practice built around it.

It's not really harmful, either.  The default prefix puts it in a well
isolated place (isolated from /usr and /opt) and furthermore a place
that is reserved for such installs.  If you install your interpreter
to /usr/local, you can reasonably expect it to pick up library code
under /usr/local.  That's fair play.  It's also fair to expect people
to add /usr/local library code to their system library path as an
explicit opt-in step.

These are well understood rules of the road.  The danger isn't in
following them; it's in violating them.

> Third, the custom location doesn't actually give you full control over
> where the module is installed because it appends a portion of the queried
> location. This strikes me as the wrong thing to do in all the scenarios I
> can think of where you'd want to supply a custom location. For instance, in
> Example 3 above, I might have my python path already pre-configured to
> search in /home/rhs/modules for stuff to load, however there is no way for
> me to tell the build to install the binding there, if I supply that it will
> end up going under /home/rhs/modules/lib64/python2.6/site-packages. The
> other scenario I can think of here is doing an rpm build, and in that case
> you'd want to directly pass in the %{python_sitelib} macro which will
> already include the lib64/python2.6/site-packages portion.

I totally agree here!

> So overall I'd say this change should have some kind of switch to control
> whether the QUERIED_LOCATION is used directly, and I'd argue that for the
> CUSTOM_LOCATION we should just pass through directly what the user supplies
> and not attempt to merge it with the queried value. As for the
> CONSTRUCTED_LOCATION, it's worth noting that we don't necessarily need to
> compute that either, we could just pick an arbitrary location, e.g.
> ${CMAKE_INSTALL_PREFIX}/lib64/proton-bindings or some such thing.

I agree.  One minor difference is that I do think it is better to use
a computed value when the interpreter in question gives us a good way
to get prefixed paths.  Python does this, and we should let it carry
on this way.  The priority, in my mind, is to be conventional, wrt to
the interpreter *and* the OS when you can.

Choosing a safe default, with proper isolation, has to be the thing to focus on.


View raw message