ruby-xslt, Centos and undefined symbol xsltLibxmlVersion - ruby

I have a rails application using the following environment:
CentOS release 5.7 (Final)
Rails 3.0.9
Rubygems 1.6.2
Ruby 1.9.2
Passenger
Apache2
The Development environment differs and is: Ubuntu 10.04, Ruby 1.8.7 which works like a charm. I can't change the production environment.
I use ruby-xslt, gem version 0.9.8, the problem is when I access the application I get an error:
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-xslt-0.9.8/lib/xml/xslt_lib.so: undefined symbol: xsltLibxmlVersion - /usr/local/lib/ruby/gems/1.9.1/gems/ruby-xslt-0.9.8/lib/xml/xslt_lib.so
The only solution I can find about this is:
http://amitsolanki.com/2010/04/undefined-symbol-xsltlibxmlversion-ruby-xslt-and-centos/
Which does not work for me.
I am stumped and would like to hear your opinions on what to do:
My ideas are as follows:
1) Don't use ruby-xslt - However this is the only ruby based xslt lib I could get to compile in development, which is why I used it. (but am open to suggestions).
2) Hack the ruby-xslt lib to remove the reference to the symbol, recompile and install. (tried but the error still appears so I may not be doing it right, I run "ruby setup.rb" for the gem again after the change but this is pure guesswork.)
3) Change the Ruby Environment to 1.8.7 as in development - don't think this will work as the problem is between the gem ruby-xslt and a linux library libxslt2.so and not the ruby env. (so actually not going to do this)
4) Add the symbol to the libxslt2.so lib, rebuild and install (but not worked with C language for 15 Years)
Any thoughts on this?
Regards
Paul

I solved this by using option number 1 and managed to get an older version of xslt-ruby installed (1.0.1), this involved installing a few libs as well.

Related

Debugger fails to compile in Ruby

Ruby 2.2.2 on Ubuntu
I have been following the saasbook tutorial on Rails and am getting to grips with the workflow.
I am confused about debugger which some sources says us now 'included' post Ruby version 2. It fails to compile on the example projects and many people have the same issue.
I have found that any bundle install that I try to do with the examples. (see here) (possibly after a bundle update) will fail on trying to 'gem install debugger -v '1.6.x''.
I have found that by commenting out the debugger line in the Gemfile will get me around this hurdle and upon firing up the Rails server, everything seems to work. I also have to change the Ruby version to my current one (2.2.2).
I am assuming that I am working with pre version 2 Ruby examples and this is good to do post version 2.
Am I correct? What has happened to the debugger post version 2?
The debugger gem is not supported on Ruby 1.9. See the debugger readme on GitHub here. If you need a command line debugger for newer versions of Ruby you can use byebug.
You can use the basic built in debugger if you prefer. Simply put require 'debug' anywhere in your source code and the Ruby interpretor will stop at that point and allow you to inspect variables etc. You do not need to install or add any additional gems to your Gemfile to use this as it is built in. See the built in debugger documentation here

Moving Sinatra from Webrick to a different server on windows - thin installed but can't load eventmachine

