bzip2-ruby Windows Install - ruby-on-rails

I'm attempted to install the bzip2-ruby gem on Windows 7 x64. Now I don't know if this gem even works on 64-bit Windows. I did install bzip2 which got installed to C:\Program Files (x86)\GnuWin32.
When I go to install, the run the following command:
gem install bzip2-ruby -- --with-bz2-dir="C:\Program Files (x86)\GnuWin32\"
When that runs I get the following output:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
*** 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:/Ruby193/bin/ruby
--with-bz2-dir
--with-bz2-include
--without-bz2-include=${bz2-dir}/include
--with-bz2-lib
--without-bz2-lib=${bz2-dir}/lib
--with-bz2lib
--without-bz2lib
ERROR: Error installing bzip2-ruby:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-bz2-dir=C:\Program Files (x86)\GnuWin32"
checking for bzlib.h... no
checking for BZ2_bzWriteOpen() in -lbz2... no
libbz2 not found, maybe try manually specifying --with-bz2-dir to find it?
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/bzip2-ruby-0.2.7 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/bzip2-ruby-0.2.7/ext/gem_make.out
I can verify that the libbz2.a, libbz2.def, and the libbz2.dll.a files exist in the lib folder at the path above.
Am I just missing an extra option when running the command to specify the lib folder?
Thanks!

For GCC (the compiler bundled in RubyInstaller DevKit) to properly work, you need to use path without spaces.
The option to extconf that you provided has a path with spaces. Please relocate the lib, include and bin folders from bzip2 into a directory without spaces and try again.
Also, you need to have both headers (found in include directory) and the import library (found in lib directory) for extension compilation to work.
Hope that helps.

Related

Can´t install tiny_tds in Windows 10

