View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013560CMakeCMakepublic2012-09-25 11:482013-04-17 08:54
ReporterAndreas Langs 
Assigned ToPeter Kuemmel 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSUbuntuOS Version12.04
Product VersionCMake 2.8.9 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0013560: Ninja: -Wl, -rpath,'$ORIGIN/foobar' not working correctly in CMAKE_EXE_LINKER_FLAGS
DescriptionI used the testcase from issue 0013069 and added to the CMakeLists.txt file below line 16:
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/foo'")

Then I used the Ninja generator to generate the ninja build files and built it using ninja 1.0.0.

Inspecting the resulting executable with "objdump -p flags" it shows: "RPATH /foo"

Using the Makefile generator and building it with make gives the expected entry shown by objdump: "RPATH $ORIGIN/foo".

Looking at the build.ninja file generated by cmake I see this line:
LINK_FLAGS = -Wl,-rpath,'$ORIGIN/unitTests'

Changing it to:
LINK_FLAGS = -Wl,-rpath,'$$ORIGIN/unitTests'
(double $$) gives the correct RPATH entry in the executable.

It seems as if there needs to be some escaping done with "$" signs when generating build.ninjs files.


TagsNo tags attached.
Attached Filesdiff file icon ninja-encode-vars.diff [^] (536 bytes) 2012-11-08 15:11 [Show Content]
gz file icon rpath.tar.gz [^] (8,621 bytes) 2012-11-20 16:06

 Relationships

  Notes
(0031505)
Reid Kleckner (reporter)
2012-11-08 15:12

Does the attached path fix the problem correctly? I hit this problem, applied it locally, and things worked for me.
(0031554)
Andreas Langs (reporter)
2012-11-14 07:57

The patch by Reid Kleckner (ninja-encode-vars.diff) does fix the described problem.
However it does not completely fix my original problem because the reproduction description was not complete enough.
So the more complete description is as follows:

Follow the original description and then add to line 8:
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

and add to line 28:
SET_TARGET_PROPERTIES(flags PROPERTIES INSTALL_RPATH "$ORIGIN")

When doing the build with a cmake 2.8.10.1 with Reid Kleckners patch and ninja 1.0.0 the result of "objdump -p flags" is:
"RPATH $ORIGIN/foo:$" instead of
"RPATH $ORIGIN/foo:$ORIGIN"

So the rpath setting coming from the CMAKE_EXE_LINKER_FLAGS variable is correct now, but the rpath setting coming from the INSTALL_RAPTH target property is not.
(0031631)
Peter Kuemmel (developer)
2012-11-20 16:09

rpath.tar.gz contains an updated test.

And I've committed a patch:
http://public.kitware.com/pipermail/cmake-commits/2012-November/013923.html [^]
(0031639)
Andreas Langs (reporter)
2012-11-21 04:02

The committed patch works for my cases. Thank you.
(0031640)
Peter Kuemmel (developer)
2012-11-21 04:53

Thanks for testing!
(0032875)
Robert Maynard (manager)
2013-04-17 08:54

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-09-25 11:48 Andreas Langs New Issue
2012-10-03 08:59 Peter Kuemmel Assigned To => Peter Kuemmel
2012-10-03 08:59 Peter Kuemmel Status new => assigned
2012-11-08 15:11 Reid Kleckner File Added: ninja-encode-vars.diff
2012-11-08 15:12 Reid Kleckner Note Added: 0031505
2012-11-14 07:57 Andreas Langs Note Added: 0031554
2012-11-20 16:06 Peter Kuemmel File Added: rpath.tar.gz
2012-11-20 16:09 Peter Kuemmel Note Added: 0031631
2012-11-20 16:09 Peter Kuemmel Fixed in Version => CMake 2.8.11
2012-11-20 16:09 Peter Kuemmel Target Version => CMake 2.8.11
2012-11-21 04:02 Andreas Langs Note Added: 0031639
2012-11-21 04:53 Peter Kuemmel Note Added: 0031640
2012-11-21 04:53 Peter Kuemmel Status assigned => resolved
2012-11-21 04:53 Peter Kuemmel Resolution open => fixed
2013-04-17 08:54 Robert Maynard Note Added: 0032875
2013-04-17 08:54 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team