I'm building a simple web app on Sinatra that I can deploy like a gem to artifactory; to start with I'm getting everything setup.
Here's what I've done:
I've got the the gemspec done so I can deploy like a gem
I've got sinatra modular set up with a basic 'hello world' page
I've got Rspec setup for testing (hello world test passes)
I've got rake tasks to make things easier (booting up sinatra, building the gem, running tests, etc)
Now I need to move Sinatra from Webrick to somthing a bit more robust and that's this is where I'm hitting a wall.
I've tried Unicorn,thin and Puma but they all won't install and I don't know what to do.
They all fail at Building Native extensions, I don't know what to do.
I'm using windows 8.1 (i'd rather be doing this on ubuntu but the company uses windows and to be honest I like a challenge) ruby 2.1 and I have devkit installed (and it's working now, wouldn't last night).
From what I've read Unicorn won't work on windows so the best bet is to go with thin but that fails with: extconf.rb
checking for main() in -lc... *** extconf.rb failed ***
It mentions that I need the devkit installed (it is the first line is Temporarily enhancing PATH to include DevKit...)
Despite this it fails, I tried doing what I found in this but that didn't help ( Installing event machine didn't do anything).
I'm at a loss of what to do next.
EDIT:
Whilst I've solved the problem of getting Thin to install it now has a differant error
IT can't load eventmachine.
EDIT:
It all comes down to the fact that the Devkit wasn't being recognised or it didn't install properly or something. I wonder why.
I've tried Unicorn,thin and Puma but they all won't install and I don't know what to do. They all fail at Building Native extensions, I don't know what to do.
The reason these are failing is that many ruby gems use native C extensions which expect to be compiled and installed on a linux or unix environment.
Doing any sort of Ruby development work on a Windows machine is an exercise in sadomasochism.
I strongly recommend you install VirtualBox, download an Ubuntu or similar linux virtual machine image, boot it, configure it, and use it as your development webserver. You can continue to edit your code in windows, but you will be running it in a sane environment.
Ultimately, you may have to learn some new skills, but you will save yourself an enormous amount of frustration by moving off windows as your development platform.
I managed to get thin installed but it wasn't easy
I wiped every bit of ruby from my machine, including all references in the registry, got rid of pik as well.
I then followed these steps (that I worked out along with an answer from another question) and it now works
install rubyinstaller 2.1.3
install devkit
gem install thin --platform=[win64]
notepad C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\eventmachine-1.0.3\ext\project.h #append line 97 with //
cd C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\eventmachine-1.0.3
gem build eventmachine.gemspec
move eventmachine-1.0.3.gem up one directory
cd ..
gem install eventmachine-1.0.3.gem
del the gemfile
cd
gem install thin --platform=[win64]
A bit of a job BUT it worked,
The answer in question isthis one.
specifically
2) edited the file:
c:\Ruby21-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3\ext\project.h
and commented the line 97
//typedef int pid_t; for a more robust correction, checkout the
solution here
https://github.com/eventmachine/eventmachine/pull/450/files
3) then, i've opened command prompt, and went to the gem folder
c:\Ruby21-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3 and run:
gem build eventmachine.gemspec
In the end, after hammering my head against a wall, on a suggestion I installed chef-client and using the embedded ruby allowed it to work, that said it only uses ruby 1.9.3 but it works so for now it will have to do.

RGeo on Ruby under Windows: How to enable GEOS support?

I'm trying to do some spatial operations in Ruby with the RGeo gem. Unfortunately, a lot of operations require the GEOS library and I can't find any documentation showing how to integrate this in Windows (I am using Windows 7 64bit).
I tried downloading and installing the Windows binaries of GEOS from http://trac.osgeo.org/osgeo4w/ and reinstalling the RGeo gem via gem install rgeo -- --with-geos-dir="C:\OSGeo4W64\bin (<< in this directory there is a file geos_c.dll).
Still, using RGeo::Geos.supported? returns false.
Does anybody know how to solve this?
For anyone else looking to do this - here are some tips as to how I got it working.
install GEOS Windows binaries by following the link from http://trac.osgeo.org/geos/ (I have Ruby 32 bit version, so I went for the 32 bit version)
you should now be able to find a file geos_c.dll in C:\OSGeo4W\bin
set a Windows environment variable ENV['GEOS_LIBRARY_PATH'] to be C:\OSGeo4W\bin
check at this point to make sure that ENV variable is there - maybe restart your PC!
in your Gemfile, add gem 'ffi-geos' and gem 'rgeo' and bundle install
in your Ruby file, remember to require 'ffi-geos' and require 'rgeo' (in that order)
use factory = RGeo::Geos.factory(:native_interface => :ffi) - not RGeo::Cartesian.factory
check RGeo::Geos.supported? as Dirk said

Trying to install Jekyll on Windows 8 (x64): Error installing fast-stemmer-1.0.2.gem

