From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: Re: [PATCH] build: cmake: Add input libraries to the rpath. Date: Fri, 25 Apr 2014 12:44:32 -0500 Message-ID: <87mwf9718f.fsf@gmail.com> References: <20140425071346.GA12585@debian> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wdk9E-0007fo-L1 for guix-devel@gnu.org; Fri, 25 Apr 2014 13:42:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wdk99-000251-WC for guix-devel@gnu.org; Fri, 25 Apr 2014 13:42:52 -0400 Received: from mail-ie0-x231.google.com ([2607:f8b0:4001:c03::231]:51138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wdk99-00024q-Qm for guix-devel@gnu.org; Fri, 25 Apr 2014 13:42:47 -0400 Received: by mail-ie0-f177.google.com with SMTP id rl12so3957827iec.8 for ; Fri, 25 Apr 2014 10:42:47 -0700 (PDT) In-Reply-To: <20140425071346.GA12585@debian> (Andreas Enge's message of "Fri, 25 Apr 2014 09:13:46 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Andreas Enge Cc: guix-devel@gnu.org Andreas Enge writes: > In a discussion we had yesterday, Ludovic mentioned the need to pass a > special flag to the cmake configure phase to modify the rpath of installed > libraries, as done for the package slim. I then noticed I needed the same > flag for clucene. The attached patch applies it globally in the cmake build > system. We can't set CMAKE_SKIP_BUILD_RPATH=OFF as it prevents tests from working, since the executables and libraries would not have references to libraries in the build tree (I ran the lapack build e.g. with your patch, and all the tests fail). > This should also avoid the need for the add-libs-to-runpath phase > in the gmsh package Eric Bavier posted yesterday. > > In slim, there is another flag: > ;; Don't build libslim.so, because then the build > ;; system is unable to set the right RUNPATH on the > ;; 'slim' binary. > "-DBUILD_SHARED_LIBS=OFF" > I wonder if we should instead use another of the rpath setting variables > given at > http://www.cmake.org/Wiki/CMake_RPATH_handling > > Moreover, libclucene-core.so needs to be linked to libclucene-shared.so.1 > from the same package. Here we usually employ patchelf, but maybe yet again > a cmake flag could solve the problem directly. > > Comments from cmake specialists are very welcome! I wouldn't necessarily count myself as a cmake specialist, but I work with it a bit in my day job. Your post prompted me to look into this matter a bit more. I found for the gmsh package I posted yesterday that I could add the following to #:configuration-flags instead of using the add-libs-to-runpath phase:: "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON" ,(string-append "-DCMAKE_INSTALL_RPATH=" (assoc-ref %outputs "out") "/lib") I would defer to the cmake wiki page you linked above for a full explanation, but briefly: The CMAKE_INSTALL_RPATH_USE_LINK_PATH tells cmake to include in the installed rpath all of the directories of libraries it has linked into the library or executable, and the CMAKE_INSTALL_RPATH tells cmake that in addition there are libraries in the current project whose directory also needs to be added to the rpath. I tried substituting the above two flags in for the lapack, gmsh, and slim builds, and the RUNPATHS seem to be at least as good as when using the manual augment-rpath method. -- `~Eric