prefer libs build from source over the system #30
Conversation
This seems worthy of consideration. I think most of the time one would prefer to use a system installed version of a library if available. That is why the AB has the current behavior. But certainly there are times when you would want to prefer a manually installed one, as you have demonstrated. I wonder if this could be configurable somehow. It would be easy to do with an env variable, but I wonder if something more cute could be better. I am far from home currently attending YAPC::Brasil, so I can't look at this right now, but if I don't get back to it in 2 weeks, ping me again. |
Thanks, I appreciate your consideration. I think preferring the system lib is okay, if it works, but currently it is looking for libarchive.so.13 (the version installed from source) in the system location which is libarchive.so.12. It should at least look for the right library in the right location. I can help with a simplified test case if you need help reproducing this. I think the install time and run time loading will have to be consistent too, for example in this sequence:
in the last step, the using XYZ::XS should use the source built version since its XS code was linked against that version. In this sequence it could use the system lib:
though you may have problems if you are using multiple perl modules installed before and after the system lib (and thus linked against different versions). |
On Wed, Nov 13, 2013 at 10:18 AM, Graham Ollis notifications@github.comwrote:
No, I think Alien::XYZ will install and configure for a local install. The
though you may have problems if you are using multiple perl modules
|
I think there may be some confusion since my comment was "prefer libs build from source over the system", but what I should have said was "prefer libs build from source over the system when that is what you used when you installed your Alien::XYZ distribution". I agree with @devel-chm's comment, in that is how it SHOULD work, I think the least complicated approach is to, once
I thought @jberger was saying that the With my patch it still prefers the system lib, if that is what you used at install of
(I just tested this) |
As requested, @jberger I am pinging you on this again. My belief was that this was a fix to the intended behavior, that is that the lib used when you install I commented on some of the complexity if that wasn't the intended behavior, in the very least if you calculate at runtime which lib to use it should be consistent, as it is, it is looking for the custom built lib in the system lib location and this causes a failure if you install the system lib after |
I'm starting to lean towards accepting this patch. It's being discussed a little on #pdl and it is sinking into my head. I think that most times this patch makes more sense than the original, though edge cases exist for both. |
I think that a strong argument in favor of sticking with the lib used at install time is that is the lib that you have tested against. Presumably the system developers have packaged things up appropriately, but they may have made decisions that would prevent carefully crafted tests in the I also think this is the least surprising approach, I wouldn't expect if I was working on something totally unrelated to Perl and had to install some development libraries that my Perl scripts would stop working. Ideally it wouldn't break if you reinstalled I believe if we do accept that the system library should be used regardless of what was used during install that the pkg-config information from the share directory should not be used at all, as it very easily could conflict with what the system lib is expecting. It should probably also report install_type = system. The fact that it was reporting install_type = share and was in a code path that couldn't be reached in a system install lead me to believe that this was a bug rather than a deliberate design decision. |
On Mon, Dec 16, 2013 at 6:06 AM, Graham Ollis notifications@github.comwrote:
Interesting. Maybe Alien::XYZ could try 'use Alien::XYZ' itself
I can't think of a good case where silently substituting a system |
I just came across this issue while working on Image::Leptonica. I have a system installed liblept that is there because Tesseract OCR needs it, but the one I provide with Alien::Leptonica is newer and has more functions. This really will require further thought as it is really is a toolchain issue. There are several questions like: Do we assume that the user always wants the newest library? Should the Alien package force a preference or should that be left to the downstream of the Alien package? I can envision there being flags that can be set with either environment variables or package import tags which can indicate the preference. |
@zmughal I agree that these are all issues, and would love to see them resolved in a thoughtful way, but I do not agree that this is what this defect is about. The problem is that Alien::Base can and will use the compiler and linker flags from a built libfoo but the libfoo.so from the system if you install the operating system package after installing Alien::Libfoo. I am a bit dismayed as to why this is not considered a bug. |
Speaking with an outsider's perspective, that clearly is a bug. Raise issue? |
I see no reason to not go ahead with this PR. It is the only solution that will load the library from the shared directory whether or not a system library available. I think loading from the shared directory is a sensible default since, like @plicease said, that is what the install was tested against and is guaranteed to work. The other issues that I talked about can be addressed later as they are special cases that most people won't want[*]. Merging this PR will not preclude us from allowing users to choose between system & shared libraries if Alien::Base adds that at a later point. And to address warning users, we could try to load from each of the paths in turn, a la Is there something I'm missing? [*] I can only imagine people wanting to load the system version of a library if that version was patched to work better than the one directly from upstream. In that case, another thing to think about is library versions the same way we think about module versions, e.g., I want libz >= v1.2. |
@zmughal, if you believe this code addresses the rationale behind the PR (keep reporting right info even if system library becomes installed), you ought to merge it. If anyone feels there are further issues, they can raise them in a new issue and/or PR. |
I'm interpreting the org procedure for this requiring a majority vote
My vote on merging this PR: aye. |
I agree, of course. |
How many is a majority? |
Currently 4, since there are 6 in the Owners team. |
This statement I believe I agree with:
but beyond that, I have never been able to convince myself on either side of this argument. Therefore I abstain. 3/5 means pass right? |
prefer libs build from source over the system
One of the problems with Alien modules is the fixed assumptions This ties in with my Alien2 proposal that the job of an Alien2 I think the above means I think it is a bug. But since I don't On Sat, Aug 30, 2014 at 5:23 PM, Joel Berger notifications@github.com
|
This is the reason it took so long for someone to try to abstract it. There will likely be eventual limitations, but let's keep abstracting where possible. My original idea included version pinning as an option(ie, install version X only, vestiges of a full version selector plugin system appear in the code, though never fully realized). The primary mechanism allows for the upstream library to release a new version without the Alien:: wrapper needing a new release just for a config change. That said, it seems fair that once installed, the version be pinned to the version used when building (and testing). |
On systems without a package system, it works better --Chris |
I've opened a new issue (#45) for discussion of packaging-system matters. |
prefer libs build from source over the system
prefer libs build from source over the system
prefer libs build from source over the system
prefer libs build from source over the system
prefer libs build from source over the system
…stem Alien-Base: Alien-Base: prefer libs build from source over the system
I'm working on an Alien::Base dist, and it works with the system package and it works building from source, but if I install from source and then install the system packages, it stops working with this error:
This patch prefers the Alien::Base lib dir to the system one, and makes it work for me.