Skip to content

Commit

Permalink
For conan-io#7715, don't pass os_host to rpath_flags but extract from…
Browse files Browse the repository at this point in the history
… settings, pass os_build again and only set rpath_separator to , if compiling for Mac OS from Linux or Mac OS via GCC_LIKE
  • Loading branch information
Erlkoenig90 committed Sep 17, 2020
1 parent a729522 commit 7ee24c8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
5 changes: 4 additions & 1 deletion conans/client/build/autotools_environment.py
Expand Up @@ -264,7 +264,10 @@ def _configure_link_flags(self):
ret.append(sysf)

if self._include_rpath_flags:
ret.extend(rpath_flags(self._conanfile.settings, self._os, self._deps_cpp_info.lib_paths))
os_build, _ = get_build_os_arch(self._conanfile)
if not hasattr(self._conanfile, 'settings_build'):
os_build = os_build or self._os
ret.extend(rpath_flags(self._conanfile.settings, os_build, self._deps_cpp_info.lib_paths))

return ret

Expand Down
8 changes: 5 additions & 3 deletions conans/client/build/compiler_flags.py
Expand Up @@ -23,12 +23,14 @@ def _base_compiler(settings):


# FIXME : pass conanfile instead of settings and os_build
def rpath_flags(settings, os_host, lib_paths):
def rpath_flags(settings, os_build, lib_paths):
compiler = _base_compiler(settings)
if not os_host:
os_host = settings.get_safe("os")
if not os_build:
return []
if compiler in GCC_LIKE:
rpath_separator = "," if is_apple_os(os_host) else "="
rpath_separator = "," if (is_apple_os(os_host) and (os_build == "Linux" or is_apple_os(os_build))) else "="
# rpath_separator = "," if is_apple_os(os_host) else "="
return ['-Wl,-rpath%s"%s"' % (rpath_separator, x.replace("\\", "/"))
for x in lib_paths if x]
return []
Expand Down
6 changes: 5 additions & 1 deletion conans/client/generators/compiler_args.py
Expand Up @@ -63,7 +63,11 @@ def content(self):
# Necessary in the "cl" invocation before specify the rest of linker flags
flags.append(visual_linker_option_separator)

flags.extend(rpath_flags(self._settings, self.conanfile.settings.get_safe("os"), self._deps_build_info.lib_paths))
os_build, _ = get_build_os_arch(self.conanfile)
if not hasattr(self.conanfile, 'settings_build'):
os_build = os_build or self.conanfile.settings.get_safe("os")

flags.extend(rpath_flags(self._settings, os_build, self._deps_build_info.lib_paths))
flags.extend(format_library_paths(self._deps_build_info.lib_paths, self._settings))
flags.extend(format_libraries(self._deps_build_info.libs, self._settings))
flags.extend(format_libraries(self._deps_build_info.system_libs, self._settings))
Expand Down
6 changes: 4 additions & 2 deletions conans/client/generators/pkg_config.py
Expand Up @@ -88,9 +88,11 @@ def single_pc_file_contents(self, name, cpp_info, comp_requires_gennames, is_com
libnames_flags = ["-l%s " % name for name in (cpp_info.libs + cpp_info.system_libs)]
shared_flags = cpp_info.sharedlinkflags + cpp_info.exelinkflags

os_host = self.conanfile.settings.get_safe("os")
os_build, _ = get_build_os_arch(self.conanfile)
if not hasattr(self.conanfile, 'settings_build'):
os_build = os_build or self.conanfile.settings.get_safe("os")

rpaths = rpath_flags(self.conanfile.settings, os_host,
rpaths = rpath_flags(self.conanfile.settings, os_build,
["${%s}" % libdir for libdir in libdir_vars])
frameworks = format_frameworks(cpp_info.frameworks, self.conanfile.settings)
framework_paths = format_framework_paths(cpp_info.framework_paths, self.conanfile.settings)
Expand Down

0 comments on commit 7ee24c8

Please sign in to comment.