Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Error installing on windows 7 & 8 #11

Open
andreofthecape opened this issue Jul 29, 2013 · 8 comments
Open

Error installing on windows 7 & 8 #11

andreofthecape opened this issue Jul 29, 2013 · 8 comments

Comments

@andreofthecape
Copy link

When I try to install proxylocal on Windows 7 (also 8) I get this error

C:\Sites\test>gem install proxylocal
Fetching: bert-1.1.6.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing proxylocal:
ERROR: Failed to build gem native extension.

    C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb

creating Makefile

make
generating decode-i386-mingw32.def
compiling decode.c
decode.c:3:24: fatal error: netinet/in.h: No such file or directory
compilation terminated.
make: *** [decode.o] Error 1

Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/bert-1.1.6 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bert-1.1.
6/ext/bert/c/gem_make.out

@thekosmix
Copy link

any luck on solving this problem, i'm getting the same

@thekosmix
Copy link

Found the solution, it's not proxylocal's error, it's bert's error. To install on windows, follow the steps:

git clone https://github.com/mojombo/bert.git

it will download bert gem in bert folder.
open file: bert->ext->bert->c->decode.c
replace following header declaration:

#include <stdint.h>         //linux header file
#include <netinet/in.h>   //linux header file

with

#ifdef _WIN32_        // it it's a windows platform, include windows headers
#include <winsock2.h>     //windows headers
#include <windows.h>     //windows headers
#else                     // else include linux headers
#include <stdint.h>       //linux header file
#include <netinet/in.h>      //linux header file
#endif

now build and install bert:

gem build bert.gemspec
gem install bert.-X.X.X.gem

now it (bert) will be successfully installed. Now install the proxylocal and run it (in a new cmd):

gem install proxylocal
proxylocal 3000 --host testserver

now open url:
http://testserver.t.proxylocal.com/

and it will be displaying your local webserver's content

@luislavena
Copy link

@thelakshya actually you should be able to check if _WIN32 is defined and use that to load the right headers, not removal of the other code.

That way, your fix can be incorporated into the gem and everybody benefit, while your current approach just breaks it for anybody else that is not using Windows.

@thekosmix
Copy link

Agree, I updated my solution, after testing it. Thanks for correcting me!!

@maurozadu
Copy link

thanks @thelakshya! you saved my life!
@luislavena thanks to you too for correcting the _WIN32 constant

@Zaylril
Copy link

Zaylril commented Aug 1, 2014

Just a quick note in the example you have WIN32 it needs to be _WIN32 to work. Just incase others have this issue. Cheers for the fix!

@seadynamic8
Copy link

@Zaylril - Thanks. I needed that little adjustment to make it work.

@daniyal229
Copy link

Great job @thelakshya +1 for the fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants