maxlapshin / mysql2postgres

Mysqldump, writing in postgresql format
MIT License
708 stars 156 forks source link

kernel_require.rb:126:in `require': cannot load such file -- pg_ext (LoadError) #74

Open joshco opened 9 years ago

joshco commented 9 years ago

Any idea why this is happening? $ mysqltopostgres taps/config.yml

c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require':
cannot load such file -- pg_ext (LoadError)
        from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
        from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysqltopostgres-0.2.15/lib/mysqltopostgres.rb:7:in `<top (required)>'
        from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
        from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
        from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysqltopostgres-0.2.15/bin/mysqltopostgres:7:in `<top (required)>'
        from c:/Ruby200/bin/mysqltopostgres:23:in `load'
        from c:/Ruby200/bin/mysqltopostgres:23:in `<main>'
paazmaya commented 9 years ago

It seems to be an older version of this tool, and the given error relates to the PostgreSQL gem not found in the context. It should be already fixed in the master, there is just not a release yet...

joshco commented 9 years ago

I tried it by building it from the git repo. version shows 0.2.20 and I'm still seeing the same issue. Im running Ruby 2.0.0 on windows My rails apps work just fine with postgres.

jibiel commented 9 years ago

mysql2postgres written in Ruby 1.9.3. And pg gem only specified for that platform at the moment:

platforms :mri_19 do
  gem 'pg', '~> 0.17'
end

Just update the platform to :mri_20 or anything you want. You can even put gem 'pg' outside of the platforms block.

Then again

bundle install
gem build mysqltopostgres.gemspec
gem install mysqltopostgres-0.2.20.gem
paazmaya commented 8 years ago

@jibiel would you like to make a PR for that fox?

jibiel commented 8 years ago

@paazmaya You mean add the note to the dox or fix the Gemfile?

paazmaya commented 8 years ago

Change the Gemfile...

jibiel commented 8 years ago

That should it.

Also hard-coding ruby version with ruby 1.9.3 in Gemfile is not very friendly for a public library too. Especially given that the most of the current users tries to build gem from source and 1.9.3 will be ancient tomorrow. I'd use .ruby-version file convention.

For that same reason it'd be nice to do CI testing against multiple ruby versions.

paazmaya commented 8 years ago

Thanks for the PR. Would you like to work on the changes related to the Ruby version too?