public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "JP de Vooght" <jp@vooght.de>
To: <gcc-help@gcc.gnu.org>
Subject: use of fabsl and logbl builtins
Date: Fri, 15 Aug 2008 14:25:00 -0000	[thread overview]
Message-ID: <003001c8fec6$b217c0e0$164742a0$@de> (raw)

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






             reply	other threads:[~2008-08-15 11:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 14:25 JP de Vooght [this message]
2008-08-16 11:43 ` Jean-Paul de Vooght

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003001c8fec6$b217c0e0$164742a0$@de' \
    --to=jp@vooght.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).