Installing libbzip2 on Windows

2019-09-05 23:06发布

I am trying to install libbzip2 on Windows 7. (Actually I want to install wp2txt package, but it seems need to libbzip2). I installed "Bzip2 for Windows" as suggested by Alex. But I get following errors.

C:\Users\John>gem install bzip2-ruby -- --with-bz2-include="C:\Program Files (x86)\GnuWin32\include" -- --with-bz2-lib="C:\Program Files (x86)\GnuWin32\lib"
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing bzip2-ruby:
        ERROR: Failed to build gem native extension.

        C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-bz2-include=C:\Program Files (x86)\GnuWin32\include -- --with-bz2-lib=C:\Program Files (x86)\GnuWin32\lib
checking for bzlib.h... no
checking for BZ2_bzWriteOpen() in -lbz2... no
*** 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:/RailsInstaller/Ruby1.9.3/bin/ruby
        --with-bz2-dir
        --without-bz2-dir
        --with-bz2-include=${bz2-dir}/include
        --with-bz2-lib=${bz2-dir}/lib
        --with-bz2lib
        --without-bz2lib
libbz2 not found, maybe try manually specifying --with-bz2-dir to find it?


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bzip2-ruby-0.2.7 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bzip2-ruby-0.2.7/ext/gem_make.out

1条回答
女痞
2楼-- · 2019-09-05 23:36

There are several issues.

1) You need to install bzip2 libs. Download zipped libs from Bzip2 for Windows, Binaries. Unpack them to some directory, say C:\GnuWin32\bzip2-1.0.5-bin. lib subdir should contain libbz2.a, libbz2.def, libbz2.dll.a. This path (C:\GnuWin32\bzip2-1.0.5-bin\lib) should be provided to --with-bz2-lib.

2) The package bzip2-ruby seems to have a not-fixed error yet according to the author github.com/brianmario (version.h is absent). So you can install bzip2-ruby-rb20 as he suggests.

3) Now install bzip2-ruby-rb20 providing include and library dirs for bzip2 (installed in 1):

gem install bzip2-ruby-rb20 -- --with-bz2-include="C:\GnuWin32\bzip2-1.0.5-bin\include" -- --with-bz2-lib="C:\GnuWin32\bzip2-1.0.5-bin\lib"

Should be done: "1 gem installed"

查看更多
登录 后发表回答