Mantis - gcc4g++
Viewing Issue Advanced Details
3713 upgrade minor always 2009-06-12 18:01 2011-12-03 11:16
scottcurtis  
maciej  
normal  
closed  
fixed  
none    
none  
0003713: g++ is not compatible with libmpfr
I did an upgrade to the "current" release to get the latest g++. When compiling a function which requires g++ to load libmpfr, the compiler fails with the message "undefined reference to __gmp_get_memory_functions". I built and installed libmpfr version 2.4.1 and this corrected the problem.
Here is the code from WTransform.C in the open source webtoolkit (WT) library that caused the problem. If I commented out the last line, the module compiled:

  const double a = m[0];
  const double b = m[1];
  const double c = m[2];
  const double d = m[3];

  double B = - a - d;
  double C = a * d - b * c;
  double Dsqr = B*B - 4*C;
  if (Dsqr <= 0) Dsqr = 0;
  double D = std::sqrt(Dsqr);

  l[0] = -(B + (B < 0 ? -D : D)) / 2.0;
Issue History
2009-06-12 18:01 scottcurtis New Issue
2009-06-17 23:42 mwatters Note Added: 0006326
2009-06-17 23:42 mwatters Assigned To => mwatters
2009-06-17 23:42 mwatters Status new => feedback
2009-06-18 22:44 scottcurtis Note Added: 0006328
2009-06-18 23:43 mwatters Note Added: 0006329
2009-06-19 00:17 mwatters Note Added: 0006330
2009-06-24 18:55 scottcurtis Note Added: 0006336
2011-10-18 09:05 maciej Note Added: 0009333
2011-10-18 09:05 maciej Status feedback => assigned
2011-10-18 09:05 maciej Assigned To mwatters => maciej
2011-11-17 10:46 maciej Note Added: 0009419
2011-11-17 10:46 maciej Status assigned => feedback
2011-12-03 11:16 maciej Note Added: 0009449
2011-12-03 11:16 maciej Status feedback => closed
2011-12-03 11:16 maciej Resolution open => fixed

Notes
(0006326)
mwatters   
2009-06-17 23:42   
maybe we are looking at 2 different versions of webtoolkit. but the one I see requires:
Cmake (2.4 or 2.6 are preferred) and boost-1.35 or later.
http://www.webtoolkit.eu/wt#/download [^]

g++ 4.3.3 is compiled against the current gmp and libmpfr they are "requirements to build", that is g++ will not build without them.

please confirm the URL of the software you are attempting to compile.
as well as the OS version and configure command

I don't think the problem is with g++ being incompatible with libmpfr. I think it is more the latest wt is not compatible with the older version of libmpfr.
I will wait for your reply and data before making the final determination.

(0006328)
scottcurtis   
2009-06-18 22:44   
The problem seems to be related to using the sqrt() from <cmath> which uses the g++ __builtin_sqrt(). To remove WT from the picture, I created a main.cpp with the following:

int main(int argc, char **argv)
{
    double d = __builtin_sqrtf(2.0);

    return 0;
}

If I compile this using:
g++ main.cpp

I can reproduce the problem

My OS is Solaris 10.
My libmpfr is version 2.3.1,REV=2008.01.29
My g++ is version 4.3.3,REV=2009.05.07

The libmpfr and g++ versions are what pkg-get -u installs when I get from current.

If I download and build the latest libmpfr, then __builtin_sqrtf() compiles successfully.
(0006329)
mwatters   
2009-06-18 23:43   
thank you for the feedback, I will look into this further.
we are in the process of upgrading gmp and then libmpfr so hopefully once I get that done, this bug will be fixed as a side effect.
(0006330)
mwatters   
2009-06-19 00:17   
ok, using the sample program you gave me I cannot reproduce:

$ g++ m.cpp
$ ./a.out

I get no error

I tried on solaris 8 sparc, and 10 sparc and 10 x86

Here is the pertinent software I am using.

all the systems have the same revision of CSW software
$ pkg-get -c libgmp libmpfr
# (From site http://mirror/opencsw/current [^] )
       software localrev remoterev
         libgmp 4.2.2,REV=2007.12.08 SAME
        libmpfr 2.3.1,REV=2008.01.29 SAME

$ pkg-get -c |grep gcc4
        gcc4ada 4.3.3,REV=2009.05.07 SAME
      gcc4adart 4.3.3,REV=2009.05.07 SAME
       gcc4core 4.3.3,REV=2009.05.07 SAME
     gcc4corert 4.3.3,REV=2009.05.07 SAME
        gcc4g++ 4.3.3,REV=2009.05.07 SAME
      gcc4g++rt 4.3.3,REV=2009.05.07 SAME
   gcc4gfortran 4.3.3,REV=2009.05.07 SAME
 gcc4gfortranrt 4.3.3,REV=2009.05.07 SAME
       gcc4objc 4.3.3,REV=2009.05.07 SAME
     gcc4objcrt 4.3.3,REV=2009.05.07 SAME

what version of libgmp are you running? is there any other info you can supply?
(0006336)
scottcurtis   
2009-06-24 18:55   
pkg-get -c libgmp libmpfr
# (From site http://ibiblio.org/pub/packages/solaris/opencsw/current [^] )
       software localrev remoterev
         libgmp 4.2.2,REV=2007.12.08 SAME
        libmpfr 2.3.1,REV=2008.01.29 SAME
pkg-get -c |grep gcc4
        gcc4ada [Not installed] 4.3.3,REV=2009.05.07
      gcc4adart [Not installed] 4.3.3,REV=2009.05.07
       gcc4core 4.3.3,REV=2009.05.07 SAME
     gcc4corert 4.3.3,REV=2009.05.07 SAME
        gcc4g++ 4.3.3,REV=2009.05.07 SAME
      gcc4g++rt 4.3.3,REV=2009.05.07 SAME
        gcc4g95 [Not installed] 4.0.2,REV=2005.09.29
      gcc4g95rt [Not installed] 4.0.2,REV=2005.09.29
   gcc4gfortran [Not installed] 4.3.3,REV=2009.05.07
 gcc4gfortranrt [Not installed] 4.3.3,REV=2009.05.07
       gcc4java [Not installed] 4.3.3,REV=2009.05.07
     gcc4javart [Not installed] 4.3.3,REV=2009.05.07
       gcc4objc [Not installed] 4.3.3,REV=2009.05.07
     gcc4objcrt [Not installed] 4.3.3,REV=2009.05.07
(0009333)
maciej   
2011-10-18 09:05   
Hello there, I built a new gcc version: 4.6.1. It's available from the unstable repository. I also updated libgmp, libmpfr, libppl and libcloog. Please give the new packages a go.
(0009419)
maciej   
2011-11-17 10:46   
I'm waiting for feedback. If I don't receive any until the end of November, I'll close it.
(0009449)
maciej   
2011-12-03 11:16   
I believe this is fixed now, with gcc-4.6.2 in the unstable catalog, both the compiler and the library have been rebuilt from scratch.

If it's still a problem, please open a new bug, or talk to us at #opencsw on Freenode.