[collectd] lua plugin

Schmurfy schmurfy at gmail.com
Tue Nov 23 21:33:23 CET 2010

On 23 November 2010 21:05, Florian Forster <octo at collectd.org> wrote:

> Hi Julien,
> On Mon, Nov 22, 2010 at 11:03:14PM +0100, Schmurfy wrote:
> > this discussion started with octo as private messages on github but he
> > wisely asked me to post it on the mailing list so anyone can take part
> > in it so here I am !
> thanks for taking this here :) And sorry for not looking closer at your
> branch yet. I certainly hope to make some time later this week.
> No problems :)

> > […] the problem comes from the fact that the official lua distribution
> > is a static library which cannot be embedded in the shared library
> > built for collectd (I tried but failed miserably)
> The problem is that in order to be able to link static libraries into
> shared objects (dynamic libraries), the static library has be be
> compiled with some special linker settings (-fPIC). This is an annoying
> problem, because many people, including many maintainers of packages of
> libraries, don't know this and have a hard time reproducing this bug,
> because it doesn't show up on a x86 system.
> About the two options:
> > The first one is to link to a shared library release of lua […]
> > The second one is to include the lua sources themselves into the collectd
> > plugin, […]
> In my opinion, the second option is out of question. We've done this
> with liboping and libiptc in the past and nothing good came out of this.
> You have all the problems you have with shared objects [*] but in an
> even more severe variant [**]. We still include libltdl because that's
> the way libtool works, but with the same result [0].
> I'd go for a variant of the first option: Simply do a normal check for
> the library using autoconf and link with libtool. This will
> automatically get you the shared library if it is available and fall
> back to the static library if necessary. Being the default behavior this
> is what most people, including package maintainers, expect and know how
> to deal with.
I will certainly need your help on this ;)
While I have no problems writing the C code itself I am not too friendly
with the build systems which are in my opinion far too complex to handle for
newcomers (autoconf that said) and I only have a really vague idea of what
libtool does and why it exists.
For most of my projects (personal or profesional) I usually stick with a
simple Makefile but I understand the need for tools such as autoconf for
bigger projects.

> I'd like a comment on the (apparently common) "other languages should be
> statically linked" misconception: Shared objects have a system to cope
> with incompatible binary versions. A dynamic libraries implementing a
> scripting language is nothing special and certainly no exception. If the
> language itself changes, this is either transparent to the application
> (annoying for the user, but not our problem) or it's an API change, for
> which numerous detection mechanisms and solutions exist. All the reasons
> for dynamic linking apply to scripting languages and DSLs just as well.
> In the worst case, the API provided to scripts depends on the scripting
> language's version. If so, that's how it is. Period.
> To back my claims up by facts:
>  * The Python plugin supports Python 2 *and* Python 3, which has a
>   substantially changed concept of what a "string" is. Changes to a
>   scripting languages hardly ever get any more sever than this.
>  * The Java plugin has been tested with Java 1.4 through 1.6.
>  * The Perl plugin works with Perl 5.8 and 5.10. I'm not sure about
>   version 5.6, but I *think* that worked, too.
> If we can handle these complex and mainly "stand alone" languages and
> they manage to maintain mechanisms to work with changes made to them,
> I'm confident a language *intended to be integrated* will manage to keep
> up, too.
As far as i am am concerned it was more a thought than a deeply anchored
misconception ^^
As long as it works I am fine with the painless method but my only
experience on embedded language until now is with ruby 1.8 and while it can
be used embedded it is clearly not designed at all for that and I ended up
embedding the sources but that was not really a decision I wanted to make. I
just wish to find a way that makes the installation painless for users.

> > I was also thinking about something else but linked to lua: have
> > anyone thought about using a higher level language to configure
> > filters ?
> That does sound like an interesting though. It'll be a lot of work to
> implement though. Be sure to toss around some ideas on the list before
> implementing anything.
I won't even start really thinking about it before I have a working lua
plugin and after that I need to really understand what happens behind these
filters, so it is more of a long term idea.

> Regards,
> —octo
> [*]  In particular: You need to rebuild collectd and other binaries the
>     library has been linked in when there's a security problem in the
>     library.
> [**] You cannot determine that collectd uses liblua using the package's
>     build dependencies, making it extra hard to realize there's a need
>     to rebuild collectd.
> [0]  <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559801>
> --
> Florian octo Forster
> Hacker in training
> GnuPG: 0x0C705A15
> http://octo.it/
> Version: GnuPG v1.4.9 (GNU/Linux)
> GGvg9ugukFJW8Gb2U44wFmT/7RWGi29QFXD/wBQnOJkMYTbnye0+2QEyue1jkxSv
> hQPTYYLsqsNSvJ0CmiyFIk1Xtnznv4dtTMtlLnFyVEyQZjhJF7O/nwAtKnNKiYPO
> iD1EyEB+SJbGb7r0zd7vR6HCx+syZktBtyIBJvoIIlV+jGKvTufF0zmnAtwoulVl
> uqhPPFHtxp9+t4ZHfp9u0t+li9vweju5PBbYZgbqpTv/5vWOegGHBnckg58OcVuP
> 5+ytmpROccGGFEuOXgyZpNyyKXFdsWkzv1tPUmx9bf7NbOqmu7IYuiyXN3+XMPbk
> mmWxjhwELYhxsVdJ/r+fMUjKDh2Yvf+oYr3rvaTgFWLH5YqsJT8PI5MK6wU2HKxt
> EUFDYmM1R3zNOG0M4kd+4y8depd+5o3D8hQRN+ydSfZ8+YGj/apvJocoqjyYAXG3
> NYWkl6kx4LKPgEs5rquB9P2sLjYs8OZ7emIinuXtSPokXbRPPxSdgn5qumrHxER+
> ofw4Yul53mCv/ofpRq2gEz8Fkt4yW05AKA3LsYapYzPNakEgxp7WVRrEOQjMKwL+
> sz04Pj49/m9uffL7DCZI
> =sX27
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20101123/ea8ed660/attachment.htm>

More information about the collectd mailing list