Skip to content

Commit

Permalink
build(macos): don't use ssh feature for git2 dependency
Browse files Browse the repository at this point in the history
Using the `ssh` feature induces a dependency on `openssl`. On my Macbook, this produced the following linking error:

```
  = note: Undefined symbols for architecture x86_64:
            "_OPENSSL_init_ssl", referenced from:
                std::sync::once::Once::call_once::_$u7b$$u7b$closure$u7d$$u7d$::he73245cadb6fb5f7 (.llvm.1763620816825828942) in libopenssl_sys-e129a1c9f9682ba1.rlib(openssl_sys-e129a1c9f9682ba1.openssl_sys.dn7psuzk-cgu.6.rcgu.o)
                core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h2d3710fadd6753f9 (.llvm.1763620816825828942) in libopenssl_sys-e129a1c9f9682ba1.rlib(openssl_sys-e129a1c9f9682ba1.openssl_sys.dn7psuzk-cgu.6.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

I tried the following:

* Running `brew install openssl@1.1` as per the instructions at https://docs.rs/openssl/0.10.33/openssl/
* Setting the environment variables mentioned in `brew info openssl`
* Setting `LIBGIT2_SYS_USE_PKG_CONFIG=1` as mentioned in rust-lang/git2-rs#229

None of these worked. So I'm disabling the `ssh` feature for now. If `git-branchless` needs the `ssh` feature in the future (for example, if we add a Github integration and want it to pull/push directly), then we'll have to resolve the issue properly.

It's possible my particular issue is due to running Homebrew on a too-old version of macOS, and that it might be resolved by an OS upgrade and re-installing my Homebrew packages.
  • Loading branch information
arxanas committed Apr 15, 2021
1 parent fd21646 commit 43c1f64
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 91 deletions.
131 changes: 41 additions & 90 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ assert_cmd = "1.0.3"
console = "0.14.0"
cursive = {version = "0.16.3", features = ["crossterm-backend"]}
fn-error-context = "0.1.1"
git2 = "0.13.17"
git2 = {version = "0.13.17", default-features = false}
lazy_static = "1.4.0"
log = "0.4.14"
regex = "1.4.4"
Expand Down

2 comments on commit 43c1f64

@Firefishy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Fix is normally just setting following during build: export PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl@1.1/lib/pkgconfig" (after brew install openssl@1.1)

Why am I adding this as a comment? Found I found this while googling for issue I was facing with git2 with ssh support. Hopefully saves some others some pain ;-) <3

@arxanas
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also be aware that there may be ABI differences between the version expected by your software and the actual version you installed. See rust-lang/git2-rs#721 for an example of a difference between libgit2 1.0 and 1.1.

Please sign in to comment.