[apparmor] [patch] fix libapparmor ruby bindings for ruby 2.0

John Johansen john.johansen at canonical.com
Wed Jun 12 08:28:32 UTC 2013

On 06/11/2013 04:27 PM, Steve Beattie wrote:
> On Wed, Jun 05, 2013 at 10:23:41PM +0200, Christian Boltz wrote:
>> you might have noticed the discussion about the libapparmor ruby 
>> bindings build failures on openSUSE Factory, which is the first version 
>> with ruby 2.0.
>> The problem was that DESTDIR was added to too many variables, which 
>> finally resulted in
>> [ 1399s] make[4]: Entering directory
>> `/home/abuild/rpmbuild/BUILD/apparmor-2.8.1/libraries/libapparmor/swig/ruby'
>> [ 1399s] make[4]: *** No rule to make target
>> `/home/abuild/rpmbuild/BUILDROOT/apparmor-2.8.1-147.1.x86_64/usr/include/ruby-2.0.0/ruby.h',
> Well. I'm thoroughly confused, based on experiments on Ubuntu. One,
> ruby.h doesn't get built here.  Two, I applied this patch on
> ubuntu 13.04 and got no actual differences in install locations when
> installing the ruby bits.  The resultant Makefile.ruby changes looked
> like so:
> --- Makefile.ruby.old	2013-06-11 12:40:19.000000000 -0700
> +++ Makefile.ruby.new	2013-06-11 12:39:42.000000000 -0700
> @@ -21,7 +21,7 @@
>  exec_prefix = $(prefix)
>  vendorhdrdir = $(rubyhdrdir)/vendor_ruby
>  sitehdrdir = $(rubyhdrdir)/site_ruby
> -rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
> +rubyhdrdir = $(oldincludedir)/$(RUBY_BASE_NAME)-$(ruby_version)
>  vendordir = $(DESTDIR)/usr/lib/ruby/vendor_ruby
>  sitedir = $(DESTDIR)/usr/local/lib/site_ruby
>  ridir = $(datarootdir)/$(RI_BASE_NAME)
> @@ -34,7 +34,7 @@
>  htmldir = $(docdir)
>  infodir = $(prefix)/share/info
>  docdir = $(datarootdir)/doc/$(PACKAGE)
> -oldincludedir = $(DESTDIR)/usr/include
> +oldincludedir = /usr/include
>  includedir = $(prefix)/include
>  localstatedir = $(DESTDIR)/var
>  sharedstatedir = $(prefix)/com
> but since at least in ruby 1.8 and ruby 1.9 we're not generating a
> header, I guess that's why I'm not seeing any difference.
well as I read it ruby 2.0 doesn't generate the header either its
part of the ruby-devel packages. The problem is where it looking for
the ruby.h header that ruby 2.0 wants, but ruby 1.8 and 1.9 don't

the oldincludedir modification means that it is looking for that
header in the system root instead of the build root, which is just
wrong (well unless your using a chrooted build root with $DESTDIR=""
but ...)

So this will using the wrong ruby.h if your system has a different
version than what you are building against in the build root. And it
also requires that ruby be installed on the system instead of just
in the build root.

> I am confused why he chose to modify oldincludedir and convert
> rubyhdrdir (or hdrdir under SUSE?) to use it (I'm not sure what
because its a hack built from looking at and modifying the built
Makefile on suse. and that is the variable used

> oldincludedir's intended usage is, either).
oldincludedir is the none gcc compile equiv of includedir

> Finally, Ubuntu doesn't package the ruby bits (though I would like
> to change that at some point).  So I think the patch is safe from an
> Ubuntu perspective for ruby 1.8 and 1.9 (and I don't know when ruby 2.0
> is coming into the distro). So I'm not terribly opposed to the patch
Its likely to be wrong when we do ship it

> going in if it fixes an actual build problem for openSUSE. Could you
> add a reference to the bug in a comment before the rewriting occurs
> to give some explanation why it is done? With that addition,
> Acked-by: Steve Beattie <sbeattie at ubuntu.com>.
Let me reiterate, NAK. for now at least until we try modifying the
build dependencies

More information about the AppArmor mailing list