gruis / sinatra-websocket

Makes it easy to upgrade any request to a websocket connection in Sinatra
https://rubygems.org/gems/sinatra-websocket
Other
230 stars 31 forks source link

Error installing sinatra-websocket #14

Closed datajunkie1 closed 9 years ago

datajunkie1 commented 9 years ago

I can't install this gem: http://stackoverflow.com/questions/27768420/gem-installation-error-you-have-to-install-development-tools-first?noredirect=1#comment44068022_27768420

Any idea why this happens?

gruis commented 9 years ago

Looks like your issue is with compiling Thin, which is a dependency of sinatra-websocket.

If you have a stack trace showing errors with this gem please post it here and re-open the issue.

Thanks

datajunkie1 commented 9 years ago

All I have is what I posted in the Stackoverflow question. I'm using Ruby v1.9.1. How do I get the stack trace?

I also tried gem install sinatra-websocket again after running Windows Command Prompt with admin privileges, got the same error, but checked mkmf.txt, which says:

"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -DFD_SETSIZE=2048 -DFD_SETSIZE=2048 -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Ruby193/lib -L. -march=i486 -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp -lshlwapi " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <winsock2.h> 4: #include <windows.h> 5: int main(int argc, char **argv) 6: { 7: return 0; 8: } /* end */

gruis commented 9 years ago

The error you posted in Stackoverflow and partially reposted here is an error installing and compiling Thin, which is a dependency of sinatra-websocket. You should make sure that gem install thin -v 1.6.3 works.

It looks like you have an issue with your compiler tool chain. I suggest reading over the post that was mentioned in a comment on your question: http://stackoverflow.com/questions/11480430/how-to-compile-a-ruby-c-extension-and-link-libcurl-on-windows/11484346#11484346.

The error shown in Stackoverflow includes:

C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

It seems that your compiler tool chain is not properly installed.


If gem install thin -v 1.6.3 works then please let me know here and include the full error log that is generated when trying to install sinatra-websocket.

datajunkie1 commented 9 years ago

When I ran gem install thin -v 1.6.3, I got the same error, with this in mkmf.log: "gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -DFD_SETSIZE=2048 -DFD_SETSIZE=2048 -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Ruby193/lib -L. -march=i486 -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp -lshlwapi " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <winsock2.h> 4: #include <windows.h> 5: int main(int argc, char **argv) 6: { 7: return 0; 8: } /* end */

I read over the Stackoverflow question in your post, but I already have Devkit installed.

But you say my compiler tool chain may be improperly installed. I gotta admit: I don't know what a compiler tool chain is, or how to check if it's properly installed...

gruis commented 9 years ago

The last time I did any sort of compilation on windows was about 20 years ago, so I'm not going to be much help with setting up your compiler and tools. I'd start with trying to compile the test program on my own and review any errors that are spit out.

The test program was:

#include "ruby.h"

#include <winsock2.h>
#include <windows.h>
int main(int argc, char **argv)
{
  return 0;
}

The test compile command was:

gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -DFD_SETSIZE=2048  -DFD_SETSIZE=2048  -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby193/lib -L.   -march=i486   -lmsvcrt-ruby191  -lshell32 -lws2_32 -limagehlp -lshlwapi

Check the errors, if any that are spit out when trying to compile the program. If no errors are spit out, try running the executable and see if you get any errors.

datajunkie1 commented 9 years ago

I made test.exe and put it on the Desktop: `#include "ruby.h"

include

include

int main(int argc, char **argv) { return 0; }`

I opened the command line to run gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -DFD_SETSIZE=2048 -DFD_SETSIZE=2048 -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Ruby193/lib -L. -march=i486 -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp -lshlwapi

It spit out the error 'gcc' is not recognized as an internal or external command.

Running just test.exe from command line gives me The program or feature cannot start of run due to incompatibility with 64-bit version of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available.

datajunkie1 commented 9 years ago

I finally got it working. I uninstalled Ruby, re-installed it to C:\Ruby193, put the Ruby Devkit in C:\RubyDevkit, then followed the Devkit installation instructions, re-ran gem install sinatra-websocket, and it worked.

gruis commented 9 years ago

Good job. Have fun.