Segfault when I rake (Ruby on Rails) - mysql

EDIT: Here's the solution (in case the thread linked to below disappears):
Install ruby 1.8.6 (down from 1.8.7)
gem install rails -v=2.3.8 (same as before)
gem install mysql (version 2.8.1, same as before)
Download libmysql.dll from http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll and deposit it in Ruby186/bin. (Before, I had copied over the libmysql.dll file from Mysql/bin.)
When I attempt rake db:migrate with the database.yml file configured for mysql (not sqlite3) I get the following segfault error:
C:/Ruby187/lib/ruby/1.8/benchmark.rb:306: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32]
I have already looked at this thread: Ruby on Rails Rake Error and don't see any help there.*** It appears that my rails app is configured correctly because when I run rake db:create, rails successfully creates the mysql schema dictated for the development environment in database.yml (or returns a "schema already exists" message).
I'd guess I had mysql configured incorrectly, but the fact that rake db:create works on it makes me think otherwise. I have successfully set up rails and mysql (working together) on three other machines; I don't know what the problem is on this one.
Ruby v. 1.8.7 -
Rails v. 2.3.8 -
Mysql v. 5.1.54
***The user who posted that thread indicated that he solved the problem thanks to a post on aptana. The link to that post, however, points to the home page, so the answer thread appears to have either been moved or removed.

Does this describe the solution as well? http://rubyat.com/blog/2010/06/rails-2-3-8-segmentation-fault/

I found that the last step, using the instantrails dll, solved my problem on Win 7 x64 without my having to change ruby or rails versions.
ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
rails -v
Rails 3.2.0
gem search mysql
mysql (2.8.1 x86-mingw32)

Related

"There was an error while trying to load the gem 'mysql2'. (Bundler::GemRequireError)" error shows up after redmine installation

