Roger's woze

November 20, 2009

installing rmagick with mingw and ruby 1.9

Filed under: Uncategorized — rogerdpack @ 1:04 am

Think I finally got it to work.

1) install ImageMagick from source using mingw, like (in msys bash) ./configure –prefix=/c/imagemagick –disable-perl && make && make install

http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/

lists a much easier way to do it (assuming you have the devkit installed):

install ImageMagick somewhere (with headers option checked, and yes add it to your path) (ImageMagick-6.6.2-Q16 known to work).

C:\> set CPATH=D:\installs\ImageMagick-6.6.2-Q16\include
C:\> set LIBRARY_PATH=D:\installs\ImageMagick-6.6.2-Q16\lib
C:\> gem install rmagick

Though he does list a few more steps that might be useful…

9 Comments »

  1. c:/ruby19/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2/lib/RMagick.rb:1944:in `from_color’: invalid color name: lightcyan2 (ArgumentError)
    from c:/ruby19/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2/lib/RMagick.rb:1944:in `initialize’
    from rmagick_installed_test.rb:6:in `new’
    from rmagick_installed_test.rb:6:in `

    meant “somehow or other you linked against an imagemagick that was old or outdated or incomplete or somefin–for me on mingw, recompiling it from scratch and using that version worked splendidly, though there are probably other options”

    Comment by rogerdpack — November 20, 2009 @ 1:05 am

  2. “gcc -o conftest -Ic:/ruby19/include/ruby-1.9.1/i386-mingw32 -Ic:/ruby19/include/ruby-1.9.1/ruby/backward -Ic:/ruby19/include/ruby-1.9.1 -I. -I/c/rdp/installsc:\rdp\installs\imagemagick/include/ImageMagick -D_DLL -D_MT -I/c/rdp/installsc:\rdp\installs\imagemagick/include/ImageMagick
    -D_DLL -D_MT conftest.c -L. -Lc:/ruby19/lib -L/c/rdp/installsc:\rdp\installs\imagemagick/lib -L/c/rdp/installsc:\rdp\installs\imagemagick/lib -lMagickCore -lgdi32 -lm -lmsvcrt-ruby191-static -lshell32 -lws2_32 ”
    checked program was:
    /* begin */
    1: #include “ruby.h”
    2:
    3: #include
    4: #include
    5: int main() {return 0;}
    /* end */

    checked program was:
    /* begin */
    1: #include
    /* end */

    failing meant “you need to have mingw friendlier paths in there -Lc:/something for whatever cruddy reason”

    Comment by rogerdpack — November 20, 2009 @ 1:08 am

  3. /home/rdp/i386/gemrepository/gems/rmagick-2.12.2/lib/RMagick2.so: [BUG] Segmentation fault
    ruby 1.8.7 (2009-3-4 mbari 8B/0×8770 on patchlevel 72) [i686-linux]

    Aborted

    meant “you are trying to use a binary compiled with a different version of ruby”

    Comment by rogerdpack — November 21, 2009 @ 3:43 am

  4. same with

    rmagick (2.12.2)
    [20:2048][rdp@ilab1:/tmp/rdp/p2pwebclient/src]$ ruby singleMultipleGraphs.rb unnamed316651_at6
    /home/rdp/i386/gemrepository/gems/rmagick-2.12.2/lib/RMagick2.so: [BUG] unknown type 0×22 (0xc given)
    ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

    – control frame ———-
    c:0040 p:—- s:0132 b:0132 l:000131 d:000131 CFUNC :initialize
    c:0039 p:—- s:0130 b:0130 l:000129 d:000129 CFUNC :initialize
    c:0038 p:-36542642 s:0128 b:0128 l:000127 d:000127 TOP
    c:0037 p:—- s:0126 b:0126 l:000125 d:000125 CFUNC :require
    c:0036 p:0048 s:0122 b:0122 l:000121 d:000121 METHOD /tmp/rdp/p2pwebclient/src/unique_require.rb:21
    c:0035 p:0011 s:0115 b:0115 l:000114 d:000114 TOP /home/rdp/i386/gemrepository/gems/rmagick-2.12.2/lib/RMagick.rb:11

    Comment by rogerdpack — November 21, 2009 @ 3:50 am

  5. http://groups.google.com/group/rubyinstaller/browse_thread/thread/c837c4438d91208b

    lists an even easier way [except currently broken with the latest version of ImageMagick, so I'll leave my notes up for not]

    Comment by rogerdpack — November 25, 2009 @ 4:27 pm

  6. [...] on Ruby 1.9.1 (i386-mingw32) Work !!! Ispirate from : installing rmagick with mingw and ruby 1.9 and http://groups.google.com/group/rubyinstaller/browse_thread/thread/c837c4438d91208b but , on my [...]

    Pingback by puts WaYdotNET => Carlo Bertini » RMagick on Ruby 1.9.1 (i386-mingw32) Work !!! :D — February 12, 2010 @ 9:29 pm

  7. http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/

    Comment by Carlo Bertini — February 12, 2010 @ 9:30 pm

  8. >gem install rmagick
    Building native extensions. This could take a while…
    ERROR: Error installing rmagick:
    ERROR: Failed to build gem native extension.

    D:/ruby18/bin/ruby.exe extconf.rb
    checking for Ruby version >= 1.8.5… yes
    Unable to get ImageMagick version
    *** extconf.rb failed ***

    meant “you want to install it from the source, see original post”

    Comment by rogerdpack — July 7, 2010 @ 6:38 am

  9. C:\dev>gem install rmagick
    Building native extensions. This could take a while…
    ERROR: Error installing rmagick:
    ERROR: Failed to build gem native extension.

    C:/installs/ruby191p376/bin/ruby.exe extconf.rb
    checking for Ruby version >= 1.8.5… yes
    checking for stdint.h… *** 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:/installs/ruby191p376/bin/ruby
    C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:364:in `try_do’: The complier failed to generate an executable file. (RuntimeError)
    You have to install development tools first.
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:433:in `try_cpp’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:811:in `block in have_header’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:670:in `block in checking_for’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels) in postpone’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:250:in `open’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:276:in `block in postpone’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:250:in `open’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:272:in `postpone’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for’
    from C:/installs/ruby191p376/lib/ruby/1.9.1/mkmf.rb:810:in `have_header’
    from extconf.rb:193:in `’

    Gem files will remain installed in C:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
    Results logged to C:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

    meant “you installed ImageMAgick without the development headers checkbox checked!”

    Comment by roger — July 8, 2010 @ 10:07 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress