From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Subject: bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH Date: Mon, 03 Nov 2014 21:44:54 +0800 Message-ID: <87sii02yax.fsf@gmail.com> References: <877fzdu45q.fsf@gmail.com> <87d295i556.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlHxP-00074E-KQ for bug-guix@gnu.org; Mon, 03 Nov 2014 08:46:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlHxK-0004IC-Tr for bug-guix@gnu.org; Mon, 03 Nov 2014 08:46:07 -0500 Received: from debbugs.gnu.org ([140.186.70.43]:49710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlHxK-0004I6-Qu for bug-guix@gnu.org; Mon, 03 Nov 2014 08:46:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XlHxK-0007fP-7u for bug-guix@gnu.org; Mon, 03 Nov 2014 08:46:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87d295i556.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 18926@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > =E5=AE=8B=E6=96=87=E6=AD=A6 skribis: > >> if CMAKE_INSTALL_LIBDIR not set to `lib`, GNUInstallDirs.cmake will inst= all >> libraries files to $out/lib64. > > I found several CMake-built libraries on x86_64 (graphite2, openjpeg, > qjson) that all use lib/, not lib64/. > > Then I found one counterexample, libftdi; however, setting > CMAKE_INSTALL_LIBDIR=3Dlib doesn=E2=80=99t make any different: it still i= nstalls > libraries in $out/lib64. Any idea? libftdi (not using GNUInstallDirs.cmake) handle this itself by set LIB_SUFFIX, look like we have to set it specifically. > > Here=E2=80=99s the patch I tried: > > diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-s= ystem.scm > index 74b4f01..b1598dd 100644 > --- a/guix/build/cmake-build-system.scm > +++ b/guix/build/cmake-build-system.scm > @@ -53,6 +53,8 @@ > build-type)) > '()) > ,(string-append "-DCMAKE_INSTALL_PREFIX=3D" out) > + ;; Install libraries to $prefix/lib, not $prefix/lib64. > + "-DCMAKE_INSTALL_LIBDIR=3Dlib" > ;; add input libraries to rpath > "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=3DTRUE" > ;; add (other) libraries of the project itself to rpath > > According to , > LIBRARY_OUTPUT_PATH might be better for this, no? no, this is for build phase. > >> if CMAKE_PREFIX_PATH not set to PATH of `inputs`, cmake will unable to >> find cmake modules of inputs. > > You=E2=80=99re talking about .cmake files, right? yes, but now I find out that they can under both lib/cmake and share/cmake. > > Could you try the attached patch and report back? > > From 536c143997fa146dc77d6e8defc24032452e5a4c Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Ludovic=3D20Court=3DC3=3DA8s?=3D > Date: Sun, 2 Nov 2014 23:54:28 +0100 > Subject: [PATCH] gnu: cmake: Add search paths for > CMAKE_{INCLUDE,LIBRARY,MODULE}_PATH. > > * gnu/packages/cmake.scm (cmake)[native-search-paths]: New field. > * guix/build/cmake-build-system.scm (configure): Remove 'setenv' calls > for "CMAKE_LIBRARY_PATH" and "CMAKE_INCLUDE_PATH". > --- > gnu/packages/cmake.scm | 19 +++++++++++++++++++ > guix/build/cmake-build-system.scm | 2 -- > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm > index 63805ef..e0349be 100644 > --- a/gnu/packages/cmake.scm > +++ b/gnu/packages/cmake.scm > @@ -100,6 +100,25 @@ > ("expat" ,expat) > ("bzip2" ,bzip2) > ("libarchive" ,libarchive))) > + > + (native-search-paths > + (list > + ;; Search path used by the 'FIND_XXX' functions. > + (search-path-specification > + (variable "CMAKE_PROGRAM_PATH") > + (directories '("bin"))) > + (search-path-specification > + (variable "CMAKE_INCLUDE_PATH") > + (directories '("include"))) > + (search-path-specification > + (variable "CMAKE_LIBRARY_PATH") > + (directories '("lib" "lib64"))) > + > + ;; Search path used by 'FIND_PACKAGE' and 'INCLUDE'. > + (search-path-specification > + (variable "CMAKE_MODULE_PATH") > + (directories '("lib/cmake"))))) > + > (home-page "http://www.cmake.org/") > (synopsis "Cross-platform build system") > (description > diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-s= ystem.scm > index b1598dd..766797e 100644 > --- a/guix/build/cmake-build-system.scm > +++ b/guix/build/cmake-build-system.scm > @@ -60,8 +60,6 @@ > ;; add (other) libraries of the project itself to rpath > ,(string-append "-DCMAKE_INSTALL_RPATH=3D" out "/lib") > ,@configure-flags))) > - (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) > - (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH")) > (format #t "running 'cmake' with arguments ~s~%" args) > (zero? (apply system* "cmake" args))))) >=20=20 > --=20 > 2.1.2 thanks for the patch, I have apply it, but it does not work. because libqtxdg have qtxdg-config.cmake in $out/share/cmake/qt5xdg. after add CMAKE_PREFIX_PATH with: (search-path-specification (variable "CMAKE_PREFIX_PATH") (directories '(""))) I could get liblxqt(use libqtxdg) build ok. and by setting CMAKE_PREFIX_PATH, I think we can get rid of CMAKE_PROGRAM_PATH, CMAKE_INCLUDE_PATH, and maybe CMAKE_LIBRARY_PATH. see: http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html. > > >> I find this when packaging https://github.com/lxdg/libqtxdg. > > It=E2=80=99s 404. oh, sorry, it's https://github.com/lxde/libqtxdg and here is the packages I'm working on: --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=lxqt.scm Content-Transfer-Encoding: base64 KGRlZmluZS1tb2R1bGUgKGx4cXQpCiAgIzp1c2UtbW9kdWxlIChndWl4IGxpY2Vuc2VzKQogICM6 dXNlLW1vZHVsZSAoZ3VpeCBwYWNrYWdlcykKICAjOnVzZS1tb2R1bGUgKGd1aXggZG93bmxvYWQp CiAgIzp1c2UtbW9kdWxlIChndWl4IHV0aWxzKQogICM6dXNlLW1vZHVsZSAoZ3VpeCBidWlsZC1z eXN0ZW0gY21ha2UpCiAgIzp1c2UtbW9kdWxlIChnbnUgcGFja2FnZXMpCiAgIzp1c2UtbW9kdWxl IChnbnUgcGFja2FnZXMgcXQpCiAgIzp1c2UtbW9kdWxlIChnbnUgcGFja2FnZXMgcGtnLWNvbmZp ZykpCgooZGVmaW5lLXB1YmxpYyBsaWJxdHhkZwogIChwYWNrYWdlCiAgICAobmFtZSAibGlicXR4 ZGciKQogICAgKHZlcnNpb24gIjEuMC4wIikKICAgIChzb3VyY2UKICAgICAob3JpZ2luCiAgICAg ICAobWV0aG9kIHVybC1mZXRjaCkKICAgICAgICh1cmkgKHN0cmluZy1hcHBlbmQgImh0dHA6Ly9s eHF0Lm9yZy9kb3dubG9hZHMvIiBuYW1lICIvIiB2ZXJzaW9uICIvIgogICAgICAgICAgICAgICAg ICAgICAgICAgICBuYW1lICItIiB2ZXJzaW9uICIudGFyLnh6IikpCiAgICAgICAoc2hhMjU2CiAg ICAgICAgKGJhc2UzMgogICAgICAgICAiMXFnMmhqZDB5YmdsdnB4eXgzNTFseG1zMjVuY2lpcHlp bHdwZjdnNDJ6NXdnNjJqMnhhZCIpKSkpCiAgICAoYnVpbGQtc3lzdGVtIGNtYWtlLWJ1aWxkLXN5 c3RlbSkKICAgIChhcmd1bWVudHMKICAgICBgKCM6dGVzdHM/ICNmIDsgZmFpbGVkCiAgICAgICAj OmNvbmZpZ3VyZS1mbGFncyAnKCItRENNQUtFX0lOU1RBTExfTElCRElSPWxpYiIKICAgICAgICAg ICAgICAgICAgICAgICAgICAgIi1EVVNFX1FUNT1PTiIKICAgICAgICAgICAgICAgICAgICAgICAg ICAgIi1EQlVJTERfVEVTVFM9T04iKSkpCiAgICAoaW5wdXRzCiAgICAgYCgoInF0IiAscXQpKSkK ICAgIChob21lLXBhZ2UgImh0dHA6Ly9seHF0Lm9yZy8iKQogICAgKHN5bm9wc2lzICJRdCBpbXBs ZW1lbnRhdGlvbiBvZiBmcmVlZGVza3RvcCB4ZGcgc3BlY3MiKQogICAgKGRlc2NyaXB0aW9uICJG SVhNRSIpCiAgICAobGljZW5zZSBsZ3BsMi4xKykpKQogIAoKKGRlZmluZS1wdWJsaWMgbGlibHhx dAogIChwYWNrYWdlCiAgICAobmFtZSAibGlibHhxdCIpCiAgICAodmVyc2lvbiAiMC44LjAiKQog ICAgKHNvdXJjZQogICAgIChvcmlnaW4KICAgICAgIChtZXRob2QgdXJsLWZldGNoKQogICAgICAg KHVyaSAoc3RyaW5nLWFwcGVuZCAiaHR0cDovL2x4cXQub3JnL2Rvd25sb2Fkcy9seHF0LyIgdmVy c2lvbiAiLyIKICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSAiLSIgdmVyc2lvbiAiLnRh ci54eiIpKQogICAgICAgKHNoYTI1NgogICAgICAgIChiYXNlMzIKICAgICAgICAgIjBrcDM2dmI4 emNhYTFya2tkcHFtOTY2d2g3NGw5amRsYTJtaHJjdzM4aG1hMWtpYWY1NHIiKSkpKQogICAgKGJ1 aWxkLXN5c3RlbSBjbWFrZS1idWlsZC1zeXN0ZW0pCiAgICAoYXJndW1lbnRzCiAgICAgYCgjOnRl c3RzPyAjZiA7IG5vIGNoZWNrIHRhcmdldAogICAgICAgIzpjb25maWd1cmUtZmxhZ3MgJygiLURV U0VfUVQ1PU9OIikpKQogICAgKG5hdGl2ZS1pbnB1dHMgYCgoInBrZy1jb25maWciICxwa2ctY29u ZmlnKSkpCiAgICAoaW5wdXRzCiAgICAgYCgoInF0IiAscXQpCiAgICAgICAoImxpYnF0eGRnIiAs bGlicXR4ZGcpKSkKICAgIChob21lLXBhZ2UgImh0dHA6Ly9seHF0Lm9yZy8iKQogICAgKHN5bm9w c2lzICJDb3JlIHV0aWxpdHkgbGlicmFyeSBmb3IgYWxsIExYREUtUXQgY29tcG9uZW50cyIpCiAg ICAoZGVzY3JpcHRpb24gIkZJWE1FIikKICAgIChsaWNlbnNlIGxncGwyLjErKSkpCgo= --=-=-=--