Ticket #69 (closed defect: fixed)

Opened 23 months ago

Last modified 21 months ago

bluecloth_ext missing after rake gems:unpack

Reported by: christer_f Owned by: deveiant
Milestone: Bugfixes Component: Packaging
Version: 2.0.7 Severity: normal
Keywords: rails gems:unpack installation Cc:

Description (last modified by deveiant) (diff)

Rails 2.3.2 with Ruby 1.8.6 on OSX 10.5.8

I have the following line in the environment.rb file

  config.gem 'bluecloth', :version => '>= 2.0.0'

After issueing rake gems:install everything works fine.

However, after including the gems in the project tree with the command rake gems:unpack, the installation breaks.

rake gems:unpack returns:

 Unpacked gem: '/Users/christer/Programs/teamhubs/vendor/gems/bluecloth-2.0.7'

I notice however that both BlueCloth-1.0.1 and bluecloth-2.0.7 have been included in the project tree and worse restarting the server gives:

 no such file to load -- bluecloth_ext
 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
 /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
 /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
 /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
 /Users/christer/Programs/teamhubs/vendor/gems/bluecloth-2.0.7/lib/bluecloth.rb:156

...

Change History

comment:1 Changed 23 months ago by deveiant

  • Keywords rails gems:unpack added; gem removed
  • Status changed from new to assigned
  • Description modified (diff)

This appears to be an artifact of whatever packaging system Rails is using these days, and not something that I know how to control as the author of a gem installed outside of the Rubygems packaging system itself.

If you can give me a better idea of what changes I need to make to the gem to support this kind of unpacking, I'd be happy to make the changes, but I don't use Rails myself, so I don't know if I'll have time to try to figure it out myself in the near future.

If you can do gem install bluecloth and then ruby -rubygems -e 'require "bluecloth"; p BlueCloth::VERSION' returns 2.0.7, then at least you'll know it's building correctly on your machine.

Another thing you might try is uninstalling BlueCloth 1.0.1; maybe that's causing problems? I don't know; that's just a guess.

Anyway, sorry I can't be more helpful.

comment:2 follow-up: ↓ 3 Changed 23 months ago by christer_f

Thanks for your quick reply! I think I know what the problem is. I uninstalled BlueCloth_1 and checked that the version used by the application is indeed 2.0.7, but this didn't solve the problem. As I indicated in my first description things work perfectly fine until I do the rake gems:unpack, which should simply make a copy of the gem and store into my rails application project tree. The problem comes from the code on lines 150-157 in the bluecloth.rb file, where the`require 'bluecloth_ext' complains that it can't find the bluecloth_ext.

# Load the correct version if it's a Windows binary gem
if RUBY_PLATFORM =~/(mswin|mingw)/i
	major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
		raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
	require "#{major_minor}/bluecloth_ext"
else
	require 'bluecloth_ext'
end

When comparing the installed gem on the system level (on my Mac located in /usr/lib/ruby/user-gems/1.8/gems/bluecloth-2.0.7) with what is in the project tree, I noticed that two files were missing from the copy in the ext directory: bluecloth.o and bluecloth_ext.bundle. After copying these two files into the project tree, it all works as it should!

I don't know how rake gems:unpackdecides which files should be copied, but apparently it needs to include these two files.

comment:3 in reply to: ↑ 2 Changed 23 months ago by deveiant

Replying to christer_f:

When comparing the installed gem on the system level (on my Mac located in /usr/lib/ruby/user-gems/1.8/gems/bluecloth-2.0.7) with what is in the project tree, I noticed that two files were missing from the copy in the ext directory: bluecloth.o and bluecloth_ext.bundle. After copying these two files into the project tree, it all works as it should!

Aha! Excellent detective work! :)

I don't know how rake gems:unpackdecides which files should be copied, but apparently it needs to include these two files.

Yes, I think this problem is an artifact of the way the gem is structured, which the gem:unpack task is apparently not set up to handle.

The .bundle file is the compiled part of BlueCloth, which the gem says to look for in the ext directory. The rake task is almost certainly counting on it to have been copied over to the lib directory, which many gems do.

The next release of BlueCloth will follow the Ruby Packaging Standard and copy over the extension part of the library into an architecture-specific subdirectory of lib, which should solve the problem for you (and I assume others) who are experiencing this problem.

In the meantime, as you discovered, you can simply copy the .bundle file over manually and everything should work fine.

Thanks for reporting this problem, and especially for replying with your workaround.

comment:4 Changed 21 months ago by deveiant

  • Status changed from assigned to closed
  • Resolution set to fixed

This should be fixed in r134.

Note: See TracTickets for help on using tickets.