unpacking ruby-odbc

Hello,

I need to install my application to a Windows server (using MSSQL as the DB) and to make my life easier I am freezing the application. I have been able to freeze rails and unpack all the gems I need (including activerecord-sqlserver-adapter) except for one: ruby-odbc

I can install the gem the regular way, which DevKit builds correctly. I can run the application with the gem "in the open". Then when I unpack the gem everything seems to work, I get the message "Unpacked gem: ‘C:/Pepe/Code/RoR/afm/vendor/gems/ruby-odbc-0.99992’", but after I uninstall the 'regular' gem and try to start Mongrel:

C:\Pepe\Code\RoR\afm>ruby script/server => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 C:/Pepe/Code/RoR/afm/config/../vendor/rails/railties/lib/rails/ gem_dependency.rb :119:Warning: Gem::Dependency#version_requirements is deprecated and will be rem oved on or after August 2010. Use #requirement The following gems have native components that need to be built   ruby-odbc = 0.99992 You're running:   ruby 1.8.7.302 at C:/Ruby187/bin/ruby.exe   rubygems 1.3.7 at C:/Users/bob/.gem/ruby/1.8, C:/Ruby187/lib/ruby/ gems/1.8 Run `rake gems:build` to build the unbuilt gems.

I then try to build:

C:\Pepe\Code\RoR\afm>rake gems:build (in C:/Pepe/Code/RoR/afm) rake aborted! ERROR: Failed to build gem native extension. C:/Ruby187/bin/ruby.exe extconf.rb checking for version.h... no checking for sql.h... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options:         --with-opt-dir         --without-opt-dir         --with-opt-include         --without-opt-include=${opt-dir}/include         --with-opt-lib         --without-opt-lib=${opt-dir}/lib         --with-make-prog         --without-make-prog         --srcdir=.         --curdir         --ruby=C:/Ruby187/bin/ruby         --with-odbc-dir         --without-odbc-dir         --with-odbc-include         --without-odbc-include=${odbc-dir}/include         --with-odbc-lib         --without-odbc-lib=${odbc-dir}/lib ERROR: sql.h not found

Gem files will remain installed in C:/Pepe/Code/RoR/afm/vendor/gems/ ruby-odbc-0. 99992 for inspection. Results logged to C:/Pepe/Code/RoR/afm/vendor/gems/ruby-odbc-0.99992/ ext/gem_mak e.out (See full trace by running task with --trace)

I have even successfully installed the gem in the gems directory, just in case it would work:

C:\Pepe\Code\RoR\afm\vendor\gems>gem install ruby-odbc -i C:\Pepe\Code \RoR\afm\v endor\gems Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed ruby-odbc-0.99992 1 gem installed Installing ri documentation for ruby-odbc-0.99992... Installing RDoc documentation for ruby-odbc-0.99992...

But it doesn't:

C:\Pepe\Code\RoR\afm>ruby script/server config.gem: Unpacked gem cache in vendor/gems has no specification file. Run 'ra ke gems:refresh_specs' to fix this. config.gem: Unpacked gem cache in vendor/gems not in a versioned directory. Givi ng up. config.gem: Unpacked gem doc in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. config.gem: Unpacked gem doc in vendor/gems not in a versioned directory. Giving up. config.gem: Unpacked gem gems in vendor/gems has no specification file. Run 'rak e gems:refresh_specs' to fix this. config.gem: Unpacked gem gems in vendor/gems not in a versioned directory. Givin g up. config.gem: Unpacked gem specifications in vendor/gems has no specification file . Run 'rake gems:refresh_specs' to fix this. config.gem: Unpacked gem specifications in vendor/gems not in a versioned direct ory. Giving up. => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 C:/Pepe/Code/RoR/afm/config/../vendor/rails/railties/lib/rails/ gem_dependency.rb :119:Warning: Gem::Dependency#version_requirements is deprecated and will be rem oved on or after August 2010. Use #requirement The following gems have native components that need to be built   ruby-odbc = 0.99992 You're running:   ruby 1.8.7.302 at C:/Ruby187/bin/ruby.exe   rubygems 1.3.7 at C:/Users/bob/.gem/ruby/1.8, C:/Ruby187/lib/ruby/ gems/1.8 Run `rake gems:build` to build the unbuilt gems.

I am probably missing something obvious but I haven't been able to figure it out.

How can I unpack ruby-odbc correctly? Any clues?

Thanks in advance.

pepe wrote in post #969475:

Hello,

I need to install my application to a Windows server

My goodness, why? That's just asking for trouble.

(using MSSQL as the DB) and to make my life easier I am freezing the application. I have been able to freeze rails and unpack all the gems I need (including activerecord-sqlserver-adapter) except for one: ruby-

Right. Gems with native extensions generally can't be frozen usefully.

Best,

> I need to install my application to a Windows server

My goodness, why? That's just asking for trouble.

We've had this conversation more than once.

Right. Gems with native extensions generally can't be frozen usefully.

Well, that does not help me much. If it can be done I'd like to try it. If it can't be done then I'd move on and go with the install approach I currently have.

What 'native extensions' means is that parts of the gem are not written in Ruby but are (generally I think) in C. These need to be compiled to generate code suitable for the OS the app is being run on. The gem cannot therefore be frozen as it would be frozen with code compiled for the wrong OS. I think therefore you must install such gems on the target machine in the normal way.

Colin

What 'native extensions' means is that parts of the gem are not written in Ruby but are (generally I think) in C. These need to be compiled to generate code suitable for the OS the app is being run on.

Yes, I learned that by working with ruby-odbc.

The gem cannot therefore be frozen as it would be frozen with code compiled for the wrong OS. I think therefore you must install such gems on the target machine in the normal way.

Thanks Colin. I was afraid that would be the case.

pepe wrote in post #969581:

What 'native extensions' means is that parts of the gem are not written in Ruby but are (generally I think) in C. These need to be compiled to generate code suitable for the OS the app is being run on.

Yes, I learned that by working with ruby-odbc.

The gem cannot therefore be frozen as it would be frozen with code compiled for the wrong OS. I think therefore you must install such gems on the target machine in the normal way.

Thanks Colin. I was afraid that would be the case.

Bundler might help here.

Best,

Bundler might help here.

I don't know bundler but for what I read in the web site it would only help with the list of gems not with unpacking ruby-odbc.

pepe wrote in post #969780:

Bundler might help here.

I don't know bundler but for what I read in the web site it would only help with the list of gems not with unpacking ruby-odbc.

It won't help with unpacking as such, but it will help with automating the installation process on the host.

Best,