* use of fabsl and logbl builtins
@ 2008-08-15 14:25 JP de Vooght
2008-08-16 11:43 ` Jean-Paul de Vooght
0 siblings, 1 reply; 2+ messages in thread
From: JP de Vooght @ 2008-08-15 14:25 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: use of fabsl and logbl builtins
2008-08-15 14:25 use of fabsl and logbl builtins JP de Vooght
@ 2008-08-16 11:43 ` Jean-Paul de Vooght
0 siblings, 0 replies; 2+ messages in thread
From: Jean-Paul de Vooght @ 2008-08-16 11:43 UTC (permalink / raw)
To: gcc-help
Just to close this post, I eventually figured out that gcc built-ins are
really a library matter and that cygwin does not provide an implementation
for the ones below. MinGW does.
Eventually I found my salvation through the use of GNU MP BugNum library
which has been ported to cygwin.
- JP
> -----Original Message-----
> From: JP de Vooght [mailto:jp@vooght.de]
> Sent: 15 August 2008 13:05
> To: gcc-help@gcc.gnu.org
> Subject: use of fabsl and logbl builtins
>
> 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
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-16 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15 14:25 use of fabsl and logbl builtins JP de Vooght
2008-08-16 11:43 ` Jean-Paul de Vooght
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).