Closed maxmil closed 6 years ago
@maxmil this isn't intentionally unsupported, it's just that nobody has taken a look to see how to enable this yet. If you'd like to take a crack at it, we'd love to see a pull request for this! 😄
libgit2 is built using cmake
in separate scripts for OS X (update_libgit2
) and iOS (update_libgit2_ios
)
libssh2_userauth_publickey_frommemory was added to libssh2 in version 1.6.0 (https://github.com/libssh2/libssh2/commit/18cfec8336e88ab7df8a4427b803b9a177053674) but the submodule in objective-git is on the tag for release 1.4.3.
I thought updating the submodule would do it but I think there is still one other problem to solve.
CHECK_LIBRARY_EXISTS in cmake is still returning false even though the updated libssh2 library contains libssh2_userauth_publickey_frommemory.
My knowledge of cmake is non existent so I'm not sure why this is but I am pretty sure the function is there.
$ nm External/libssh2-ios/lib/libssh2-ios.a | grep libssh2_userauth_publickey_frommemory
0000000000002710 T _libssh2_userauth_publickey_frommemory
Any ideas?
I've run into the same issue with my libgit2, and I did a little digging.
The libgit2 CMakeLists.txt calls
CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
to check if libssh2 is compiled with the libssh2_userauth_publickey_frommemory method.
On my system, LIBSSH2_LIBRARIES=ssh2
and LIBSSH2_LIBRARY_DIRS=/usr/local/Cellar/libssh2/1.7.0/lib
.
In my CMakeError.log, I see the following error:
Determining if the function libssh2_userauth_publickey_frommemory exists in the ssh2 failed with the following output:
Change Dir: /Users/ian/Development/Source/Carthage/Checkouts/objective-git/External/libgit2/build/CMakeFiles/CMakeTmp
Run Build Command:"/Applications/Xcode.app/Contents/Developer/usr/bin/make" "cmTC_690e7/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_690e7.dir/build.make CMakeFiles/cmTC_690e7.dir/build
Building C object CMakeFiles/cmTC_690e7.dir/CheckFunctionExists.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -fembed-bitcode -DCHECK_FUNCTION_EXISTS=libssh2_userauth_publickey_frommemory -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -o CMakeFiles/cmTC_690e7.dir/CheckFunctionExists.c.o -c /usr/local/Cellar/cmake/3.5.2/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTC_690e7
/usr/local/Cellar/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_690e7.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -fembed-bitcode -DCHECK_FUNCTION_EXISTS=libssh2_userauth_publickey_frommemory -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_690e7.dir/CheckFunctionExists.c.o -o cmTC_690e7 -L/usr/local/Cellar/libssh2/1.7.0/lib -lssh2 -Wl,-rpath,/usr/local/Cellar/libssh2/1.7.0/lib
ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
ld: warning: ignoring file /usr/local/Cellar/libssh2/1.7.0/lib/libssh2.dylib, file was built for x86_64 which is not the architecture being linked (arm64): /usr/local/Cellar/libssh2/1.7.0/lib/libssh2.dylib
Undefined symbols for architecture arm64:
"_libssh2_userauth_publickey_frommemory", referenced from:
_main in CheckFunctionExists.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_690e7] Error 1
make: *** [cmTC_690e7/fast] Error 2
It appears to be looking at the libssh2 I have installed with Homebrew, and not the libssh2 built for each architecture in this project. And because CHECK_LIBRARY_EXISTS can't link the library with a different architecture, it fails.
Perhaps this should be modified by using the CMAKE_PREFIX_PATH
instead?
This should be fixed by the newest build. Please reopen if that's not the case.
When trying to initialise GTCredential with a private key string I'm getting
this version of libgit2 was not built with ssh memory credentials.
I'm using the 0.12 binary release of the framework. Has a deliberate decision been taken not to support this? If so I'd be interested in knowing why.
Can I build my own version locally to support it and if so how should I go about it? I'm a C newbie.