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

John Johansen john.johansen at canonical.com
Wed Jun 12 08:20:19 UTC 2013

On 06/05/2013 01:23 PM, Christian Boltz wrote:
> Hello,
> 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',
> See https://bugzilla.novell.com/show_bug.cgi?id=822277 for all details.
> Klaus Kaempf provided the attached patch which fixes the build, but he 
> intentionally enabled it for Factory builds only (not <= 12.3) and wrote 
> about it in the bugreport:
> (comment 8)
> Added a clunky workaround: created request id 177452
> Should be fixed upstream
> (comment 10)
> Well, it is a crude hack, based on the contents of the created 
> Makefile(.ruby)
> Other distributions have different Makefiles (hence this bug doesn't 
> appear there) and the patch might create more harm.
> The only thing I can say about the patch is that it fixes the problem.
> I don't know if it breaks anything on other distributions etc., 
> therefore I'm asking for an extra strict review (and some testing) ;-)
NAK, at least until I understand what is going on better. Specifically
from the referenced bug we have

  The error message is:

  [ 1399s] Making install in ruby
  [ 1399s] make[2]: Entering directory
  [ 1399s] make[3]: Entering directory
  [ 1399s] make -fMakefile.ruby install
  [ 1399s] make[4]: Entering directory
  [ 1399s] make[4]: *** No rule to make target
  needed by `LibAppArmor_wrap.o'.  Stop.

  The bug is that it searches for ruby.h _inside the buildroot_, which is
  obviously wrong.

  Makefile.ruby is generated by swig.

But when building packages searching the build root is the correct place to
search as you may be building against a different version than your system
has installed.

Some googling around using
  extconf.rb header file ruby.h

I find that this error happens usually because of missing the ruby-dev packages

My guess is we need to add a dependency on a missing ruby-dev or similar package
so that we can pull the ruby.h into the build root.

More information about the AppArmor mailing list