[collectd] Re: Cross-compiling of collectd

Niki W. Waibel niki.waibel at newlogic.com
Wed Dec 14 19:53:27 CET 2005


On Wed, Dec 14, 2005 at 07:07:40PM +0100, Florian Forster wrote:
> Hello Stuart,
> 
> On Wed, Dec 14, 2005 at 12:54:05PM -0500, Stuart Nicholson wrote:
> > I'm cross-compiling collectd, using an x86 for the build tools, with a
> > PowerPC target.  Have you cross-compiled?  I've encountered two
> > problems, one of which I've solved.
> 
> No, I myself haven't (yet), but I assume the folks who use it on
> embedded systems do ;)

sounds interesting. have done cross compiling of linux kernel
to ppc. have also done (sort of) crosscompile from i686-pc-linux-gnu
to i386-pc-linux-uclibc.

what kind of emb system are u using?

> > Problem 1.  The modules were not finding global symbols in collectd
> > (curtime, module_register, etc).  I fixed this by adding
> > 'LDFLAGS="-rdynamic"' in front of ./configure, which forces ld to
> > write the global symbols to the collectd executable image.  This was
> > only a problem in the cross-compiling environment.  (The native
> > powerpc gcc version 2.95 did not require this, nor did two different
> > x86 gcc environments.)
> 
> I have to admit I don't know why this isn't set by the autotools or
> libtool.. However, Niki Waibel has done many changes to the autotools
> stuff and switched that dynamic library stuff to `libltdl'. Maybe this
> solves that issue.. If not, let me know :)

huh, yes. i run into such -rdynamic problems on solaris/gcc4/binutils already.
turned out that it was a gcc4 bug and it has been fixed in recent versions.

which gcc/binutils version are u using?
which collectd version have you used?

-> first try to compile collectd from the current svn repository.
yes, i changed some things regarding the linking.
i would bet that libtool (libltdl) handles your case now...

> > Problem 2.  I install the files into a "root filesystem build image" for 
> > the PowerPC target (as opposed to /usr/local/lib/collectd on the x86 build 
> > host.)  I do this by configuring 
> > with --prefix=<path-to-root-filesystem-image>/usr/local/ and using "make 
> > install".  Only problem is, collectd gets built with that path for 
> > plugindir.  this can be overridden with the -P option, but it's kind of an 
> > ugly solution leaving that string in the executable image and in the *.la 
> > files.  Is there any way around this?  (need to install _here_, but execute 
> > as if _there_)
> 
> I think what you need is the following:
> 1) Run the configure script with `--prefix=/usr/local'
> 2) Compile
> 3) Install using `make install DESTDIR=<path-to-root-filesystem-image>'

yes, ugly. but such things happen often in a cross env.
i think you have to use the DESTDIR solution.

florian, have you already fixed the "hard-coded-module-path"-issue already?

> > Minor Problem 3.  I had to comment out line 82 in processes.c for my x86 
> > build.  This line is:
> > "int strsplit (char *string, char **fields, size_t size);"
> 
> Oh, that's a bug.. Why did that even compile? Well, it's fixed in the
> repository.. :)
> 
> > Thanks again for a great project!  I'm off to create some modules
> > specific to my platform.  I'll contribute back what's useful to
> > others.
> 
> Great, I'm happy to hear that :)

indeed, this project is fantastic:
	a 50k gathering-(almost)-everything-each-10-sec-deamon

have fun, niki



More information about the Collectd mailing list