rugged icon indicating copy to clipboard operation
rugged copied to clipboard

Unable to build with ssh support on OSX

Open dkowis opened this issue 7 years ago • 9 comments

-- Checking for module 'libssh2'
--   Package 'libssl', required by 'libssh2', not found

I'm sure this has something to do with High Sierra, and the various versions of openssl provided.

I read through #476, and it's not the same problem, as I've got libssh2 installed, but apparently it doesn't know how to find the right openssl libs. I can't brew link openssl as it tells me to do:

$ brew link openssl
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

What's the proper way to install libgit2, and rugged, on an OSX system using the right libraries?

dkowis avatar Jan 31 '18 21:01 dkowis

That is ...unexpected? I use High Sierra too, and I can build Rugged with SSH support just fine. 🤷‍♂️

I'll try to see what is going on, but I think libssh2 should prefer the macOS crypto APIs over OpenSSL by default. 🤔

arthurschreiber avatar Feb 01 '18 13:02 arthurschreiber

As a supplemental question, which could potentially solve my problem, is there a way to include a pre-built library in my gem so that I don't have to rely on the end user to build it, it's just ready to go?

My runtime dependencies are specified in the .gemspec file, and I haven't been able to figure out a way to do this via googling. If I could use an upstream binary (even if it's only for osx) that would cover 80% of my use cases.

dkowis avatar Feb 01 '18 16:02 dkowis

@dkowis you wouldn't have to do anything specific, the upstream dependency would. For example, if we published a pre-compiled rugged for macOS, and your gem depended on rugged, clients would just get the pre-built rugged when they installed your gem (if they're on macOS of course).

What happens when you gem install rugged? I don't think you need to link openssl (I don't think I do).

tenderlove avatar Feb 03 '18 22:02 tenderlove

@tenderlove It builds the native library, and I have to make sure I've got cmake and such installed to be able to actually install it.

dkowis avatar Feb 03 '18 22:02 dkowis

@dkowis Try this. It worked for me on High Sierra.

gem uninstall rugged
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig"
gem install rugged

natemccurdy avatar Feb 14 '18 18:02 natemccurdy

~ > set -x PKG_CONFIG_PATH "$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig/"
~ > gem install rugged                                                                                                                                                                                                                                                                                                                                                                                 10s
Fetching: rugged-0.26.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed rugged-0.26.0
Parsing documentation for rugged-0.26.0
Installing ri documentation for rugged-0.26.0
Done installing documentation for rugged after 1 seconds
1 gem installed
~ > irb                                                                                                                                                                                                                                                                                                                                                                                                50s
irb(main):001:0> require 'rugged'
=> true
irb(main):002:0> Rugged.features
=> [:threads, :https, :ssh]
irb(main):003:0>

Yep, that seals the deal. Can probably just get this into the readme, and then close it down.

It would be super nice if there was an upstream pre-compiled binary ready to go, so I don't have to get everyone that uses this to go through the same hoops.

dkowis avatar Feb 14 '18 19:02 dkowis

Has anyone figured out how to make this work on travis with os: osx. I can't seem to get it to work.

ioquatix avatar Feb 05 '19 04:02 ioquatix

Sorry to revive this, but I'm facing the same build issue on BigSur 11.6.1, and don't know what else to try:

(Note the "Found OpenSSL: /usr/local/lib/libcrypto.dylib (found version "3.0.0")" and the "-- Package 'libssl', required by 'libssh2', not found -- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path." lines.)

