Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl: ensure install_name_tool works on MacOS #5308 #9540

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion recipes/openssl/1.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,11 @@ def _create_targets(self):
"""
cflags = []
cxxflags = []
lflags = []
env_build = self._get_env_build()
cflags.extend(env_build.vars_dict["CFLAGS"])
cxxflags.extend(env_build.vars_dict["CXXFLAGS"])
lflags.extend(env_build.vars_dict["LDFLAGS"])

cc = self._tool("CC", "cc")
cxx = self._tool("CXX", "cxx")
Expand All @@ -612,6 +614,8 @@ def _create_targets(self):
if self.settings.os == "Windows":
includes = includes.replace('\\', '/') # OpenSSL doesn't like backslashes

if self.settings.os == "Macos":
lflags.append("-headerpad_max_install_names")
if self._asm_target:
ancestor = '[ "%s", asm("%s") ]' % (self._ancestor_target, self._asm_target)
else:
Expand Down Expand Up @@ -641,7 +645,7 @@ def _create_targets(self):
shared_target=shared_target,
shared_extension=shared_extension,
shared_cflag=shared_cflag,
lflags=" ".join(env_build.link_flags))
lflags=" ".join(lflags))
self.output.info("using target: %s -> %s" % (self._target, self._ancestor_target))
self.output.info(config)

Expand Down
8 changes: 8 additions & 0 deletions recipes/openssl/1.x.x/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ def test(self):
if not self._skip_test and not tools.cross_building(self):
bin_path = os.path.join("bin", "digest")
self.run(bin_path, run_environment=True)
if self.settings.os == 'Macos' and self.options["openssl"].shared:
# Ensure we can run install_name_tool on the libraries
libssl_dylib = 'libssl.dylib'
libssl = os.path.join(self.deps_cpp_info["openssl"].rootpath, 'lib', libssl_dylib)
self.run(f'rm -f {libssl_dylib}')
self.run(f'cp {libssl} {libssl_dylib}')
long_rpath = 'poijfpeoifjperwonfjpnocjpnqoefjpneojntvqpeonijtpqeonrvtijpqvneoitjvqpneoitjnvpqeonijtvpqoeijrtvpqoeritjvpqeoijtqpevnoitjpqenotijqepo'
self.run(f'install_name_tool -add_rpath {long_rpath} {libssl_dylib}')
assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE"))