Ruby bson_ext gem is not installing in windows
the #include in the file cbson.c should be changed into #include. Then you need to build the your own gem and install it locally
Following thread describes it perfectly:
windows: rails: error installing bson_ext
Why do I get an error installing bson_ext?
Not sure why your make
is not using the correct install
. But it's easy to do a quick fix:
sudo ln -s /usr/bin/install /bin/install
This will link the existing install into /bin
and should enable make
to continue.
MongoMapper and bson_ext problem
The problem is: the bson_ext gem version and the mongo gem version need to match, also, mongo_mapper isn't ready for mongo-1.0.1 yet, so the versions of the mongo and bson_ext gems you should be using are 1.0 for each, respectively.
so, do the following:
gem install mongo -v=1.0 --no-ri --no-rdoc && \
gem install bson_ext -v=1.0 --no-ri --no-rdoc
then for Rails 2.x in your config/environment.rb do:
config.gem 'mongo', :version => '1.0'
config.gem 'bson_ext', :version => '1.0'
or for Rails 3, in your Gemfile:
gem 'mongo', '1.0'
gem 'bson_ext', '1.0'
bson_ext gem install fails on macOS
This worked for me on MacOS 11.2.
gem install bson_ext -v '1.5.1' --source 'https://rubygems.org/' -- --with-cflags="-Wno-error=implicit-function-declaration"
gem install bson_ext issues
The issue is because a) the version of mongo and bson_ext must match and b) there must not be any other bson_ext version installed.
The comments on this issue helped me solved the issue.
Run: gem list | grep -w 'bson\|bson_ext\|mongo'
which will print out all the versions. It should look like:
bson (1.9.2)
bson_ext (1.9.2)
mongo (1.9.2)
And not like:
bson (2.3.0, 1.10.2, 1.9.2)
bson_ext (1.10.2, 1.9.2)
mongo (1.10.2, 1.9.2)
If so, (de)install versions as necessary.
Ruby mysql2 gem, cannot build on Windows 7
To install and compile extensions sometimes you need libraries and headers of the dependencies. In this case, you need MySQL headers and libraries to properly compile.
Assuming you downloaded Ruby from RubyInstaller and also installed the Development Kit and followed it's installation instructions, to successfuly install mysql2 gem I recommend you read this answer in our Troubleshooting page:
- Download MySQL Connector/C
- Extract into a path without spaces
- When installing mysql2 gem, provide the additional options (
gem install mysql2 -v 0.2.10 -- --with-mysql-include=... --with-mysql-lib...
)
Provide for --with-mysql-include
option the path to the include
directory of MySQL Connector/C. The same for --with-mysql-lib
but this time point to lib
directory.
Don't forget to copy libmysql.dll
to your Ruby bin
directory.
Hope this helps.
Related Topics
What Does "||=" Do in Ruby 1.9.2
Convert (Decode) Hexadecimal String to Binary String
Notification of Object Destruction in Ruby
How to Escape #{ from String Interpolation
Chaining Methods Using Symbol#To_Proc Shorthand in Ruby
How to Use Params with Slashes with Sinatra
No Such File or Directory - Git Ls-Files -- Windows
Error: Failed to Build Gem Native Extension (Ruby Extconf.Rb): MAC Osx
Getting Uninitialized Constant Error When Trying to Run Tests
What Is the Ruby Equivalent of Python's Getattr
How to Handle a Thread Issue in Zeromq + Ruby
How to Use Controller Specific Stylesheets in Rails 3.2.1
Rails: Unable to Access Log File
How to Send Message Using Gmail API with Ruby Google API Client