When I run:
gem install tiny_tds
The output tells me that I need FreeTDS installed. Next, it shows me some configuration options and that I'll probably need an option. The options are the following:
--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:/Ruby31-x64/bin/$(RUBY_BASE_NAME)
--help
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/lib
--with-sybdb-dir
--without-sybdb-dir
--with-sybdb-include
--without-sybdb-include=${sybdb-dir}/include
--with-sybdb-lib
--without-sybdb-lib=${sybdb-dir}/lib
--with-sybdblib
--without-sybdblib
--with-sybdblib
--without-sybdblib
The problem is that none of the options work. Here´s an example of what happens:
C:\RailsApps>gem install tiny_tds -- --with-freetds-dir
Temporarily enhancing PATH for MSYS/MINGW...
Using msys2 packages: mingw-w64-ucrt-x86_64-freetds
Building native extensions with: '--with-freetds-dir'
This could take a while...
ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tiny_tds-2.1.5/ext/tiny_tds
C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/3.1.0 -r ./siteconf20220308-11104-
42q9r4.rb extconf.rb --with-freetds-dir
*** 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:/Ruby31-x64/bin/$(RUBY_BASE_NAME)
--help
--with-freetds-dir
C:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:1807:in `dir_config': undefined method `split' for true:TrueClass (NoMethodError)
defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)
^^^^^^
from extconf.rb:56:in `<main>'
looking for freetds headers in the following directories:
- /opt/local/include
- /opt/local/include/freetds
- /usr/local/include
- /usr/local/include/freetds
looking for freetds library in the following directories:
- /opt/local/lib
- /opt/local/lib/freetds
- /usr/local/lib
- /usr/local/lib/freetds
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tiny_tds-2.1.5 for inspection.
Results logged to C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/tiny_tds-2.1.5/gem_make.out
I found an downloaded the FreeTDS binaries to try the Windows manual installation, but I don´t know where to place them or how to use them.
I figured it out thanks to the previous posts, by looking at the freetds windows zipfile and the installed pacman package.
It's probably looking for the include folder headers at C:\Ruby31-x64\msys64\ucrt64\include
However it is at C:\Ruby31-x64\msys64\ucrt64\include\freetds
The .exe files interestingly are at C:\Ruby31-x64\msys64\ucrt64\bin and are found.
gem install tiny_tds -- --with-freetds-include=C:\Ruby31-x64\msys64\ucrt64\include\freetds
also see: Tiny TDS GitHub Issue 503
Well, thanks to Jared Beck, I finally was able to precompile the FreeTDS binaries. I used Ruby on Rails in the past, but never needed to do such thing, so I didn´t know the syntax. I thought that running the command gem install tiny_tds included the FreeTDS installation. Then I noticed the configuration options and tried running gem install tiny_tds -- --with-freetds-dir, but didn´t know that the command required the directory as an argument.
Finally, I downloaded the FreeTDS Windows binary from https://sourceforge.net/projects/freetdswindows/, extracted it in C:, and ran the following command:
gem install tiny_tds -- --with-freetds-dir=C:\freetds-1.00

Cannot install uchardet gem on Mac OS catalina

Recently I got the following errors when I tried to install the uchardet GEM in MacOS catalina,Even I specific the ICU version and lib, it still doesn't work, anyone have ideas?
Installing uchardet 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0/ext
/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/ruby -I /Users/xxx/.rvm/rubies/ruby-2.6.4/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200420-38494-q9y0cf.rb extconf.rb
Could not find ICU libraries and/or development tools. Try installing "icu-devtools" or "icu" package.
*** 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
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/$(RUBY_BASE_NAME)
extconf failed, exit code 1
Gem files will remain installed in /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0 for inspection.
Results logged to /Users/xxx/.rvm/gems/ruby-2.6.4/extensions/x86_64-darwin-19/2.6.0/uchardet-0.2.0/gem_make.out
I was able to reproduce this on my mac:
I fixed this error by re-installing and re-linking icu4c
brew install icu4c
brew link icu4c --force # if it shows you an error and tells you to add the path manually add them
restarted my terminal then re-installed the gem (i also tried this)
you will know it's working when you have which icu-config working https://github.com/dmgk/uchardet/blob/506105c5322fe3cde7ce3e2b2868f875b9b57230/ext/extconf.rb#L3-L6
however now i have another error uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found i do think the gems needs better configuration around this

Configuring Fog to install in Ruby on Rails project

I'm learning ruby on rails and have had my project hosted on c9.io. In the process of migrating over to Amazon AWS Cloud9 I'm having to reinstall my gems to my project. I am getting a config error while trying to build gem native extensions.
I'm not actually sure how to configure this gem before I enter 'gem install fog' into the command line. I've tried searching on the Fog website but I can't find the info on their page.
The error is:
Building native extensions. This could take a while...
ERROR: Error installing fog:
ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.rvm/gems/ruby-2.3.4/gems/ovirt-engine-sdk-4.3.0/ext/ovirtsdk4c
/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/ruby -r ./siteconf20190515-17400-2yzzer.rb extconf.rb
checking for xml2-config... 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=/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
--with-libxml2-config
--without-libxml2-config
--with-pkg-config
--without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ubuntu/.rvm/gems/ruby-2.3.4/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.3.0/mkmf.log
extconf failed, exit code 1
The mkmf.log says:
find_executable: checking for xml2-config... -------------------- no
--------------------
"pkg-config --exists libxml2"
package configuration for libxml2 is not found
I just don't know how to translate this log message into my codebase so I can install fog and continue working on my app.
Instead of
gem 'fog'
Use
gem 'fog-aws'
In your gem file and it should work.
Try installing xml2 development package:
apt-get install libxml2-dev
This should work! (You might need to re-install Ruby after that.)

Rails, heroku installing puma on different disk gives error

I created free account on heroku. Now I am trying this getting started. My DevKit Ruby and openssl are placed inside my D:\ disk, not C:\, beacuse there is reason why I can't use C:\ disk. All files directories are placed in my path.
I have tried to install puma gem by this method, only defference is that disk name is D:\.
When I run gem install puma -- --with-opt-dir=D:\openssl it throws me an long error:
D:\>gem install puma -- --with-opt-dir=D:\openssl
Building native extensions with: '--with-opt-dir=D:\openssl'
This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
D:/Ruby21-x64/bin/ruby.exe -r ./siteconf20150406-5096-1vz5x1.rb extconf.rb -
-with-opt-dir=D:\openssl
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... 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
--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=D:/Ruby21-x64/bin/ruby
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in D:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/puma-2
.11.1 for inspection.
Results logged to D:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0
/puma-2.11.1/gem_make.out
UPDATE
I have copied my libeay32.dll and ssleay32.dll inside of my D:\openssl\bin to D:\Ruby21-x64\bin. It said me that it already has these files, so I replaced them.
When I run gem install puma -- --with-opt-dir=D:\openssl it still throws me an error.
I have found solution.
Heroku site in this link gives OpenSSL ONLY FOR x86. If you have x64 you need to download it from there.
I hope in future Heroku will provide x64 ssl links in their tutorials.

Installing RMagick Error on windows 7 to create image with Ruby on rails

Hello Guys now i found this video to installing RMagick on windows 7
http://www.youtube.com/watch?v=gEWAVlNCKhg
by using this steps
1- install ImageMagick static on the directory C:/ImageMagick
2- install ImageMagick dll on the same directory C:/ImageMagick
3- Extract the ImageMagick-6.8.8-2.tar on the same directory C:/ImageMagick and rename the folder to "SourceCode"
4- install mingw on the directory C:/MinGW
5- add the path (C:/MinGW) to my windows Environment Variables
After making all the steps when i try to run the command
gem install rmagick
OR
gem install rmagick -- '--with-opt-dir="C:/ImageMagick"'
it gave me this Error ??
why I always got this error ???????
how i can solve this issue ????
note : also i followed the steps in this article
http://rubylearning.com/blog/how-do-i-install-a-ruby-gem-with-native-extensions-on-windows/
to fixed gem native extension but still got the same error
Error : Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
* 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
extconf.rb:172:in `': Invalid argument - convert -version (Errno::EINVAL)
from extconf.rb:172:in'
Guy
finaly i got the true method to install it on windows 7
1- install ImageMagick-6.7.9-0-Q16-windows-static.exe in the path C:/ImageMagic
2- install ImageMagick-6.7.9-0-Q16-windows-dll.exe in the path C:/ImageMagic
3- Extract the ImageMagick-6.8.8-2.tar in folder and rename it to SourceCode then set it in the path C:/ImageMagic/SourceCode
4- install mingw-get-setup.exe in the path C:/MinGW
5- define the Environment Variables for the user
PATH - C:\MinGW\bin;
6- used the command (gem install rmagick -- '--with-opt-dir="C:/ImageMagick"')
7 - open Gemfile and set (gem 'rmagick')
8 - type the command (bundle-install)
you can follow this article
https://github.com/rmagick/rmagick/wiki
the error happen to me because i was installed the ImageMagick version 6.8

Resources