I'm transferring redmine from our office's local server to an online server so that anyone who deals with bug management doesn't need to have a VPN account to access redmine.
So, We've chosen to use Bluehost.com because we saw their default Ruby version is 1.9.3(which works with redmine) while other hosts we've checked out were at 1.8.7
Okay I'm done establishing the backstory, now to the main storyline:
I'm trying for several days to install redmine on the server with no success.
The error I'm getting is this:
Error Message:
There was an error while trying to load the gem 'mysql2'.
(Bundler::GemRequireError)
Exception Class: PhusionPassenger::UnknownError
Here are some details:
Ruby version 1.9.3
Redmine version 3.2.2
Rails Version 4.2.5.2(installed as part of the bundle for redmine)
MySQL version 5.5.42
I've used a few guides on the web on how to install redmine on the server. one of whom was bluehost's guide:
https://my.bluehost.com/cgi/help/redmine
What I've tried after thoroughly searching StackOverflow:
I read that sometimes mysql2 gems have a problem and need to be reinstalled again after the bundle so I did gem install mysql2
I tried installing a specific version as well when someone here said that the mysql2 gem was working with bluehost on version 0.3.16 or other similar versions. Didn't work.
I even tried installing a local newer version of Ruby 2.3.1 but that didn't work either and only after I realized that the gems are not necessarily affected by the ruby version installed on the system.
I can't even use the test feature (like with WEBrick or Thin) because Bluehost wants you to own a dedicated server in order to open up special ports for you. We're using a shared host.
Anyway, after around 4 days of dealing with this I came to the conclusion that I need to seek out help. Sure I did learn practically the syntax of Ruby on Rails while dealing with this problem(which I was clueless on and have no knowledge in Ruby itself) but I need to get this done.
Does anyone have any insight on things I can try to get this working?
Here's a shot of the error:
Passenger Error
production.log data:
Migrating to InsertAllowedStatusesForNewIssues (20150725112753)
Migrating to CreateImports (20150730122707)
Migrating to CreateImportItems (20150730122735)
Migrating to ChangeTimeEntriesCommentsLimitTo1024 (20150921204850)
Migrating to ChangeWikiContentsCommentsLimitTo1024 (20150921210243)
Migrating to ChangeAttachmentsFilesizeLimitTo8 (20151020182334)
Migrating to FixCommaInUserFormatSettingValue (20151020182731)
Migrating to ChangeIssueCategoriesNameLimitTo60 (20151021184614)
Migrating to ChangeAuthSourcesFilterToText (20151021185456)
Migrating to ChangeUserPreferencesHideMailDefaultToTrue (20151021190616)
Migrating to AddTokensUpdatedOn (20151024082034)
Migrating to CreateCustomFieldEnumerations (20151025072118)
Migrating to AddProjectsDefaultVersionId (20151031095005)
in comparison, development.log is huge so I'll add a portion of it just to demonstrate the type of things written there.
I can access the cpanel and donwload the entire file if needed:
' ^[[1m^[[36m (0.2ms)^[[0m ^[[1mSHOW CREATE TABLE `wikis`^[[0m
^[[1m^[[35m (0.3ms)^[[0m SELECT fk.referenced_table_name as 'to_table'
,fk.referenced_column_name as 'primary_key'
,fk.column_name as 'column'
,fk.constraint_name as 'name'
FROM information_schema.key_column_usage fk
WHERE fk.referenced_column_name is not null
AND fk.table_schema = 'skredmin_redmine2'
AND fk.table_name = 'workflows'
Thanks for any insight!
Try 'bundle update mysql2'
I'm new to the server side of redmine but I experienced this issue when we updated mysql on our server. This did the trick for me, hope it helps.
I had to downgrade my version of mysql2 gem in the gemfile:
gem 'mysql2', '~> 0.3.18'
Then using a bundle update to downgrade the version.

Ruby on rails undefined method `where' for #<Class:0x10377d590>

I am trying to migrate from windows 7 to mac osx .
I have installed the following
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
mysql Ver 14.14 Distrib 5.1.56, for apple-darwin10.3.0 (i386) using
readline 5.1
After a lot of pain I installed my sql gem by :
sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
But still when I run my project in netbeans I get the following error
[4;36;1mUser Columns (31.5ms)[0m
[0;1mSHOW FIELDS FROM users[0m
[4;35;1mSQL (1.2ms)[0m [0mSHOW
TABLES[0m /!\ FAILSAFE /!\ Wed May
04 09:53:16 +0530 2011 Status: 500
Internal Server Error undefined
method `where' for
Can anyone tell me what am I doing wrong ?
The database migrations are working perfectly.
You stopped copying the stack trace right at the point where it was about to tell you where the error occurs. Look down the stack trace for the first mention of any code from your app (as opposed to the gems or the vendor folder) and it should point you to the problem line.
It's unfortunate that you've having such a time installing the MySQL gem, but this can be complicated if you're loading it on a from-scratch machine that's missing the development headers, something required to compile the extension, and your path does not include /usr/local/mysql/bin which is common.
You can fix that by creating a file /etc/paths.d/mysql with the following:
/usr/local/mysql/bin
Generally you should just have to list mysql in your Gemfile after that, and it should install conventionally with bundle install.
As for the error, it looks like something deeper in your application that's blowing a gasket. When you say "run your project in netbeans," but do you mean run unit tests? It looks like you're calling where on something that doesn't support it.
This looks like an application error. The server is bailing with a 500 when it fails to evaluate the method 'where', somewhere likely in your code.
Modern Mac operating systems (forget which was the first) come with ruby and rails pre-installed - not sure if this is related to your setup.
What happens when you run
rails server
from the console (from within the directory of the app) ?
where is a ActiveRecord 3 AREL class method used for conditions.
First things first, do you have XCode installed? thats a prerequisite to installing any native gems. You can download XCode 3 from the apple site or buy XCode 4 from the app store.
More of the stack trace is required.
Ideally though, once you have installed XCode, you should take a look at https://rvm.io - it's the preferred way for managing rubies on Unixy systems.
Thanks guys.. I finally found the error was with the authlogic gem
I had installed 3.0.2
and the application requires an older version 2.x

Rails 3 Mysql rake db:create issue

I've recently upgraded to Rails 3 and am getting the following issue when trying to run rake db:create to create a mysql database of which has been defined in database.yml
Some info about my setup:
running snow leopard
rails gem v3.0.3
mysql gem v2.8.1
mysql 5.5.8
I'm presented with this issue:
$rake db:create
(in /Users/elliottheis/Sites/demoProject)
rake aborted!
uninitialized constant Mysql::Error
(See full trace by running task with --trace)
Does anyone have any ideas how to solve this, it's driving me nuts!
Make sure Mysql is in your Gemfile and the database.yml is setup for Mysql. Uninitialized constant simply and will most likely always mean you have not told Rails where to find it. It you can type mysql -uroot into Terminal and see the Version then you know that MySql is fine. Try post a bit more information and we will see if we cant get to the bottom of this.
rake -r mysql db:create --trace
If this does not work then something has gone wrong in the installation. Try This.
Uninstall Mysql - Follow these instructions
Reinstall Mysql - Follow these instructions
Let us know how you get on and tell us the solution when you get it. All the best
I know this has already been answered, but in case this happens to someone else, my issue was identical to Elliot's.
However, my fix revolved around using mysql gem 2.8 and Snow Leopard, which which is explained in another Stackoverflow thread:
As it turns out, that class should not exist; the error message is
caused by a problem with the latest Mysql driver. mysql-2.8.1 looked
for my libraries in a directory named with an extra level of ‘mysql’
at the end. For instance, my libraries (under MacOS X 10.5.8), are in
/usr/local/mysql/lib, but the mysql.bundle library looks for the MySQL
libraries at /usr/local/mysql/lib/mysql … which is wrong.
So I needed to install the mysql gem version before 2.8. Follow the instructions on this Web site, and your issue should be resolved.

push Rails3 on Heroku. can not find mysql gem

i'm getting an error when pushing to heroku using rails 3. I'm on windows with ruby 1.8.7
Administrator#WIN-DQC3IH63U7C ~/nasha (master)
$ heroku rake db:migrate
rake aborted!
no such file to load -- mysql
/disk1/home/slugs/280561_9c64ba2_1741/mnt/Rakefile:4
(See full trace by running task with --trace)
(in /disk1/home/slugs/280561_9c64ba2_1741/mnt)
Heroku doesn't use the database you use for running your application locally.
Heroku uses PostgreSQL (http://docs.heroku.com/database)
Did you freeze Rails into vendor? This problem usually appears with Heroku when you freeze Rails. You must leave Heroku use it's own Rails based on your .gems file. You can read more about this here http://docs.heroku.com/gems#heroku-gem-manifest
If this is not the problem, did you follow the instructions regarding Heroku and Rails 3 applications? You can read about it here http://docs.heroku.com/rails3 Please notice that you must setup the Bamboo Stack for your Rails 3 application to work correctly.
You need have the mysql gem in your Gemfile
gem "mysql"

MySQL bindings for Rails 2.3.5 on Mac OS X 10.5.8

I have a rails environment which I set-up with macports. I recently updated macports which seems to have had the side effect of breaking rails. When I try to boot a rails server I get:
$ ./script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle: dlopen(/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle, 9): Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient.15.dylib (LoadError)
Referenced from: /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
Reason: image not found - /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
I've tried reinstalling the mysql gem many times using various configurations I've found around the web but nothing seems to help. Also, when I try to use rake I get:
rake db:migrate
Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Pleasegem update --systemand try again.
Even though:
gem --version
1.3.6
What's going on here?
It seems the problem was that I had rails installed under macports, and also as a gem. I uninstalled all the rails components from macports and just stuck with the gems version and it seems to have made the MySQL problem go away.