[cmake-developers] General Config.cmake file issue on ArchLinux

Stephen Kelly steveire at gmail.com
Thu Dec 6 16:02:53 EST 2012


Alexander Neundorf wrote:

> On Thursday 06 December 2012, Stephen Kelly wrote:
>> Alexander Neundorf wrote:
>> > On Thursday 06 December 2012, Stephen Kelly wrote:
>> >> Alexander Neundorf wrote:
>> >> > Let's assume /opt/foo/lib/ is a symlink to /usr/local/lib/.
>> >> > The package has been installed to /opt/foo/ and is found via
>> >> > CMAKE_PREFIX_PATH in /opt/foo/lib/cmake/Foo/FooConfig.cmake.
>> >> > Now when going up to the prefix, we will come across /opt/foo/lib/,
>> >> > which is a symlink, but everything will be fine, since going up will
>> >> > take us to /opt/foo/, from where we can correctly descend again.
>> >> 
>> >> But that works only if you don't search for anything in bin/ or
>> >> share/, right (assuming there are not appropriately similiar(!)
>> >> symlinks for those too)?
>> > 
>> > Hmm, no ?
>> > 
>> > /opt/foo/lib/cmake/Foo/../../../share/ is /opt/foo/share/, which would
>> > be correct (when the package has been installed to /opt/foo/, as said
>> > above).
>> 
>> Ok. Now I'm even more confused.
>> 
>> I thought /opt/foo/share/ is incorrect. Correct would be
>> /usr/local/share.
> 
> No. Above I wrote "has been installed to /opt/foo".

Ah, this is indeed the crucial point that I missed. Thanks.

So you're saying that the Config file is *deliberately* under a path that 
contains /opt/foo and it has been found there. However, it could also be 
found under /usr/local/ instead, and that is where it *actually* is. In that 
case it would not work, so I still think it's fragile.

I also think it's a very bad idea to install into a prefix where one of the 
directories below it is a symlink to somewhere else. I think that also 
deserves a warning.

> I.e. into /opt/foo/lib/cmake/Foo/FooConfig.cmake and e.g.
> /opt/foo/share/foo/whatever.file
> 
>> You are assuming that /opt/foo/share/ is a symlink to /usr/local/share,
>> right?
> 
> No, I'm assuming that /opt/foo/lib/ is a symlink to /usr/local/lib/.
> So that when installing FooConfig.cmake to the prefix /opt/foo/, this file
> ends up in /opt/foo/lib/cmake/Foo/FooConfig.cmake (via the symlink), which
> is the same as /usr/local/lib/cmake/Foo/FooConfig.cmake (no symlink).
> The correct one to be found is the one in /opt/foo/, which contains the
> symlink.
> 
>> That's why I wrote 'assuming there are not appropriately similiar(!)
>> symlinks for those too'. Isn't exactly that kind of assumption the source
>> of the original problem on Arch? They have a symlink for lib, but not for
>> bin.
>> 
>> Are you confused too? Am I making sense?
> 
> My confused mind thinks I'm not confused... ;-)

Ok, I think we're on the same page now in terms of what we're talking about.

The difference is though that I think your scenario is also a bad idea and 
deserving of a warning.

> 
> ...
>> > It doesn't matter whether the location which is found, has been found
>> > via the symlink or via a "normal" path. It matters whether the location
>> > where it has been found is in the correct prefix.
>> 
>> Right. 'Correct prefix' is a bit ambiguous though if there is a symlink
>> for lib/, but not for anything else. Does that make sense? Do you agree?
> 
> No, it's not ambiguous. It's the directory which was as prefix during
> installation (/opt/foo/ above).

Considering that by installing to there you end up putting files in a 
location which is *actually* not under that prefix (and can be found in the 
place where it actually is), I can't see why that would be a good idea.

Thanks,

Steve.






More information about the cmake-developers mailing list