-
Notifications
You must be signed in to change notification settings - Fork 138
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
Support ruby-mswin environment on Windows #425
Conversation
There is some Ruby environment on Windows. 1. MinGW 2. mswin 3. cygwin The problem in MinGW was fixed in rmagick#315 This patch will fix the problem in mswin by adjusting compiler flag values for Visual Studio 2017. * Before patch ``` C:\tmp>ruby -v ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mswin64_140] C:\tmp>gem install rmagick-3.0.0.gem Building native extensions. This could take a while... ERROR: Error installing rmagick-3.0.0.gem: ERROR: Failed to build gem native extension. current directory: C:/usr/lib/ruby/gems/2.5.0/gems/rmagick-3.0.0/ext/RMagick C:/usr/bin/ruby.exe -r ./siteconf20190303-1888-cmo6ru.rb extconf.rb checking for X11.lib... *** 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 --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --srcdir=. --curdir --ruby=C:/usr/bin/ruby --with-X11lib --without-X11lib C:/usr/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/usr/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0' from C:/usr/lib/ruby/2.5.0/mkmf.rb:559:in `try_link' from C:/usr/lib/ruby/2.5.0/mkmf.rb:778:in `try_func' from C:/usr/lib/ruby/2.5.0/mkmf.rb:1005:in `block in have_library' from C:/usr/lib/ruby/2.5.0/mkmf.rb:948:in `block in checking_for' from C:/usr/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone' from C:/usr/lib/ruby/2.5.0/mkmf.rb:320:in `open' from C:/usr/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone' from C:/usr/lib/ruby/2.5.0/mkmf.rb:320:in `open' from C:/usr/lib/ruby/2.5.0/mkmf.rb:346:in `postpone' from C:/usr/lib/ruby/2.5.0/mkmf.rb:947:in `checking_for' from C:/usr/lib/ruby/2.5.0/mkmf.rb:1000:in `have_library' from extconf.rb:152:in `configure_compile_options' from extconf.rb:17:in `initialize' from extconf.rb:452:in `new' from extconf.rb:452:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/usr/lib/ruby/gems/2.5.0/extensions/x64-mswin64-140/2.5.0/rmagick-3.0.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/usr/lib/ruby/gems/2.5.0/gems/rmagick-3.0.0 for inspection. Results logged to C:/usr/lib/ruby/gems/2.5.0/extensions/x64-mswin64-140/2.5.0/rmagick-3.0.0/gem_make.out ``` * After patch ``` C:\tmp\new>gem install rmagick-3.0.0.gem Building native extensions. This could take a while... Successfully installed rmagick-3.0.0 Parsing documentation for rmagick-3.0.0 Done installing documentation for rmagick after 2 seconds 1 gem installed C:\tmp\new>ruby -v -e 'require "rmagick"; puts Magick::Version' ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mswin64_140] RMagick 3.0.0 ```
$CPPFLAGS = %(-I"#{dir_paths[:include]}") | ||
$LDFLAGS = %(-L"#{dir_paths[:lib]}") | ||
|
||
have_library('CORE_RL_magick_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have_library
do anything here? it looks like we're returning the line below, so not sure whether we need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that have_library('CORE_RL_magick_')
check whether specified library is existed and generate compiler flag to link the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. I thought maybe it just returned true
or false
.
There is some Ruby environment on Windows.
The problem in MinGW was fixed in #315
This patch will fix the problem in mswin by adjusting compiler flag values for Visual Studio 2017.