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

Include pkg_config value in Link annotation #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Blacksmoke16
Copy link

@Blacksmoke16 Blacksmoke16 commented Jan 25, 2025

When using https://github.com/crystal-lang/crystal/releases/download/1.14.1/crystal-1.14.1-1-darwin-universal.tar.gz, such as via https://github.com/crystal-lang/install-crystal, the linker is unable to find ssh2 without this change given it's not bundled with the archive.

E.g.

require "ssh2"

SSH2::Session.open("my_server") { }
$ ./crystal-1.14.1-1/bin/crystal --version
Crystal 1.14.1 [db6128a37] (2025-01-08)

LLVM: 15.0.7
Default target: aarch64-apple-macosx11.0
$ ./crystal-1.14.1-1/bin/crystal build test.cr
ld: library 'ssh2' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with exit status 1: clang "${@}" -o /Users/george/Downloads/test  -rdynamic -L/Users/george/Downloads/crystal-1.14.1-1/embedded/lib -lssh2 -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -L/opt/homebrew/Cellar/bdw-gc/8.2.8/lib -lgc -L/opt/homebrew/Cellar/libevent/2.1.12_1/lib -levent -liconv

However after adding this, it build successfully.

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

Successfully merging this pull request may close these issues.

1 participant