I'm trying to get Jekyll running on Windows 8 x64, using this manual:
Running Jekyll on Windows
I'm using the following two downloads from rubyinstaller.org:
Ruby 2.0.0-p0 (x64)
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
So I set up both Ruby and the DevKit according to the manual (expect it's newer versions). I tried running a little Hello World .rb script and it's working fine, path variables are set.
I then try to run gem install jekyll and I get the following output:
gem install jekyll - output on pastebin.com
The problem seems to be with the gem called fast-stemmer-1.0.2.gem, or so it seems.
Unfortunately I have practically zero experience with Ruby or Jekyll and have no idea what is going on here. Could someone please take a look at the output and send me into the right direction?
Thanks
Have you tried uninstall Ruby/DevKit and try the whole thing again, but this time, install Ruby to the default directory like C:\Ruby200-x64 instead of C:/Program Files/Ruby/Ruby200-x64
As I suspect the space in your ruby directory could be the issue. (Line 296 of your error txt)
/usr/bin/install: target
`Files/Ruby/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fast-stemmer-1.0.2/lib'
is not a directory make: *** [install-so] Error 1
Also quote from Issues installing Ruby and Rails and DevKit on windows 7 x64 - fix needed
Seems you installed Ruby (along the DevKit?) inside a directory with
spaces.
As indicated during Ruby own installer, path with spaces are not
recommended (that is why default is C:\Ruby193
GCC, the compiler that is part of DevKit, has problems with path with
spaces, so installation of DevKit is also recommended to be placed in
a path without spaces (e.g. C:\DevKit)

RVM, FSEvents, and CarbonCore on OS X

I'm setting up a project that uses SASS, which uses FSEvents to keep from polling the disk. It seems that this doesn't play nice with RVM, however. That means that when I run sass --watch I get this warning:
Warning: Unable to load CarbonCore. FSEvents will be unavailable.
I realize that it will still work, but I don't want to be polling my disk constantly. I want to get it working with FSEvents. The best information I could find about this was this thread:
http://groups.google.com/group/compass-users/browse_thread/thread/df7d9d0da9ec1eb1
I reinstalled my RVM Ruby (using 1.9.2) as described by Brandon Mathis and downloaded the linked RubyCocoa. However, I get an error on the first step of installing RubyCocoa:
[rvm 1.9.2] ~/Downloads/RubyCocoa-1.0.0 $ ruby install.rb config --build-universal=yes
install.rb: entering config phase...
create ext/rubycocoa/extconf.rb
create framework/GeneratedConfig.xcconfig
create framework/src/objc/Version.h
create tests/Makefile
---> framework
create /Users/xxx/Downloads/RubyCocoa-1.0.0/framework/src/objc/osx_ruby.h ...
config failed
hook /Users/xxx/Downloads/RubyCocoa-1.0.0/framework/post-config.rb failed:
No such file or directory - /Users/xxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0/ruby.h
try 'ruby install.rb --help' for usage
It looks like the problem stems from this being an older version of RubyCocoa (I notice the missing file has 1.9.1 in the path), but in the Google Groups post, Brandon Mathis says specifically to use the version he links and not the newest one.
Does anyone know how to get this configured, or have a link to a recent, hopefully simpler and clearer guide to getting FSEvents working with RVM?
Versions in question:
RVM 1.2.0
Ruby 1.9.2 patch level 136 (installed via RVM)
Mac OS X 10.6.6
HAML gem 3.0.25 (SASS is part of HAML)
Thanks!
I wrote FSSM, which is what HAML/SASS/Compass use for their filesystem watching backend. While rubycocoa isn't supported in 1.9.x, the latest git version of FSSM has pretty solid support for rb-fsevent. This library currently has other limitations, like only being able to monitor one path (parent directory is a must here), but I'm working on it. ;)
I'd highly suggest installing rb-fsevent, and then FSSM from github: https://github.com/ttilley/fssm
If you have any problems, please don't hesitate to file an issue in the tracker. FSSM is a currently maintained project, and it was originally written to help Chris Eppstein out with providing watch functionality in compass (which was later adopted in sass itself). Ease of use via these libraries is my absolute top priority.
This is kind of a lost battle. You can copy the contents of the include/ruby folder from the Ruby source code to that location /Users/xxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0/ which will let you run the config command, but after that you will get a lot of errors on the setup command and you won't be able to install it all. People say RubyCocoa doesn't work with 1.9.2 and I don't know if anyone managed to make it work.
I tried the FSSM method above, to no avail...
Gemfile now has:
group :development do
gem 'rb-fsevent'
gem 'fssm', :git => 'https://github.com/ttilley/fssm.git'
end
which installs:
fssm (0.2.6.1)
rb-fsevent (0.4.0)
Still getting this tho:
Warning: Unable to load CarbonCore. FSEvents will be unavailable.
Anyone have install steps to make FSSM work nicely?

Resources