unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cmake-build-system
@ 2015-07-05  8:52 Ricardo Wurmus
  2015-07-05 22:44 ` cmake-build-system Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Wurmus @ 2015-07-05  8:52 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

Attached is a patch for the cmake-build-system.  I have encountered a
couple of applications that failed the validate-runpath phase because
the RUNPATH was not set properly.

I found that setting BUILD_WITH_INSTALL_RPATH=TRUE helped when the
INSTALL_RPATH was also set to contain all inputs, like this:

  (string-append "-DCMAKE_INSTALL_RPATH="
                 (string-join (map (match-lambda
                                     ((name . directory)
                                      (string-append directory "/lib")))
                                   %build-inputs) ";"))

Currently, the build system only sets the INSTALL_RPATH to the output’s
“/lib” directory.

The attached patch only adds BUILD_WITH_INSTALL_RPATH=TRUE.  I’m not
sure if this is sufficient, but I think it is actually a requirement.

What do you think?

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-cmake-build-system-Enable-BUILD_WITH_INSTALL_RPATH.patch --]
[-- Type: text/x-patch, Size: 1128 bytes --]

From def7bdacbebc1969e0390674844c85982575c305 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sun, 5 Jul 2015 10:45:15 +0200
Subject: [PATCH] cmake-build-system: Enable BUILD_WITH_INSTALL_RPATH.

* guix/build/cmake-build-system.scm (configure): Set BUILD_WITH_INSTALL_RPATH
  to TRUE.
---
 guix/build/cmake-build-system.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
index f57622e..7199e51 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -55,6 +55,8 @@
                   ,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
                   ;; add input libraries to rpath
                   "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
+                  ;; link target in the build tree with the INSTALL_RPATH
+                  "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
                   ;; add (other) libraries of the project itself to rpath
                   ,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
                   ;; enable verbose output from builds
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: cmake-build-system
  2015-07-05  8:52 cmake-build-system Ricardo Wurmus
@ 2015-07-05 22:44 ` Ludovic Courtès
  2015-07-06  4:23   ` cmake-build-system Ricardo Wurmus
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2015-07-05 22:44 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

> Attached is a patch for the cmake-build-system.  I have encountered a
> couple of applications that failed the validate-runpath phase because
> the RUNPATH was not set properly.
>
> I found that setting BUILD_WITH_INSTALL_RPATH=TRUE helped when the
> INSTALL_RPATH was also set to contain all inputs, like this:
>
>   (string-append "-DCMAKE_INSTALL_RPATH="
>                  (string-join (map (match-lambda
>                                      ((name . directory)
>                                       (string-append directory "/lib")))
>                                    %build-inputs) ";"))

Ideally we would never have to do this because ld-wrapper is supposed to
take care of that.

This is in powertabeditor, right?  What happens if you build it without
this and with VERBOSE=1 (as a ‘make’ variable) and
GUIX_LD_WRAPPER_DEBUG=1 (environment variable)?  I would like to see
where the -rpath get lost or overwritten.

> The attached patch only adds BUILD_WITH_INSTALL_RPATH=TRUE.  I’m not
> sure if this is sufficient, but I think it is actually a requirement.

Unfortunately CMake has complex RPATH handling and it seems to resist
us.  It would be good to see, taking powertabeditor as an example, how
we can achieve better results.  I don’t know whether
BUILD_WITH_INSTALL_RPATH=TRUE is necessary, but I think we must first
better understand what’s going on.

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cmake-build-system
  2015-07-05 22:44 ` cmake-build-system Ludovic Courtès
@ 2015-07-06  4:23   ` Ricardo Wurmus
  0 siblings, 0 replies; 3+ messages in thread
From: Ricardo Wurmus @ 2015-07-06  4:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Ludovic Courtès <ludo@gnu.org> writes:

>> I found that setting BUILD_WITH_INSTALL_RPATH=TRUE helped when the
>> INSTALL_RPATH was also set to contain all inputs, like this:
>>
>>   (string-append "-DCMAKE_INSTALL_RPATH="
>>                  (string-join (map (match-lambda
>>                                      ((name . directory)
>>                                       (string-append directory "/lib")))
>>                                    %build-inputs) ";"))
>
> Ideally we would never have to do this because ld-wrapper is supposed to
> take care of that.
>
> This is in powertabeditor, right?  What happens if you build it without
> this and with VERBOSE=1 (as a ‘make’ variable) and
> GUIX_LD_WRAPPER_DEBUG=1 (environment variable)?  I would like to see
> where the -rpath get lost or overwritten.

This is in powertabeditor and shogun, and possibly yet another package I
had been working on which I cannot find at the moment.  I can try with
the suggested settings to see where the rpath gets lots.

>> The attached patch only adds BUILD_WITH_INSTALL_RPATH=TRUE.  I’m not
>> sure if this is sufficient, but I think it is actually a requirement.
>
> Unfortunately CMake has complex RPATH handling and it seems to resist
> us.  It would be good to see, taking powertabeditor as an example, how
> we can achieve better results.  I don’t know whether
> BUILD_WITH_INSTALL_RPATH=TRUE is necessary, but I think we must first
> better understand what’s going on.

Okay, I’ll try the above some time and try to figure out what’s going
on, then report back.

~~ Ricardo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-06  4:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-05  8:52 cmake-build-system Ricardo Wurmus
2015-07-05 22:44 ` cmake-build-system Ludovic Courtès
2015-07-06  4:23   ` cmake-build-system Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).