libgit2 / rugged

ruby bindings to libgit2
MIT License
2.25k stars 277 forks source link

Installation (via gem install) is failing again on Windows 10 #830

Open BigBlueHat opened 4 years ago

BigBlueHat commented 4 years ago

Seems the pgroup error--which was fixed recently in #791--is back... 😢

Key line below is:

extconf.rb:33:in `spawn': wrong exec option symbol: pgroup (ArgumentError)

gem install licensee
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing licensee:
        ERROR: Failed to build gem native extension.

    current directory: C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rugged-0.28.4.1/ext/rugged
C:/tools/ruby26/bin/ruby.exe -I C:/tools/ruby26/lib/ruby/2.6.0 -r ./siteconf20200116-30660-pcywhb.rb extconf.rb
checking for make... yes
checking for cmake... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/tools/ruby26/bin/$(RUBY_BASE_NAME)
        --with-sha1dc
        --without-sha1dc
        --use-system-libraries
extconf.rb:33:in `spawn': wrong exec option symbol: pgroup (ArgumentError)
        from extconf.rb:33:in `run_cmake'
        from extconf.rb:104:in `block (2 levels) in <main>'
        from extconf.rb:101:in `chdir'
        from extconf.rb:101:in `block in <main>'
        from extconf.rb:98:in `chdir'
        from extconf.rb:98:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/tools/ruby26/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/rugged-0.28.4.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rugged-0.28.4.1 for inspection.
Results logged to C:/tools/ruby26/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/rugged-0.28.4.1/gem_make.out
preetpalS commented 4 years ago

This issue is solved with the latest release.

C:\Users\me>gem install rugged
Fetching rugged-0.99.0.gem
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-libssh2
warning: mingw-w64-x86_64-libssh2-1.9.0-1 is up to date -- skipping
Building native extensions. This could take a while...
Successfully installed rugged-0.99.0
1 gem installed

C:\Users\me>ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
phraemer commented 4 years ago

This is failing on Windows 10 for me and I'm kinda stuck at what to try next. Any help greatly appreciated.

gem install rugged -v `1.0.0` --source `https://rubygems.org/'

Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-libssh2
warning: mingw-w64-x86_64-libssh2-1.9.0-1 is up to date -- skipping
Building native extensions. This could take a while...
ERROR:  Error installing rugged:
        ERROR: Failed to build gem native extension.

    current directory: C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0/ext/rugged
