A few questions around Broccoli and its Ruby bindings

I guess it's a sign of the times, but it seems I'm unable to install
Broccoli these days. :slight_smile: Perhaps somebody could help me out. I'm trying
to work on http://tracker.bro-ids.org/bro/ticket/606 and am trying to
reproduce the scenario Seth mentions in the ticket.

For starters, I've configured a fresh recursive git checkout of the bro
repository via

  $ ./configure --enable-debug --prefix=$HOME/inst/

This built fine. I'd now like to install just Broccoli (into my home),
so I went into build/aux/broccoli and did a "make install". Is that the
right thing to do? It seems so, because it gets close:

  $ make install
  [ 40%] Built target broccoli
  [ 80%] Built target broccoliStatic
  [ 86%] Built target broconftest
  [ 86%] Built target broconn
  [ 86%] Built target broenum
  [ 86%] Built target brohose
  [ 93%] Built target broping
  [ 93%] Built target brotable
  [100%] Built target _broccoli_intern
  [100%] Built target broccoli_ext
  Install the project...
  -- Install configuration: "Debug"
  -- Installing: /home/kreibich/inst/etc/broccoli.conf
  -- Installing: /home/kreibich/inst/bin/broccoli-config
  -- Installing: /home/kreibich/inst/lib/libbroccoli.so.3.0.0
  -- Installing: /home/kreibich/inst/lib/libbroccoli.so.3
  -- Installing: /home/kreibich/inst/lib/libbroccoli.so
  -- Set runtime path of "/home/kreibich/inst/lib/libbroccoli.so.3.0.0"
to "/home/kreibich/inst/lib"
  -- Installing: /home/kreibich/inst/lib/libbroccoli.a
  -- Installing: /home/kreibich/inst/include/broccoli.h
  -- Installing: /home/kreibich/inst/lib/broctl/broccoli.py
  -- Installing: /home/kreibich/inst/lib/broctl/_broccoli_intern.so
  -- Set runtime path of
"/home/kreibich/inst/lib/broctl/_broccoli_intern.so" to
"/home/kreibich/inst/lib"

  -- Installing: /usr/lib/ruby/site_ruby/1.8/broccoli.rb
  CMake Error at bindings/broccoli-ruby/cmake_install.cmake:38 (FILE):
    file INSTALL cannot copy file

"/home/kreibich/devel/bro/aux/broccoli/bindings/broccoli-ruby/lib/broccoli.rb"
    to "/usr/lib/ruby/site_ruby/1.8/broccoli.rb".
  Call Stack (most recent call first):
    cmake_install.cmake:65 (INCLUDE)

  make: *** [install] Error 1

So it looks as though the Broccoli library installed fine but some Ruby
stuff still wanted to go into the system directory. Is that a deficiency
or am I not doing this right?

Fwiw, I tried to move on and checked out the broccoli-ruby repository
(which differs from bro/aux/broccoli/bindings/broccoli-ruby, correct? At
least the former seems to have way more content). This, when running the
same configure command, tells me it cannot find the Broccoli package.
broccoli-config is now installed, but I presume the package is referring
to something cmake-related that didn't yet get installed.

Help, thanks,
-C.

-- Installing: /usr/lib/ruby/site_ruby/1.8/broccoli.rb
CMake Error at bindings/broccoli-ruby/cmake_install.cmake:38 (FILE):
  file INSTALL cannot copy file

<snip>

So it looks as though the Broccoli library installed fine but some Ruby
stuff still wanted to go into the system directory. Is that a deficiency
or am I not doing this right?

Yeah, I don't like how this works but I wasn't sure how to handle it better. The ruby bindings always want to install to the system's ruby directory now (--prefix is currently ignored) because if I don't install them there it's a mess to use the library. It's no different from any other language binding in that respect. Perhaps there's a better way to handle this situation?

Fwiw, I tried to move on and checked out the broccoli-ruby repository
(which differs from bro/aux/broccoli/bindings/broccoli-ruby, correct? At
least the former seems to have way more content). This, when running the
same configure command, tells me it cannot find the Broccoli package.
broccoli-config is now installed, but I presume the package is referring
to something cmake-related that didn't yet get installed.

I guess that depends on if you're using the setup.rb script to install or using the cmake stuff to install (two way to install the same thing unfortunately). I haven't tested the old setup.rb layout, but I think it should still work. I do think that you will need to have broccoli-config in your path for either method though.

The repository shouldn't have anything different either, they're the same thing since the broccoli-ruby repository is just a submodule of broccoli.

(thanks for looking into the ticket btw!)

.Seth

The ruby bindings always want to install to the system's ruby
directory now (--prefix is currently ignored) because if I don't
install them there it's a mess to use the library.

Would you mind elaborating on the pain point a little bit? I do remember
that is an issue with libraries installed as gems, but can't recall that
it caused a lot of agony.

It's no different from any other language binding in that respect.
Perhaps there's a better way to handle this situation?

What comes to mind is installation in ~/.gem of the current user? This
is still not respecting PREFIX, yet at least less invasive than a
system-wide installation.

    Matthias

Yeah, I don't like how this works but I wasn't sure how to handle it
better. The ruby bindings always want to install to the system's
ruby directory now (--prefix is currently ignored) because if I don't
install them there it's a mess to use the library. It's no different
from any other language binding in that respect. Perhaps there's a
better way to handle this situation?

I just noticed you already offer --disable-{python,ruby}, so at least
normally there is a way around the problem when one doesn't care about
the bindings.

Anyway, no biggie -- I'll install for now and move on to looking at the
actual bug.

The repository shouldn't have anything different either, they're the
same thing since the broccoli-ruby repository is just a submodule of
broccoli.

That is so weird! I just wiped the two checkouts and repeated them, and
now the directory contents are indeed the same. I could swear I did the
same before, but apparently I didn't.

-C.