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

Rugged::Repository.clone_at over ssh fails #366

Closed
albertsun opened this issue May 5, 2014 · 14 comments
Closed

Rugged::Repository.clone_at over ssh fails #366

albertsun opened this issue May 5, 2014 · 14 comments

Comments

@albertsun
Copy link
Contributor

/opt/ruby/rubies/ruby-2.0.0-p247/bin/ruby: symbol lookup error: /mnt/apps/capital_git/shared/bundle/ruby/2.0.0/bundler/gems/rugged-de19d5fb25fc/lib/rugged/rugged.so: undefined symbol: libssh2_session_init_ex

With the latest update of rugged, I'm now getting the above error from clone_at when using ssh credentials.

@carlosmn
Copy link
Member

carlosmn commented May 5, 2014

What's your version of libssh2? Do you have it in your load path? What does ldd say about rugged.so? (otool -L if on OSX)?

@albertsun
Copy link
Contributor Author

libssh2 version 1.4.3

$ ldd ext/rugged/rugged.so
linux-vdso.so.1 =>  (0x00007fffc81ff000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa81dc45000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa81da3c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa81d67c000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa81e15f000)

@carlosmn
Copy link
Member

carlosmn commented May 6, 2014

Your library isn't linked to libssh2 (or openssl which is also weird). It shouldn't even have linked successfully. It's very odd.

Does this only happen when you try to clone over ssh? Do other operations work?

@albertsun
Copy link
Contributor Author

Yep. Tried reading/writing a local repo and that works. Cloning a remote repo over https works too.

@albertsun
Copy link
Contributor Author

One note is that libssh2 is installed from source and the files are in /usr/local/lib/, /usr/local/lib/libssh2.so for example.

The server is a Ubuntu 12.04 instance running on AWS.

@carlosmn
Copy link
Member

carlosmn commented May 6, 2014

What are the contents of libgit2's pc file? It should be at $prefix/lib/pkgconfig/libgit2.pc? That's what rugged uses to know what to link against.

@carlosmn
Copy link
Member

carlosmn commented May 6, 2014

Actually, since rugged builds its own copy, it would be under wherever you build the gem, and then under vendor/libgit2/build/libgit2.pc.

@albertsun
Copy link
Contributor Author

libdir=/usr/local/lib
includedir=/usr/local/include

Name: libgit2
Description: The git library, take 2
Version: 0.20.0
Requires.private:  openssl zlib libssh2
Libs.private:  -lrt
Libs: -L${libdir} -lgit2
Cflags: -I${includedir}

@carlosmn
Copy link
Member

carlosmn commented May 7, 2014

I can't reproduce this on my ubuntu VM. It is a 14.04, I'll see about grabbing a 12.04 version.

The file looks correct. What does pkg-config --libs --static vendor/build/libgit2.pc say? That should have the list of libraries that we need to depend on, which then get copied to tmp/rugged/2.0.0/Makefile.

@albertsun
Copy link
Contributor Author

That produces this:

$ pkg-config --libs --static vendor/libgit2/build/libgit2.pc
-L/usr/local/lib -lrt -lgit2 -lssh2 -lssl -lcrypto -ldl -lz

Thanks for helping me debug. I'm pretty unfamiliar with this level of the stack.

@albertsun
Copy link
Contributor Author

Is there a way to more explicitly specify the path to libssh2 in the build process?

@carlosmn
Copy link
Member

carlosmn commented May 8, 2014

You can export that line from pkg-config as LDFLAGS, either in your environment or in ext/rugged/extconf.rb, but those are the correct flags to use, and they should be in ldflags in tmp/<arch>/rugged/<ruby-version>/Makefile.

@albertsun
Copy link
Contributor Author

So it turns out that chef was putting it's version of pkg-config at /opt/chef/embedded/bin at the front of the path, which was failing to find anything when run. Setting the PKG_CONFIG_PATH environment variable fixed this.

Sorry for the bother.

@ibestrest
Copy link

Hello. I installed the plugin on redmine "redmine_git_hosting". An error when I change the settings.
/opt/bitnami/apps/redmine/htdocs/: symbol lookup error: /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.4/lib/rugged/rugged.so: undefined symbol: libssh2_session_init_ex.
Can you help me?

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

3 participants