Problems building gem with c-extension

S

Stefan Achatz

Hello,
i want to build a gem with a c-extension.
Some infos:
Directory Stucture:
mygem/mygem.gemspec
mygem/lib/mydir/somefunctions.rb
mygem/ext/extconf.rb
mygem/ext/otherfunctions.c

File mygem/ext/extconf.rb:
require 'mkmf'
create_makefile('mydir/otherfunctions')

File mygem/mygem.gemspec:
require 'rubygems'
spec = Gem::Specification.new do |s|
s.name = 'MyGem'
s.version = '0.1.0'
s.platform = Gem::platform::RUBY
s.summary = 'Something that doesnt work'
s.description = <<-EOF
EOF
s.require_path = 'lib'
s.autorequire = 'mydir/somefunctions'
s.has_rdoc = false
s.files = Dir.glob("{ext,lib,tests}/**/{*.rb,*.c}")
s.extensions = ['ext/extconf.rb']
s.author = 'Stefan Achatz'
s.email = '(e-mail address removed)'
end
if $0 == __FILE__
Gem::manage_gems
Gem::Builder.new(spec).build
end

Now what does not work:
when i go into the ext-dir and call manually
ruby extconf.rb && make && make install
the dir mydir gets created in the site-ruby-library-dir and the library gets
copied there.

When i build and try to install the gem with
gem build mygem.gemspec
gem install MyGem-0.1.0.gem

the file otherfunctions.so gets copied to mygem/lib instead of
mygem/lib/mydir

a diff on the Makefiles resulting in the two ways show that the definitions
of RUBYLIBDIR and RUBYARCHDIR are different.
normal build results in $(sitelibdir)$(target_prefix) and
$(sitearchdir)$(target_prefix).
Whereas the gem-compile-process sets the dir fix to /usr/lib/.../MyGem/lib.

What can i do to get the library in the right place for
namespace-correctness?
Thanks in advance
Stefan Achatz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top