nurse / strptime

a fast strptime engine
Other
38 stars 12 forks source link

Unable to install using gem install strptime on Windows server 2012 R2, Ruby 2.4.0 #14

Closed bcharboneauiherb closed 6 years ago

bcharboneauiherb commented 6 years ago

trying to install for use with fluentd/td-agent but it wont even install with ruby 2.4.0

Installation Attempt with Error output

PS C:\opt\td-agent> gem install strptime
Building native extensions.  This could take a while...
ERROR:  Error installing strptime:
        ERROR: Failed to build gem native extension.

    current directory: c:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/strptime-0.2.3/ext/strptime
c:/opt/td-agent/embedded/bin/ruby.exe -r ./siteconf20180221-8432-wkrpbh.rb extconf.rb
checking for rb_timespec_now()... *** 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:/opt/td-agent/embedded/bin/$(RUBY_BASE_NAME)
c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:468:in `try_do': The compiler failed to generate an executable file. (Ru
ntimeError)
You have to install development tools first.
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:553:in `try_link0'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:568:in `try_link'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:779:in `try_func'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:1066:in `block in have_func'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:956:in `block in checking_for'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:351:in `block (2 levels) in postpone'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:321:in `open'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:351:in `block in postpone'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:321:in `open'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:347:in `postpone'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:955:in `checking_for'
        from c:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:1065:in `have_func'
        from extconf.rb:3:in `<main>'

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

  c:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/strptime-0.2.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in c:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/strptime-0.2.3 for inspection.
Results logged to c:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/strptime-0.2.3/gem_make.out

mkmf.log file

"gcc -o conftest.exe -Ic:/opt/td-agent/embedded/include/ruby-2.4.0/x64-mingw32 -Ic:/opt/td-agent/embedded/include/ruby-2.4.0/ruby/backward -Ic:/opt/td-agent/embedded/include/ruby-2.4.0 -I. -IC:/opt/td-agent/embedded/include -m64 -O3 -march=x86-64 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -IC:/opt/td-agent/embedded/include -O3 -march=x86-64 -DFD_SETSIZE=2048 conftest.c  -L. -Lc:/opt/td-agent/embedded/lib -L. -LC:/opt/td-agent/embedded/lib -fno-lto  -m64   -lx64-msvcrt-ruby240  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */
nurse commented 6 years ago

As the error message says "You have to install development tools first.", you need install Visual Studio, which includes C compiler to compile strptime.

You need to install Visual Studio with some external depenencies, or just install fluentd with msi https://docs.fluentd.org/v1.0/articles/install-by-msi

bcharboneauiherb commented 6 years ago

which development tools are required? a full copy of visual Studio, the "c++ Build Tools" or the "c++ Redistributable package"?

nurse commented 6 years ago

If you don't find the required tools by yourself, please use .msi.