When trying to use my extconf.rb, with content:
-=-=----=-=----=-=----=-=----=-=---
=begin
extconf.rb for booh lib additions
=end
PACKAGE_NAME = "booh/libadds"
#- some adds to Gdk::Pixbuf
require 'mkmf-gnome2'
PKGConfig.have_package('gtk+-2.0') or exit 1
have_func("gdk_pixbuf_set_option")
have_header("gdk-pixbuf/gdk-pixbuf-io.h")
#- direct exiv2 access for some EXIF stuff
PKGConfig.have_package('exiv2') or exit 1
#- does it do something good, actually?
setup_win32(PACKAGE_NAME)
create_makefile_at_srcdir(PACKAGE_NAME, '.')
-=-=----=-=----=-=----=-=----=-=---
and mkmf-gnome2.rb, the following output is produced:
-=-=---=-=---=-=---=-=---=-=---=-=--
checking for GCC... yes
checking for rb_define_alloc_func() in ruby.h... yes
checking for rb_block_proc() in ruby.h... yes
checking for new allocation framework... yes
checking for attribute assignment... yes
checking for gtk+-2.0... yes
checking for gdk_pixbuf_set_option()... yes
checking for gdk-pixbuf/gdk-pixbuf-io.h... yes
checking for exiv2... yes
checking for G_PLATFORM_WIN32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-pkg-config
--without-pkg-config
/usr/lib/ruby/site_ruby/1.8/mkmf-gnome2.rb:141:in
`create_makefile_at_srcdir': undefined method `+' for nil:NilClass
(NoMethodError)
from extconf.rb:19
-=-=---=-=---=-=---=-=---=-=---=-=--
Instrumenting before the line 141, I can see that "srcdir" is "." and
"base_dir" is "ext", which effectively doesn't give an apprently
awaited result to "srcdir.rindex(base_dir)" (my extconf.rb is in the
subdirectory "ext" of my project). I don't know exactly what the code
is trying to do, so I cannot suggest a fix, sorry. Reverting commit
2504 workarounds the problem though.
--
Guillaume Cottenceau - http://zarb.org/~gc/
on 21.06.2008 23:50
on 22.06.2008 07:37
Hi, 2008/6/22 Guillaume Cottenceau <gcottenc@gmail.com>: > is trying to do, so I cannot suggest a fix, sorry. Reverting commit > 2504 workarounds the problem though. What about the following patch?Index: src/lib/mkmf-gnome2.rb =================================================================== --- src/lib/mkmf-gnome2.rb (revision 3256) +++ src/lib/mkmf-gnome2.rb (working copy) @@ -138,7 +138,10 @@ def create_makefile_at_srcdir(pkg_name, srcdir, defs = nil) base_dir = File.basename(Dir.pwd) - builddir = srcdir[(srcdir.rindex(base_dir) + base_dir.size + 1)..-1] + last_common_index = srcdir.rindex(base_dir) + if last_common_index + builddir = srcdir[(last_common_index + base_dir.size + 1)..-1] + end builddir ||= "." FileUtils.mkdir_p(builddir) And your extconf.rb should use File.dirname(__FILE__) instead of "." to support building your .so in other (not source) directory: diff --git a/ext/extconf.rb b/ext/extconf.rb index 785e552..a591f1b 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -16,4 +16,4 @@ PKGConfig.have_package('exiv2') or exit 1 #- does it do something good, actually? setup_win32(PACKAGE_NAME) -create_makefile_at_srcdir(PACKAGE_NAME, '.') +create_makefile_at_srcdir(PACKAGE_NAME, File.dirname(__FILE__)) Thanks, -- kou
on 23.06.2008 00:06
> + if last_common_index > + builddir = srcdir[(last_common_index + base_dir.size + 1)..-1] > + end > builddir ||= "." > FileUtils.mkdir_p(builddir) Works better, thanks. > And your extconf.rb should use File.dirname(__FILE__) instead of "." > to support building your .so in other (not source) directory: thanks! -- Guillaume Cottenceau - http://zarb.org/~gc/