According to this post <arpa/inet.h>
is not a windows library, so winsock2.h
should be used instead.
To change this reference, I've done the following**:
- Go to your installation folder (c:/Ruby193/lib/ruby/gems/1.9.1/gems/bson_ext-1.11.1)
- Drill down a level into the cbson folder and find cbson.c
- Open cbson.c in your favorite text editor and find the line that reads
#include "<arpa/inet.h>"
- Change that line to
#include winsock2.h
- Open a command prompt, browse to the installation folder, and run
gem build bson_ext.gemspec
- Move the newly-created .gem file someplace safe (%userprofile%Desktop, for example).
- Go up to the gem folder and delete the entire bson_ext folder
- Back in your command prompt window, change directory to wherever you placed the newly-created .gem file (cd %userprofile%Desktop, if you're following these steps exactly)
- Run
gem install bson_ext-1.11.1.gem --local
and the gem should now install successfully.
** Huge caveat: I am just running through a mongodb for rails tutorial and I don't have any functioning code with which to test this. While this removes the installation error, I have no way of determining if this fix is a complete one. This library reference is new for the 1.11.1 release. If you install version 1.10.2 this issue will not occur (gem install bson_ext -v 1.10.2
). I'll leave it to you to decide which solution makes more sense for you.
Edit: Based on a change to the bson-ruby project on github, a better fix would be to change that include to read like this:
#ifdef _WIN32
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…