current directory: /Library/Ruby/Gems/2.6.0/gems/rugged-1.2.0/ext/rugged
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20211029-46936-1d8xvnm.rb extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... yes
checking for pkg-config... yes
-- The C compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM - Failed
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC - Success
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC - Failed
-- Performing Test HAVE_STRUCT_STAT_NSEC
-- Performing Test HAVE_STRUCT_STAT_NSEC - Success
-- Performing Test IS_WERROR_SUPPORTED
-- Performing Test IS_WERROR_SUPPORTED - Success
-- Looking for futimens
-- Looking for futimens - found
-- Performing Test IS_WNO_ERROR_SUPPORTED
-- Performing Test IS_WNO_ERROR_SUPPORTED - Success
-- Performing Test IS_WALL_SUPPORTED
-- Performing Test IS_WALL_SUPPORTED - Success
-- Performing Test IS_WEXTRA_SUPPORTED
-- Performing Test IS_WEXTRA_SUPPORTED - Success
-- Performing Test IS_WDOCUMENTATION_SUPPORTED
-- Performing Test IS_WDOCUMENTATION_SUPPORTED - Success
-- Performing Test IS_WNO_DOCUMENTATION_DEPRECATED_SYNC_SUPPORTED
-- Performing Test IS_WNO_DOCUMENTATION_DEPRECATED_SYNC_SUPPORTED - Success
-- Performing Test IS_WNO_MISSING_FIELD_INITIALIZERS_SUPPORTED
-- Performing Test IS_WNO_MISSING_FIELD_INITIALIZERS_SUPPORTED - Success
-- Performing Test IS_WSTRICT_ALIASING_SUPPORTED
-- Performing Test IS_WSTRICT_ALIASING_SUPPORTED - Success
-- Performing Test IS_WSTRICT_PROTOTYPES_SUPPORTED
-- Performing Test IS_WSTRICT_PROTOTYPES_SUPPORTED - Success
-- Performing Test IS_WDECLARATION_AFTER_STATEMENT_SUPPORTED
-- Performing Test IS_WDECLARATION_AFTER_STATEMENT_SUPPORTED - Success
-- Performing Test IS_WSHIFT_COUNT_OVERFLOW_SUPPORTED
-- Performing Test IS_WSHIFT_COUNT_OVERFLOW_SUPPORTED - Success
-- Performing Test IS_WUNUSED_CONST_VARIABLE_SUPPORTED
-- Performing Test IS_WUNUSED_CONST_VARIABLE_SUPPORTED - Success
-- Performing Test IS_WUNUSED_FUNCTION_SUPPORTED
-- Performing Test IS_WUNUSED_FUNCTION_SUPPORTED - Success
-- Performing Test IS_WINT_CONVERSION_SUPPORTED
-- Performing Test IS_WINT_CONVERSION_SUPPORTED - Success
-- Performing Test IS_WC11_EXTENSIONS_SUPPORTED
-- Performing Test IS_WC11_EXTENSIONS_SUPPORTED - Success
-- Performing Test IS_WC99_C11_COMPAT_SUPPORTED
-- Performing Test IS_WC99_C11_COMPAT_SUPPORTED - Failed
-- Performing Test IS_WFORMAT_SUPPORTED
-- Performing Test IS_WFORMAT_SUPPORTED - Success
-- Performing Test IS_WFORMAT_SECURITY_SUPPORTED
-- Performing Test IS_WFORMAT_SECURITY_SUPPORTED - Success
-- Performing Test IS_WMISSING_DECLARATIONS_SUPPORTED
-- Performing Test IS_WMISSING_DECLARATIONS_SUPPORTED - Success
-- Checking prototype qsort_r for HAVE_QSORT_R_BSD
-- Checking prototype qsort_r for HAVE_QSORT_R_BSD - True
-- Checking prototype qsort_r for HAVE_QSORT_R_GNU
-- Checking prototype qsort_r for HAVE_QSORT_R_GNU - False
-- Looking for qsort_s
-- Looking for qsort_s - not found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Found OpenSSL: /usr/local/lib/libcrypto.dylib (found version "3.0.0")
-- Found Security /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework
-- Looking for SSLCreateContext in /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework
-- Looking for SSLCreateContext in /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework - found
-- Found CoreFoundation /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreFoundation.framework
-- Could NOT find PCRE (missing: PCRE_INCLUDE_DIR)
-- Looking for dirent.h
-- Looking for dirent.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for windows.h
-- Looking for windows.h - not found
-- Looking for bcopy
-- Looking for bcopy - found
-- Looking for memmove
-- Looking for memmove - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strtoll
-- Looking for strtoll - found
-- Looking for strtoq
-- Looking for strtoq - found
-- Looking for _strtoi64
-- Looking for _strtoi64 - not found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long long
-- Check size of long long - done
-- Check size of unsigned long long
-- Check size of unsigned long long - done
-- Performing Test IS_WNO_UNUSED_FUNCTION_SUPPORTED
-- Performing Test IS_WNO_UNUSED_FUNCTION_SUPPORTED - Success
-- Performing Test IS_WNO_IMPLICIT_FALLTHROUGH_SUPPORTED
-- Performing Test IS_WNO_IMPLICIT_FALLTHROUGH_SUPPORTED - Success
-- http-parser version 2 was not found or disabled; using bundled 3rd-party sources.
-- Performing Test IS_WIMPLICIT_FALLTHROUGH_1_SUPPORTED
-- Performing Test IS_WIMPLICIT_FALLTHROUGH_1_SUPPORTED - Failed
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Checking for module 'libssh2'
--   Package 'libssl', required by 'libssh2', not found
-- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
-- Checking for module 'heimdal-gssapi'
--   No package 'heimdal-gssapi' found
-- Could NOT find GSSAPI (missing: GSSAPI_LIBRARIES)
-- Found GSS.framework /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/GSS.framework
-- Looking for iconv_open
-- Looking for iconv_open - not found
-- Found Iconv: -L/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib -liconv
-- Enabled features:
 * nanoseconds, whether to use sub-second file mtimes and ctimes
 * tracing, tracing support
 * futimens, futimens support
 * threadsafe, threadsafe support
 * HTTPS, using SecureTransport
 * SHA, using CollisionDetection
 * regex, using bundled PCRE
 * http-parser, http-parser support (bundled)
 * zlib, using system zlib
 * ntlmclient, NTLM authentication support for Unix
 * iconv, iconv encoding conversion support

