use of fabsl and logbl builtins
JP de Vooght
jp@vooght.de
Fri Aug 15 14:25:00 GMT 2008
Hello,
I recently discovered the world of GNU R and its optional packages. While
trying to install igraph, gcc 3.4.4 on cygwin generated the following
output:
g++ -I/usr/local/lib/R/include -I/usr/local/include -DUSING_R -g -O2 -c
bliss.cc -o bliss.o
In file included from bliss_graph.hh:32,
from bliss.cc:19:
bliss_bignum.hh: In member function `int igraph::BigNum::tostring(char**)':
bliss_bignum.hh:76: error: `fabsl' undeclared (first use this function)
bliss_bignum.hh:76: error: (Each undeclared identifier is reported only once
for each function it appears in.)
bliss_bignum.hh:76: error: `logbl' undeclared (first use this function)
make: *** [bliss.o] Error 1
chmod: cannot access `/usr/local/lib/R/library/igraph/libs/*': No such file
or directory
ERROR: compilation failed for package 'igraph'
** Removing '/usr/local/lib/R/library/igraph'
The error is related to the use of two built-ins fabsl and logbl. Replacing
these functions with their __builtin_ homologues just defers the problem to
ld which fails with undefined _logbl.
Any suggestion on how to work around this? The header file imports math.h
and uses fabsl and logbl as follows:
<snip>
67 class BigNum
68 {
69 long double v;
70 public:
71 BigNum(): v(0.0) {}
72 void assign(const int n) {v = (long double)n; }
73 void multiply(const int n) {v *= (long double)n; }
74 int print(FILE *fp) {return fprintf(fp, "%Lg", v); }
75 int tostring(char **str) {
76 int size=static_cast<int>( (logbl(fabsl(v))/log(10.0))+4 );
77 *str=igraph_Calloc(size, char );
78 if (! *str) {
79 IGRAPH_ERROR("Cannot convert big number to string",
IGRAPH_ENOMEM);
80 }
81 snprintf(*str, size, "%.0Lf", v);
82 return 0;
83 }
84 };
</snip>
TIA
- JP
More information about the Gcc-help
mailing list