I was just compiling the GNU plotutils library (version 2.6) using MSYS for MinGW, and had the following problematic error:
undefined reference to `signgam'
It turns out there are problems with the 'gauss' methods provided by various platforms: in the file specfun.c in the ode directory of the plotutils source, the following comment occurs:
/* The following gamma-related nonsense is necessary because (1) some
vendors have lgamma(), some have gamma(), and some have neither [see
include/sys-defines.h for further comments], (2) some vendors do not
declare whichever function they have [e.g. Irix 5.3 requires an
auxiliary preprocessing symbol to be defined for the declaration in
math.h to be visible], and (3) some vendors supply broken versions which
we can't use [e.g. AIX's libm.a gamma support is conspicuously broken],
so we need to link in a replacement, but we can't use the same name for
the external symbol `signgam'. What a mess! -- rsm */
There are some threads discussing ways of solving this in old versions, and apparently only with Cygwin; however, I found that the simplest way to solve the problem is to make use of the C macro NO_SYSTEM_GAMMA referenced in the plotutils source - the package will then declare its own gamma functions for us. (So in fact, this isn't an error with plotutils, it's plotutils that provides the solution!)
The fix: make clean the directory and then run configure with an additional flag for the compiler defining the variable NO_SYSTEM_GAMMA. For example:
./configure --prefix=/where/to/install CFLAGS="-DNO_SYSTEM_GAMMA" --enable-libplotter
Then running make, make check and make install as usual, you should be good to go!
Remark: I actually had problems with the make check phase, which reported errors (8 of 11 failures, in fact!) when the relevant files (the .out and .xout files in the test directory) seemed to match. I recommend not worrying/bothering with these unless you have problems, or spot a potential future problem.
Other remark: The --enable-libplotter switch for the configure command is only needed if you want to use the C++ wrapper!
1 Comment