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

cargo cbuild on macOS results in openssl@1 errors #440

Open
GR899 opened this issue Jan 30, 2025 · 5 comments
Open

cargo cbuild on macOS results in openssl@1 errors #440

GR899 opened this issue Jan 30, 2025 · 5 comments

Comments

@GR899
Copy link

GR899 commented Jan 30, 2025

Using macOS on Apple Silicon with openssl installed via homebrew current openssl@3 located on my system at /opt/homebrew/Cellar/oopenssl@3/3.4.0

Trying to build a gstreamer/GTK plugin using directions from here:

(https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/#building)

Build results in the following:

cargo cbuild -p gst-plugin-gtk --prefix=/usr --libdir=/opt/homebrew/mygtkplugin
dyld[66859]: Library not loaded: @rpath/libssl.1.1.dylib
Referenced from: /Users/bob/.cargo/bin/cargo-cbuild
Reason: no LC_RPATH’s found
zsh: abort cargo cbuild -p gst-plugin-gtk --prefix=/usr

Is there a OPENSSL environment variable I should or could use to direct cbuild to use my current version of openssl@3 instead of openssl@1?

Thanks for any help or guidance.

@lu-zero
Copy link
Owner

lu-zero commented Jan 30, 2025

cargo-c is the one provided by homebrew?

@lu-zero
Copy link
Owner

lu-zero commented Jan 30, 2025

The openssl dependency comes from cargo itself, if cargo works then so should work cargo-c assuming you built it from source. If the homebrew cargo-c has the problem it should be discussed there.

I just tested and cargo install cargo-c and it is picking correctly the homebrew openssl.

❯ otool -L ~/.cargo/bin/cargo-cbuild
/Users/lu_zero/.cargo/bin/cargo-cbuild:
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61439.60.117)
	/opt/homebrew/opt/libgit2/lib/libgit2.1.8.dylib (compatibility version 1.8.0, current version 1.8.4)
	/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 3208.0.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0)

@GR899
Copy link
Author

GR899 commented Jan 30, 2025

Yes, I installed cargo using homebrew, however otool shows the following. Any suggestions on how I can resolve:

otool -L ~/.cargo/bin/cargo-cbuild
/Users/bob/.cargo/bin/cargo-cbuild:
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61439.60.117)
	/opt/homebrew/opt/libgit2/lib/libgit2.1.8.dylib (compatibility version 1.8.0, current version 1.8.4)
	@rpath/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	@rpath/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 3208.0.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0)
%

@lu-zero
Copy link
Owner

lu-zero commented Jan 30, 2025

cargo uninstall cargo-c that version is not provides by homebrew.

@GR899
Copy link
Author

GR899 commented Jan 31, 2025

Thank you. Just did this:

cargo uninstall cargo-c
    Removing /Users/bob/.cargo/bin/cargo-capi
    Removing /Users/bob/.cargo/bin/cargo-cbuild
    Removing /Users/bob/.cargo/bin/cargo-cinstall
    Removing /Users/bob/.cargo/bin/cargo-ctest

brew install cargo-c

brew info cargo-c
==> cargo-c: stable 0.10.9 (bottled)
Helper program to build and install c-like libraries
https://github.com/lu-zero/cargo-c
Installed
/opt/homebrew/Cellar/cargo-c/0.10.9 (11 files, 101.0MB)

Question - having done this, I'm still getting the openssl error. Do I need to add a path to my environment directly for pkg config or other to ensure cbuild picks it up?

When I removed c-build from cargo it removed ~/.cargo/bin files

/opt/homebrew/Cellar/cargo-c/0.10.9/bin

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants