我正在尝试在Windows 7上安装libbzip2。(实际上我想安装wp2txt
包,但似乎需要libbzip2)。我按照Alex的建议安装了“Bzip2 for Windows”。但我得到以下错误。
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
答案 0 :(得分:2)
有几个问题。
1)您需要安装bzip2库。从Bzip2 for Windows二进制文件下载压缩库。将它们解压缩到某个目录,例如C:\ GnuWin32 \ bzip2-1.0.5-bin。 lib subdir应该包含libbz2.a,libbz2.def,libbz2.dll.a。 应将此路径(C:\ GnuWin32 \ bzip2-1.0.5-bin \ lib)提供给--with-bz2-lib。
2)根据作者github.com/brianmario(版本h不存在),包bzip2-ruby似乎还有一个未修复的错误。所以你可以按照他的建议安装bzip2-ruby-rb20。
3)现在安装bzip2-ruby-rb20,为bzip2提供include和library dirs(安装在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"
应该完成:“1 gem安装”