proxylocal / proxylocal-gem

Proxy your local web-server and make it publicly available over the internet
http://proxylocal.com/
MIT License
223 stars 15 forks source link

Error installing on windows 7 & 8 #11

Open andreofthecape opened 11 years ago

andreofthecape commented 11 years ago

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 commented 10 years ago

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

thekosmix commented 10 years ago

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 commented 10 years ago

@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 commented 10 years ago

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

maurozadu commented 10 years ago

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

Zaylril commented 10 years ago

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 commented 9 years ago

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

daniyal229 commented 9 years ago

Great job @thelakshya +1 for the fix