libgit2 / libgit2/rugged

Windows + libssh2 not usable

Open
#558 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

The current solution to pkg-config isn't workable if you need Windows + libssh2 + rugged:

$ pkg-config --libs --static C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\rugged-0.24.0b11\vendor\libgit2\build\libgit2.pc
-LC:/Program -LC:/Ruby22-x64/DevKit-mingw64-64-4.7.2/lib Files (x86)/libgit2/lib -lgit2 -lssh2 -lws2_32 -lbcrypt -lcrypt32

But the hardcoded list of libs going into $LIBS doesn't include -lssh2 so the build fails spectacularly:

linking shared-object rugged/rugged.so
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rugged-0.24.0b11/ext/rugged/../../vendor/libgit2/build/libgit2.a(ssh.c.obj): In function `ssh_error':
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rugged-0.24.0b11/vendor/libgit2/src/transports/ssh.c:51: undefined reference to `libssh2_session_last_error'
// ... You get the idea...
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rugged-0.24.0b11/ext/rugged/../../vendor/libgit2/build/libgit2.a(ssh.c.obj): In function `list_auth_methods':
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rugged-0.24.0b11/vendor/libgit2/src/transports/ssh.c:759: undefined reference to `libssh2_userauth_authenticated'
collect2.exe: error: ld returned 1 exit status
make: *** [rugged.so] Error 1

The solution seems to be using pkg-config. If someone's compiled libssh2 then installing pkg-config from http://sourceforge.net/projects/pkgconfiglite/files/ is pretty easy. I'm just not quite sure how to work around not having pkg-config. Perhaps a bit more smarts to make pkg-config an optional dependency on Windows?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names the Windows extension build, the hardcoded $LIBS list, and the pkg-config invocation; start by reproducing the libssh2 link failure and tracing how those libraries are selected. Done means a Windows rugged build links libssh2 successfully, with clear behavior when pkg-config is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ruby
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.