-- Disabled features:
 * debugpool, debug pool allocator
 * debugalloc, debug strict allocators
 * debugopen, path validation in open
 * SSH, SSH transport support
 * SPNEGO, SPNEGO authentication support

-- Configuring done
-- Generating done
-- Build files have been written to: /Library/Ruby/Gems/2.6.0/gems/rugged-1.2.0/vendor/libgit2/build
 -- /usr/bin/make
checking for -lgit2... yes
checking for git2.h... yes
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/rugged-1.2.0/ext/rugged
make DESTDIR\= clean

current directory: /Library/Ruby/Gems/2.6.0/gems/rugged-1.2.0/ext/rugged
make DESTDIR\=
compiling rugged.c
compiling rugged_allocator.c
compiling rugged_backend.c
compiling rugged_blame.c
compiling rugged_blob.c
compiling rugged_branch.c
compiling rugged_branch_collection.c
compiling rugged_commit.c
compiling rugged_config.c
compiling rugged_cred.c
compiling rugged_diff.c
compiling rugged_diff_delta.c
compiling rugged_diff_hunk.c
compiling rugged_diff_line.c
compiling rugged_index.c
compiling rugged_note.c
compiling rugged_object.c
compiling rugged_patch.c
compiling rugged_rebase.c
compiling rugged_reference.c
compiling rugged_reference_collection.c
compiling rugged_remote.c
compiling rugged_remote_collection.c
compiling rugged_repo.c
compiling rugged_revwalk.c
compiling rugged_settings.c
compiling rugged_signature.c
compiling rugged_submodule.c
compiling rugged_submodule_collection.c
compiling rugged_tag.c
compiling rugged_tag_collection.c
compiling rugged_tree.c
linking shared-object rugged/rugged.bundle
ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.6.Internal.sdk/usr/local/lib'

current directory: /Library/Ruby/Gems/2.6.0/gems/rugged-1.2.0/ext/rugged
make DESTDIR\= install
/usr/bin/install -c -m 0755 rugged.bundle ./.gem.20211029-46936-hndxh9/rugged`

kenshin23 avatar Oct 30 '21 00:10 kenshin23

And you do have libssh2 installed and finable by e.g. pkg-config? Otherwise you wouldn't expect it to be foundable. I would also recommend clearing out all the temporary files as cmake caching can sometimes be a bit odd.

carlosmn avatar Nov 15 '21 16:11 carlosmn