chexum (chexum) wrote,

undefined reference to `rpl_malloc'

I'm not actually reluctant to use the auto* tools, when I started, it was just autoconf itself, not these miriad helpers, so delving into them was a bit less difficult. Like many others however, sometimes I face weird problems, like the one which results in rpl_malloc being apparently undefined.

This time, it was an xbindkeys compile:

keys.o: In function `set_keysym':
keys.c:(.text+0x611): undefined reference to `rpl_malloc'

After a short while, I discovered this has another, uncommon reason: AC_FUNC_MALLOC is being used too late in the .ac script, thus masking the real problem this way:

checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... no
checking return type of signal handlers... void

Not having a GNU libc compatible malloc on any recent Linux distribution is quite weird, but this is not yet obvious if you don't look at every possible autoconf output. In a completely GNU(-ified) package, that would result in incorporating a helper library with a replacement malloc(), rpl_malloc(), that many autoconf using packages nowadays simply aren't doing. In my case however, it was simply a hidden compile failure, because the guile libs weren't properly checked for another dependency, -lpthread, so after the check for libguile, no compile checks were successful.

I can argue with myself that it's a problem with my build of guile, but the solution is quite easy:

$ LDFLAGS="$LDFLAGS -lpthread" ./configure ...

Thank you for visiting the arcane chamber GNU tools.

  • Post a new comment


    default userpic

    Your IP address will be recorded