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

[package] protobuf/*: incorrect RPATH on MacOS w/ with_zlib=True #20102

Closed
Cogitri opened this issue Sep 25, 2023 · 3 comments
Closed

[package] protobuf/*: incorrect RPATH on MacOS w/ with_zlib=True #20102

Cogitri opened this issue Sep 25, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Cogitri
Copy link
Contributor

Cogitri commented Sep 25, 2023

Description

When building protobuf on MacOS with with_zlib=True, the package_folder of zlib isn't included in protobuf's RPATH. As such, running protoc fails because it can't find @rpath/zlib.dylib.

Package and Environment Details

  • Package Name/Version: protobuf/3.21.12
  • Operating System+version: MacOS 13.5.1
  • Compiler+version: Apple clang version 15.0.0 (clang-1500.0.40.1)
  • Conan version: conan 2.0.9
  • Python version: Python 3.11.3

Conan profile

[settings]
arch = x86_64
build_type = Release
compiler = apple-clang
compiler.cppstd = 20
compiler.libcxx = libc++
compiler.version = 15
os = Macos
os.version = 10.15

Steps to reproduce

conan install -r conancenter--requires=protobuf/3.21.12 -o "*:shared=True"

Logs

Click to expand log
dyld[44252]: Library not loaded: @rpath/libz.1.dylib
  Referenced from: <12487EAF-0251-3D44-A4C3-7E4721B31A02> /Users/dev/.conan2/p/b/proto7bde3c2dd0ea7/p/lib/libprotobufd.3.21.12.0.dylib
  Reason: tried: '/Users/dev/.conan2/p/b/proto7bde3c2dd0ea7/p/lib/libz.1.dylib' (no such file), '/Users/dev/.conan2/p/b/proto7bde3c2dd0ea7/p/lib/libz.1.dylib' (no such file), '/Users/dev/.conan2/p/b/proto7bde3c2dd0ea7/p/bin/../lib/libz.1.dylib' (no such file), '/Users/dev/.conan2/p/b/proto7bde3c2dd0ea7/p/bin/../lib/libz.1.dylib' (no such file)
@Cogitri Cogitri added the bug Something isn't working label Sep 25, 2023
@Cogitri
Copy link
Contributor Author

Cogitri commented Sep 25, 2023

Probably similar to #20093 (comment)

@SpaceIm
Copy link
Contributor

SpaceIm commented Sep 25, 2023

When building protobuf on MacOS with with_zlib=True, the package_folder of zlib isn't included in protobuf's RPATH. As such, running protoc fails because it can't find @rpath/zlib.dylib.

Adding zlib to LC_RPATH of protoc executable or protobuf lib is not a long term solution, since zlib path in conan cache can change (if protobuf has been built on another machine, or if another flavor of zlib than the one used during build and not leading to a rebuild of protobuf is injected in the dependency graph).

Apple SIP reseting DYLD_LIBRARY_PATH defeats VirtualBuildEnv or VirtualRunEnv (SIP is triggered somewhere during execution of build backends like make or ninja), and there is nothing conan can do against this anti-developer feature.

My advice is to have protobuf/<host_version> in tool_requires when protoc is needed at build time (native or cross-build, no trick with protobuf from host context used with VirtualRunEnv injected in build scope), and avoid to inject shared=True in build context.

@Cogitri
Copy link
Contributor Author

Cogitri commented Sep 25, 2023

Ah, that makes sense. We'll just have to build protobuf w/ zlib:shared=False then

@Cogitri Cogitri closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants