Saturday, March 28, 2009

InstantRails - we have a winner!

Wow. InstantRails was an easy install. And, it seems to work. Finally!
  • Ruby
  • gem
  • Rails
  • rake
  • mysql
  • phpmyadmin
  • SciTE, the editor
  • other stuff, I'm sure.
Interesting. InstantRails provides the ability to start a console window. But, it is sh(), not bash(). Odd, these days. But, you can start bash(). Just type "bash". Can bash() be configured as the default? Can't "exec bash". exec() is not available.

Is MySQL always this fragile on XP? Always this failure prone? It was a show stopper. I really wanted to work in the Cygwin environment. Since I'm from the Unix/Linux world, Cygwin is a very good thing.

Install "mysql" gem in cygwin

mysql gem

Tried "gem install mysql". That failed. Errors went like this:

$ gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby.exe extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... 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
... lotsa stuff deleted ...

Solution

The strategy is to download and build the needed libraries and other resourced so the mysql gem can be built and installed.
  1. Download the mysql source package.
  2. Use tar() to unwind the tarball into a directory. This was "mysql-5.1.32" for me. "tar xvfz mysql-5.1.32.tar.gz"
  3. "./configure" ... Get get a cup of something.
  4. make" ... Bugger, bugger, bugger. The build failed.
... stuff deleted ...
In file included from readline.c:54:
readline/readline.h:70:29: sys/ttydefaults.h: No such file or directory
make[2]: *** [readline.o] Error 1
... stuff deleted ...

Tried using the -exclude-server flag when running make(), as was suggested in other web locations. Same failure in the same place. No progress there.

Bugger, again!

cd() into the client directory. Do a "make" and am able to build it. Woohoo! Progress? Now, what .so and .h files should be copied to what destination directories? I don't know.

I find others on the web talking about these issues, but I don't find solutions.


Maybe it is just not going to work on XP, like so many other things. I should just wipe XP off this laptop and install Ubuntu. Just can't quite do that yet. Piece of shit.

A friend made a suggestion ... configure jruby. There are some potential benifits:
  • Most server environments already have java configured.
  • Most admins feel comfortable about installing a java module.
  • The performance is supposed to be very good, perhaps better than a native install. I'm skeptical. Who knows?
Perhaps I'll give that a last shot.

Friday, March 27, 2009

Ruby "gem" not in Cygwin. Rails not in Cygwin.


gem

Seems odd. It is possible to have the cygwin install include Ruby. Not so gem. So, ya gotta do it manually. There must be a good reason. Cygwin is seriously good stuff. The install is easy.

The idea is to install gem within the cygwin environment. The way to do this is to download a tar() file and run a setup file.

  1. Get the tar() file http://rubyforge.org/frs/?group_id=126
  2. Unwind the tarball "tar xvf ". For me, it was rubygems-1.3.1.tgz
  3. cd() into the directory just created by the tar() operation
  4. Run a ruby script, "ruby setup.rb install"

gem() should now function at the command prompt. Try "type gem", which will display the gem execution path.


rails

Use gem() to install rails

  1. "ruby install rails -include_dependencies"
The -include_dependencies prevents a lot of prompting, and answering "y".

Verify by creating a test app. "rails test"

rake


It is highly likely you will also desire rake.
  1. gem install rake

Saturday, March 14, 2009

phpmyadmin: Not functioning. Problem with mcrypt?

Just configured a fresh dev environment on an XP laptop. Am really jones'ing to configure a Linux laptop. Alas, I don't currently have the resources to acquire said laptop.

The "Welcome to phpMyAdmin" screen displays. Also displayed on this page is a box with a red outline containing the text "Cannot load mycrypt extension. Please check you PHP configuration."

Searching the web for that error message produces a lot of ancient postings, and a lot of different opinions. Information on this topic is certainly not evident if it is contained in the Documentation.txt file, provided with the phpMyAdmin distribution.

The configuration
  • XP SP3
  • Apache 2.2
  • MySQL 5.1
  • phpMyAdmin 3.1.3
  • PHP 5.2
  • Ruby & Rails
  • X86, 32 bit Intel CPU & OS
Looking for hints and coaching ...