C:/tools/ruby27/bin/ruby.exe -I C:/tools/ruby27/lib/ruby/2.7.0 -r ./siteconf20200515-4720-d4efog.rb extconf.rb
checking for make... yes
checking for cmake... yes
-- The C compiler identification is GNU 10.1.0
-- Check for working C compiler: C:/tools/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/tools/msys64/mingw64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: C:/tools/msys64/mingw64/bin/pkg-config.exe (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 - Failed
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC - Failed
-- 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 - Failed
-- 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_WNO_FORMAT_SUPPORTED
-- Performing Test IS_WNO_FORMAT_SUPPORTED - Success
-- Performing Test IS_WNO_FORMAT_SECURITY_SUPPORTED
-- Performing Test IS_WNO_FORMAT_SECURITY_SUPPORTED - Success
-- Looking for futimens
-- Looking for futimens - not found
-- Checking prototype qsort_r for HAVE_QSORT_R_BSD - False
-- Checking prototype qsort_r for HAVE_QSORT_R_GNU - False
-- Looking for qsort_s
-- Looking for qsort_s - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Found OpenSSL: C:/tools/msys64/mingw64/lib/libcrypto.dll.a (found version "1.1.1g")
-- Could NOT find PCRE (missing: PCRE_LIBRARY PCRE_POSIX_LIBRARY 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 - found
-- Looking for bcopy
-- Looking for bcopy - not 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 - not found
-- Looking for _strtoi64
-- Looking for _strtoi64 - 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 - Success
-- Found ZLIB: C:/tools/msys64/mingw64/lib/libz.dll.a (found version "1.2.11")
-- Checking for module 'libssh2'
--   Found libssh2, version 1.9.0
CMake Error at cmake/Modules/FindPkgLibraries.cmake:17 (MESSAGE):
  could not resolve ws2_32
Call Stack (most recent call first):
  src/CMakeLists.txt:204 (FIND_PKGLIBRARIES)

-- Configuring incomplete, errors occurred!
See also "C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0/vendor/libgit2/build/CMakeFiles/CMakeOutput.log".
See also "C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0/vendor/libgit2/build/CMakeFiles/CMakeError.log".
 -- C:\tools\msys64\usr\bin/make.exe
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/tools/ruby27/bin/$(RUBY_BASE_NAME)
        --with-sha1dc
        --without-sha1dc
        --use-system-libraries
extconf.rb:23:in `sys': ERROR: 'C:\\tools\\msys64\\usr\\bin/make.exe' failed (RuntimeError)
        from extconf.rb:107:in `block (2 levels) in <main>'
        from extconf.rb:103:in `chdir'
        from extconf.rb:103:in `block in <main>'
        from extconf.rb:100:in `chdir'
        from extconf.rb:100:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/tools/ruby27/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/rugged-1.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0 for inspection.
Results logged to C:/tools/ruby27/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/rugged-1.0.0/gem_make.out
ruby -v

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]

mkmf.log

find_executable: checking for make... -------------------- yes

--------------------

find_executable: checking for cmake... -------------------- yes

--------------------

C:\tools\msys64\usr\bin/make.exe
make: *** No targets specified and no makefile found.  Stop.
preetpalS commented 4 years ago

Try installing mingw-w64-x86_64-pcre and performing the installation again. You can install it with the following command from msys2.

pacman -S mingw-w64-x86_64-pcre
phraemer commented 4 years ago

@preetpalS , yep that works. Thanks. I guess it needs to be added to the install/build script?

phraemer commented 4 years ago

@preetpalS oops no sorry I was mistaken:

current directory: C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0/ext/rugged
C:/tools/ruby27/bin/ruby.exe -I C:/tools/ruby27/lib/ruby/2.7.0 -r ./siteconf20200518-10028-1p2h3ut.rb extconf.rb
checking for make... yes
checking for cmake... yes
-- The C compiler identification is GNU 10.1.0
-- Check for working C compiler: C:/tools/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/tools/msys64/mingw64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: C:/tools/msys64/mingw64/bin/pkg-config.exe (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 - Failed
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC - Failed
-- 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 - Failed
-- 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_WNO_FORMAT_SUPPORTED
-- Performing Test IS_WNO_FORMAT_SUPPORTED - Success
-- Performing Test IS_WNO_FORMAT_SECURITY_SUPPORTED
-- Performing Test IS_WNO_FORMAT_SECURITY_SUPPORTED - Success
-- Looking for futimens
-- Looking for futimens - not found
-- Checking prototype qsort_r for HAVE_QSORT_R_BSD - False
-- Checking prototype qsort_r for HAVE_QSORT_R_GNU - False
-- Looking for qsort_s
-- Looking for qsort_s - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Found OpenSSL: C:/tools/msys64/mingw64/lib/libcrypto.dll.a (found version "1.1.1g")  
-- Found PCRE: C:/tools/msys64/mingw64/lib/libpcre.dll.a  
-- 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 - found
-- Looking for bcopy
-- Looking for bcopy - not 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 - not found
-- Looking for _strtoi64
-- Looking for _strtoi64 - 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 - Success
-- Found ZLIB: C:/tools/msys64/mingw64/lib/libz.dll.a (found version "1.2.11") 
-- Checking for module 'libssh2'
--   Found libssh2, version 1.9.0
CMake Error at cmake/Modules/FindPkgLibraries.cmake:17 (MESSAGE):
  could not resolve ws2_32
Call Stack (most recent call first):
  src/CMakeLists.txt:204 (FIND_PKGLIBRARIES)

-- Configuring incomplete, errors occurred!
See also "C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0/vendor/libgit2/build/CMakeFiles/CMakeOutput.log".
See also "C:/tools/ruby27/lib/ruby/gems/2.7.0/gems/rugged-1.0.0/vendor/libgit2/build/CMakeFiles/CMakeError.log".
 -- C:\tools\msys64\usr\bin/make.exe
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=C:/tools/ruby27/bin/$(RUBY_BASE_NAME)
    --with-sha1dc
    --without-sha1dc
    --use-system-libraries
extconf.rb:23:in `sys': ERROR: 'C:\\tools\\msys64\\usr\\bin/make.exe' failed (RuntimeError)
    from extconf.rb:107:in `block (2 levels) in <main>'
    from extconf.rb:103:in `chdir'
    from extconf.rb:103:in `block in <main>'
    from extconf.rb:100:in `chdir'
    from extconf.rb:100:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/tools/ruby27/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/rugged-1.0.0/mkmf.log

extconf failed, exit code 1
preetpalS commented 4 years ago

The error says you are missing a library.

See https://github.com/libgit2/libgit2/issues/5502#issuecomment-624857906. Based on the discussion, there I would recommend the following:

Try running the following command and trying again (I have this package already installed): pacman -S mingw-w64-x86_64-crt-git If that doesn't work, run the following command and try again (I do not have this library installed): pacman -S msys2-w32api-runtime

Both commands install libraries.

rubin55 commented 4 years ago

I'm running into this issue also (Windows 10 release 2004, Ruby 2.7.1, x64). I tried installing all three packages (mingw-w64-x86_64-pcre, mingw-w64-x86_64-crt-git and msys2-w32api-runtime) mentioned above, to no avail. See output from console here:

C:\Users\rubin>gem install gollum
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-libssh2
warning: mingw-w64-x86_64-libssh2-1.9.0-2 is up to date -- skipping
Building native extensions. This could take a while...
ERROR:  Error installing gollum:
        ERROR: Failed to build gem native extension.

    current directory: C:/Users/rubin/.gem/ruby/2.7.0/gems/rugged-0.99.0/ext/rugged
C:/Program\ Files/Ruby/ruby27/bin/ruby.exe -I C:/Program\ Files/Ruby/ruby27/lib/ruby/2.7.0 -r ./siteconf20200701-16088-1c5npfw.rb extconf.rb
checking for make... yes
checking for cmake... yes
-- The C compiler identification is GNU 10.1.0
-- Check for working C compiler: C:/Program Files/Ruby/ruby27/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/Program Files/Ruby/ruby27/msys64/mingw64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: C:/Program Files/Ruby/ruby27/msys64/mingw64/bin/pkg-config.exe (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 - Failed
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC
-- Performing Test HAVE_STRUCT_STAT_MTIME_NSEC - Failed
-- 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 - Failed
-- 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_WNO_FORMAT_SUPPORTED
-- Performing Test IS_WNO_FORMAT_SUPPORTED - Success
-- Performing Test IS_WNO_FORMAT_SECURITY_SUPPORTED
-- Performing Test IS_WNO_FORMAT_SECURITY_SUPPORTED - Success
-- Looking for futimens
-- Looking for futimens - not found
-- Checking prototype qsort_r for HAVE_QSORT_R_BSD - False
-- Checking prototype qsort_r for HAVE_QSORT_R_GNU - False
-- Looking for qsort_s
-- Looking for qsort_s - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Found OpenSSL: C:/Program Files/OpenSSL/lib/libcrypto.lib (found version "1.1.1d")
-- Found PCRE: C:/Program Files/Ruby/ruby27/msys64/mingw64/lib/libpcre.dll.a
-- 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 - found
-- Looking for bcopy
-- Looking for bcopy - not 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 - not found
-- Looking for _strtoi64
-- Looking for _strtoi64 - 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 - Success
-- Found ZLIB: C:/Program Files/Ruby/ruby27/msys64/mingw64/lib/libz.dll.a (found version "1.2.11")
-- Checking for module 'libssh2'
--   Found libssh2, version 1.9.0
--   Resolved libraries: C:/Program Files/Ruby/ruby27/msys64/mingw64/lib/libssh2.dll.a
-- Looking for libssh2_userauth_publickey_frommemory in C:/Program Files/Ruby/ruby27/msys64/mingw64/lib/libssh2.dll.a
-- Looking for libssh2_userauth_publickey_frommemory in C:/Program Files/Ruby/ruby27/msys64/mingw64/lib/libssh2.dll.a - found
-- Could NOT find GSSAPI (missing: GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
-- Enabled features:
 * nanoseconds, whether to use sub-second file mtimes and ctimes
 * tracing, tracing support
 * threadsafe, threadsafe support
 * HTTPS, using WinHTTP
 * SHA, using CollisionDetection
 * regex, using bundled PCRE
 * http-parser, http-parser support (bundled)
 * zlib, using system zlib
 * SSH, SSH transport support

-- Disabled features:
 * debugpool, debug pool allocator
 * ntlmclient, NTLM authentication support for Unix
 * SPNEGO, SPNEGO authentication support
 * iconv, iconv encoding conversion support

-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/rubin/.gem/ruby/2.7.0/gems/rugged-0.99.0/vendor/libgit2/build
 -- C:\Program Files\Ruby\ruby27\msys64\usr\bin/make.exe
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Program Files/Ruby/ruby27/bin/$(RUBY_BASE_NAME)
        --with-sha1dc
        --without-sha1dc
        --use-system-libraries
extconf.rb:23:in `sys': ERROR: 'C:\\Program Files\\Ruby\\ruby27\\msys64\\usr\\bin/make.exe' failed (RuntimeError)
        from extconf.rb:107:in `block (2 levels) in <main>'
        from extconf.rb:103:in `chdir'
        from extconf.rb:103:in `block in <main>'
        from extconf.rb:100:in `chdir'
        from extconf.rb:100:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/Users/rubin/.gem/ruby/2.7.0/extensions/x64-mingw32/2.7.0/rugged-0.99.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Users/rubin/.gem/ruby/2.7.0/gems/rugged-0.99.0 for inspection.
Results logged to C:/Users/rubin/.gem/ruby/2.7.0/extensions/x64-mingw32/2.7.0/rugged-0.99.0/gem_make.out

The mkmf.log contains only this:

find_executable: checking for make... -------------------- yes

--------------------

find_executable: checking for cmake... -------------------- yes

--------------------

"C:\Program Files\Ruby\ruby27\msys64\usr\bin/make.exe"

When I go to the build directory of libgit2 in the vendor directory of the package and try to run make on the cmake-generated Makefile, I get this:

rubin@ADAM MSYS /c/Users/rubin/.gem/ruby/2.7.0/gems/rugged-0.99.0/vendor/libgit2/build
$ make
Scanning dependencies of target http-parser
[  0%] Building C object deps/http-parser/CMakeFiles/http-parser.dir/http_parser.c.obj
make[2]: *** [deps/http-parser/CMakeFiles/http-parser.dir/build.make:83: deps/http-parser/CMakeFiles/http-parser.dir/http_parser.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:261: deps/http-parser/CMakeFiles/http-parser.dir/all] Error 2
make: *** [Makefile:150: all] Error 2

Any pointers appreciated. Note: Tested with Rugged 0.99, 1.0.0 and 1.0.1.

preetpalS commented 4 years ago

@rubin55 Are your msys2 dependencies up to date? Have you run pacman -Syu recently (you might have to run it twice, since it will require a restart if it updates the core libraries). It seems like you the latest packages though because of your compiler version.

rubin55 commented 4 years ago

Yes, latest version, all packages updated.

I'm also trying to just install the mingw-w64-x86_64-crt-git package, and I verified I have a libws2_32.a in /mingw64/x86_64-w64-mingw32/lib. I'm doing:

ridk exec pacman -S mingw-w64-x86_64-crt-git
gem install rugged -- -DCMAKE_LIBRARY_PATH=/mingw64/x86_64-w64-mingw32/lib

And I still get:

CMake Error at cmake/Modules/FindPkgLibraries.cmake:17 (MESSAGE):
  could not resolve ws2_32
rubin55 commented 4 years ago

I was able to install rugged by making it use the libgit2 library provided by mingw64 (you need to upgrade packages first due to libgit needing to be at least version 1.0.0):

ridk exec pacman -Syu (ctrl-c when told to exit)
ridk exec pacman -Syu
ridk exec pacman -S mingw-w64-x86_64-libgit2
gem install rugged -- --use-system-libraries

This results in a succesfully installed gem, but trying to use it, I get this:

C:\Users\rubin>irb
irb(main):001:0> require 'rugged'
Traceback (most recent call last):
       11: from C:/ProgramData/RUBY26/bin/irb.cmd:31:in `<main>'
       10: from C:/ProgramData/RUBY26/bin/irb.cmd:31:in `load'
        9: from C:/PROGRA~1/RUBY/RUBY26/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        8: from (irb):1
        7: from C:/PROGRA~1/RUBY/RUBY26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
        6: from C:/PROGRA~1/RUBY/RUBY26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
        5: from C:/PROGRA~1/RUBY/RUBY26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
        4: from C:/Users/rubin/.gem/ruby/2.6.0/gems/rugged-0.99.0/lib/rugged.rb:6:in `<top (required)>'
        3: from C:/Users/rubin/.gem/ruby/2.6.0/gems/rugged-0.99.0/lib/rugged.rb:10:in `rescue in <top (required)>'
        2: from C:/PROGRA~1/RUBY/RUBY26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        1: from C:/PROGRA~1/RUBY/RUBY26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
LoadError (126: The specified module could not be found.   - C:/Users/rubin/.gem/ruby/2.6.0/gems/rugged-0.99.0/lib/rugged/rugged.so)

The file rugged.so does exist at the aforementioned location; I am supposing it can't find the libgit2 library because of the --use-system-libraries. How do I fix that?

cfillion commented 4 years ago
CMake Error at cmake/Modules/FindPkgLibraries.cmake:17 (MESSAGE):
  could not resolve ws2_32

It seems that something breaks when building libgit2 with CMake 3.17 or newer in a msys2 environment. Downgrading CMake to 3.16.8 (from https://cmake.org/download/) makes rugged able to build libgit2 and install successfully here.

rubin55 commented 4 years ago

It seems that something breaks when building libgit2 with CMake 3.17 or newer in a msys2 environment. Downgrading CMake to 3.16.8 makes rugged able to build libgit2 and install successfully here.

I just downgraded to Cmake 3.16.5 (I could not find a package for Cmake 3.16.8 on the MingW mirrors) and I'm getting the exact same error (after running gem install rugged -v 0.99).

preetpalS commented 4 years ago

I never had any issues with CMake 3.17, but I might not be using the same version of CMake as you are. I am using mingw-w64-x86_64-cmake 3.17.3-1 from the default source for packages (I never configured any mirrors). I attached a list of all the packages I have installed in msys2 below in case it may help. FWIW I was able to install the rugged gem without any issues with these packages.

Command I used to install the package (and usage of library on Windows showing that it installs). ``` C:\Users\preet>gem install rugged -v 1.0.1 Fetching rugged-1.0.1.gem Temporarily enhancing PATH for MSYS/MINGW... Installing required msys2 packages: mingw-w64-x86_64-libssh2 warning: mingw-w64-x86_64-libssh2-1.9.0-2 is up to date -- skipping Building native extensions. This could take a while... Successfully installed rugged-1.0.1 1 gem installed C:\Users\preet>irb irb(main):001:0> require 'rugged' => true irb(main):002:0> puts Rugged::Version 1.0.1 => nil irb(main):003:0> Dir.chdir('C:/tmp') => 0 irb(main):004:0> Dir.pwd => "C:/tmp" irb(main):005:0> Dir.mkdir('test') && Dir.chdir('test') && Rugged::Repository.init_at('.', :bare) => # irb(main):007:0> repo = Rugged::Repository.discover('.') irb(main):008:0> repo.bare? => true irb(main):009:0> exit C:\Users\preet>ruby -v ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32] C:\Users\preet> ```
Listing of msys2 packages and information on what CMake version I have. ``` preet@DESKTOP MINGW64 ~ $ pacman -Qe asciidoc 9.0.0rc2-1 autoconf 2.69-5 autoconf2.13 2.13-2 autogen 5.18.16-1 automake-wrapper 11-1 automake1.10 1.10.3-3 automake1.11 1.11.6-3 automake1.12 1.12.6-3 automake1.13 1.13.4-4 automake1.14 1.14.1-3 automake1.15 1.15.1-1 automake1.6 1.6.3-2 automake1.7 1.7.9-2 automake1.8 1.8.5-3 automake1.9 1.9.6-2 bash 4.4.023-2 bash-completion 2.10-1 bison 3.6.4-1 bsdcpio 3.4.3-1 bsdtar 3.4.3-1 bzip2 1.0.8-2 cloc 1.86-1 coreutils 8.32-1 curl 7.71.0-1 dash 0.5.11-1 diffstat 1.63-1 diffutils 3.7-1 dos2unix 7.4.1-1 dtc 1.6.0-2 file 5.39-1 filesystem 2020.02-4 findutils 4.7.0-1 flex 2.6.4-1 gawk 5.1.0-1 gcc-libs 9.3.0-1 gdb 9.2-1 getent 2.18.90-2 gettext-devel 0.19.8.1-1 git 2.27.0-1 gnutls 3.6.14-1 gperf 3.1-1 grep 3.0-2 groff 1.22.4-1 gzip 1.10-1 help2man 1.47.15-1 inetutils 1.9.4-2 info 6.7-2 intltool 0.51.0-2 lemon 3.31.1-1 less 551-1 libargp 20110921-2 libgnutls-devel 3.6.14-1 libsqlite-devel 3.30.0-1 libssh2-devel 1.9.0-1 libtool 2.4.6-9 libunrar 5.9.3-1 libunrar-devel 5.9.3-1 lndir 1.0.3-1 make 4.3-1 man-db 2.9.3-1 mingw-w64-x86_64-binutils 2.34-3 mingw-w64-x86_64-clang 10.0.0-2 mingw-w64-x86_64-cmake 3.17.3-1 mingw-w64-x86_64-crt-git 8.0.0.5941.736c7a24-1 mingw-w64-x86_64-dbus 1.12.18-1 mingw-w64-x86_64-dlfcn 1.2.0-1 mingw-w64-x86_64-gcc 10.1.0-3 mingw-w64-x86_64-gcc-ada 10.1.0-3 mingw-w64-x86_64-gcc-fortran 10.1.0-3 mingw-w64-x86_64-gcc-libs 10.1.0-3 mingw-w64-x86_64-gcc-objc 10.1.0-3 mingw-w64-x86_64-gdb 9.2-1 mingw-w64-x86_64-giflib 5.2.1-1 mingw-w64-x86_64-glpk 4.65-1 mingw-w64-x86_64-gnutls 3.6.14-1 mingw-w64-x86_64-go 1.14.4-1 mingw-w64-x86_64-gsl 2.6-1 mingw-w64-x86_64-headers-git 8.0.0.5941.736c7a24-1 mingw-w64-x86_64-hunspell 1.7.0-5 mingw-w64-x86_64-hunspell-en 2019.10.06-1 mingw-w64-x86_64-jbigkit 2.1-4 mingw-w64-x86_64-lapack 3.8.0-5 mingw-w64-x86_64-libgit2 1.0.1-1 mingw-w64-x86_64-libmangle-git 8.0.0.5573.a4de8df4-1 mingw-w64-x86_64-librsvg 2.48.7-1 mingw-w64-x86_64-libsodium 1.0.18-1 mingw-w64-x86_64-libwinpthread-git 8.0.0.5906.c9a21571-1 mingw-w64-x86_64-libxslt 1.1.34-2 mingw-w64-x86_64-make 4.3-1 mingw-w64-x86_64-openblas 0.3.10-1 mingw-w64-x86_64-pkg-config 0.29.2-1 mingw-w64-x86_64-postgresql 12.3-1 mingw-w64-x86_64-ruby 2.7.1-2 mingw-w64-x86_64-sqlite3 3.32.3-1 mingw-w64-x86_64-tools-git 8.0.0.5903.3310d459-1 mingw-w64-x86_64-winpthreads-git 8.0.0.5906.c9a21571-1 mingw-w64-x86_64-winstorecompat-git 8.0.0.5903.3310d459-1 mingw-w64-x86_64-xpm-nox 4.2.0-5 mintty 1~3.2.0-1 msys2-keyring r21.b39fb11-1 msys2-launcher 1.0-1 msys2-runtime 3.1.5-3 ncurses 6.2-1 pacman 5.2.1-12 pacman-mirrors 20200329-1 pactoys-git r2.07ca37f-1 patch 2.7.6-1 patchutils 0.3.4-1 pax-git 20161104.2-1 pkg-config 0.29.2-1 pkgfile 21-1 quilt 0.66-2 rcs 5.9.4-2 rebase 4.4.4-1 rsync 3.1.3-1 scons 3.1.2-4 sed 4.8-1 swig 4.0.2-1 texinfo 6.7-2 texinfo-tex 6.7-2 tftp-hpa 5.2-3 time 1.9-1 ttyrec 1.0.8-2 tzcode 2020a-1 unrar 5.9.3-1 unzip 6.0-2 util-linux 2.35.1-1 which 2.21-2 xmlto 0.0.28-2 zip 3.0-3 preet@DESKTOP MINGW64 ~ $ cmake --version cmake version 3.17.3 CMake suite maintained and supported by Kitware (kitware.com/cmake). preet@DESKTOP MINGW64 ~ $ which cmake /mingw64/bin/cmake preet@DESKTOP MINGW64 ~ $ ```