Hi everyone,
Thank you Bernhard for the problem analysis. For fixing the bug
upstream, I have a remark about the CMAKE_INSTALL_LIBDIR variable.
Bernhard Übelacker kirjoitti 16.5.2019 klo 0.43:
> I found this file in which CMAKE_INSTALL_RPATH gets set:
> ./CMakeLists.txt:34: set(CMAKE_INSTALL_RPATH
> "${CMAKE_INSTALL_LIBDIR}/cloudcompare")
>
> As far as I see CMAKE_INSTALL_LIBDIR is given by dh_auto_configure
> and therefore may be meant to be a relative path.
Looking at the documentation for GNUInstallDirs, CMAKE_INSTALL_*DIR
variables can be "passed to the DESTINATION options of install()
commands."[1] In that case, either relative or absolute path is accepted.
"If a full path (with a leading slash or drive letter) is given it is
used directly. If a relative path is given it is interpreted relative
to the value of the CMAKE_INSTALL_PREFIX variable."[2]
Cloudcompare does not actually use GNUInstallDirs but it does share the
variable names and therefore user expectations.
This is why I think that in general, one can not assume that
CMAKE_INSTALL_LIBDIR is either absolute or relative. Original upstream
code does the former while the proposed patch does the latter.
> +++ cloudcompare-2.10.1/CMakeLists.txt
> - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}/cloudcompare")
> + set(CMAKE_INSTALL_RPATH
> "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cloudcompare")
My solution is to use the module GNUInstallDirs. It conveniently provides
CMAKE_INSTALL_FULL_LIBDIR which is absolute and could be used for the rpath.
Pseudo diff of the suggested changes:
+include(GNUInstallDirs)
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}/cloudcompare")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}/cloudcompare")
Adopting GNUInstallDirs may induce some other bugs so it is not necessarily
appropriate for the frozen Buster, but for the upstream project I think it
is worth it. In any case, my pseudo patch is untested and one should
carefully examine the installation phase if it is applied.
Regards,
Juhani
[1] https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
[2] https://cmake.org/cmake/help/latest/command/install.html#introduction