-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backends: Use raw_link_args to check for the need of RPATH
Function rpaths_for_bundled_shared_libraries assumes it needs RPATH when linking arguments of an external dependency has exactly one argument and the only argument is an absolute path to a library file. This was mostly fine because almost all .pc files use a -L -l pair instead of the full path of the library, which means pkg-config dependencies almost always have at least two arguments. However, there are patches landed in the meson 0.47 cycle which convert -L -l pair returned by pkg-config to the absolute path of library. If the output of pkg-config includes exactly one -L argument and one -l argument, it will be converted to exactly one absolute path by meson and rpaths_for_bundled_shared_libraries will assume it needs RPATH. Since meson passes both -rpath and -rpath-link to the linker and -rpath-link has precedence over LD_LIBRARY_PATH, it changes the search order of dependent libraries in an unexpected way and it causes a lot of linking troubles in JHBuild environments on FreeBSD. To make the method behave like the old way of using -L -l pairs and avoid library path order problems, we use raw_link_args instead of link_args here. raw_link_args stores the unmodified output of pkg-config and it is much less likely to accidentally match the rule currently used by the method. Works around #4270.
- Loading branch information
Showing
5 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
project('global-rpath', 'cpp') | ||
yonder_dep = dependency('yonder') | ||
cpp = meson.get_compiler('cpp') | ||
yonder_libdir = get_option('yonder_libdir') | ||
yonder_dep = cpp.find_library('yonder', dirs: [yonder_libdir]) | ||
executable('rpathified', 'rpathified.cpp', dependencies: [yonder_dep], install: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
option('yonder_libdir', type: 'string') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
project('yonder', 'cpp') | ||
yonder = shared_library('yonder', 'yonder.cpp', install: true) | ||
install_headers('yonder.h') | ||
pkgconfig = import('pkgconfig') | ||
pkgconfig.generate(yonder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters