Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with building gem, require path

10 views
Skip to first unread message

Daniel Berger

unread,
Jun 3, 2005, 9:26:21 PM6/3/05
to
Hi all,

Windows XP
Ruby 1.8.2

I'm having a bit of trouble building a proper gem for one of the
Win32Utils packages (win32-ipc). This is a C extension. Everything
appears to be fine, except that it installs the shared library (.so)
under "lib", instead of "lib/win32". I've set the Gem#required_paths,
so I'm not sure what I'm doing wrong.

Here is the spec:

require "rubygems"

spec = Gem::Specification.new do |gem|
gem.name = "win32-ipc"
gem.version = "0.4.1"
gem.author = "Daniel J. Berger"
gem.email = "djbe...@gmail.com"
gem.homepage = "http://www.rubyforge.org/projects/win32utils"
gem.platform = Gem::Platform::WIN32
gem.summary = "A base class for Win32 synchronization objects."
gem.require_paths << "lib/win32"
gem.test_file = "test/tc_ipc.rb"
gem.has_rdoc = true
gem.extra_rdoc_files = ["CHANGES","README"]
gem.extensions = ["extconf.rb"]
gem.rubyforge_project = "win32utils"

files = Dir["doc/*"] + Dir["examples/*"] + Dir["lib/win32/*"]
files += Dir["test/*"] + Dir["[A-Z]*"]
files.delete_if{ |item| item.include?("CVS") }
gem.files = files
end

if $0 == __FILE__
Gem.manage_gems
Gem::Builder.new(spec).build
end

The result is ipc.so installed under
c:/ruby/lib/ruby/gems/1.8/gems/win32-ipc-0.4.1-mswin32/lib instead of
the desired
c:/ruby/lib/ruby/gems/1.8/gems/win32-ipc-0.4.1-mswin32/lib/win32.

Any ideas? I've tried a few things for 'required_libs' without
success.

Regards,

Dan

Stefan Achatz

unread,
Jun 5, 2005, 3:05:23 PM6/5/05
to
Daniel Berger wrote:

> I'm having a bit of trouble building a proper gem for one of the
> Win32Utils packages (win32-ipc). This is a C extension. Everything
> appears to be fine, except that it installs the shared library (.so)
> under "lib", instead of "lib/win32". I've set the Gem#required_paths,
> so I'm not sure what I'm doing wrong.

> gem.require_paths << "lib/win32"

Hello,

i found that rubygems copies the libraries in the first require_path,
regardless which path stands in the mkmf create_makefile command. Thats
because installer.rb of rubygems overrides the RUBYARCHDIR and RUBYLIBDIR
variables of the resulting Makefile not considering the target_prefix.
I think its meant to require all files with the autorequire, so the actual
location of the library doesn't matter.
Try gem.require_paths = ['lib/win32','.'] or something to make sure your
desired path is in front or nevermind at all.
I mentioned the use of target_prefix in the Makefile on
Rubygems-developers-mailinglist, but nobody seems to notice.
Stefan

0 new messages