Opened 13 years ago

Closed 7 years ago

#29985 closed defect (worksforme)

libmpc 0.9 lacks mpc_get_dc

Reported by: Russell-Jones-OxPhys (Russell Jones) Owned by:
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc: cooljeanius (Eric Gallager)
Port: libmpc

Description

The libmpc port is marked as version 0.9, but does not have the mpc_set_dc function according to nm /opt/local/lib/libmpc.dylib, but the news item at http://www.multiprecision.org/ says (amongst other things)

"Version 0.9, "Epilobium montanum", released in February 2011, comes with the following new features:

New functions mpc_set_dc, mpc_set_ldc, mpc_get_dc, mpc_get_ldc for converting between mpc type variables and C variables of type double _Complex or long double _Complex mpc_sin_cos, computing simultaneously the sine and cosine"


#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <complex.h>
#include "mpc.h"

int main()
{
        mpc_t x, y;
        mpc_init2 (x, 256);
        mpc_init2 (y, 256);

        double _Complex z=4.15896+918536*I;
       /*Function: int mpc_set_dc (mpc_t rop, double _Complex op, mpc_rnd_t rnd)*/ 
        mpc_set_dc(x, z, MPC_RNDUU);
        /* mpc_set(z, MPC_RNDUU); */

        printf("%f+%fi\n",creal(z),cimag(z));

        return 0;
}

gives a missing symbol error when compiled with gcc-mp-4.5 -o test main.c -I/opt/local/include -L/opt/local/lib -lmpc -lm

Undefined symbols:
  "_mpc_set_dc", referenced from:
      _main in ccfRN56S.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Change History (10)

comment:1 Changed 13 years ago by Russell-Jones-OxPhys (Russell Jones)

BTW, printf("%s\n",mpc_get_version()); outputs "0.9"

comment:2 Changed 13 years ago by Russell-Jones-OxPhys (Russell Jones)

Cc: russell.jones@… added

Cc Me!

comment:3 Changed 13 years ago by Russell-Jones-OxPhys (Russell Jones)

Cc: russell.jones@… removed

Cc Me!

comment:4 Changed 13 years ago by Russell-Jones-OxPhys (Russell Jones)

Maintainer is mww@… Not sure how to add them... should it be in the cc field when creating the ticket?

comment:5 Changed 13 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to mww@…

Yes, in the future you should Cc the maintainer(s).

comment:6 Changed 12 years ago by jmroot (Joshua Root)

Seems to be because src/mpc.h does this:

/* Check if complex.h is included */
#if defined (_COMPLEX_H)
# define _MPC_H_HAVE_COMPLEX 1
#endif

But AFAICT nothing defines _COMPLEX_H. And then src/get.c for example wraps the function definitions in #if defined _MPC_H_HAVE_COMPLEX.

comment:7 Changed 10 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:8 Changed 7 years ago by mf2k (Frank Schima)

Owner: mww@… deleted
Status: newassigned

comment:9 Changed 7 years ago by Russell-Jones-OxPhys (Russell Jones)

I don't see the linking error above with libmpc @1.0.3_0, gcc6 @6.3.0_0 and gcc5 @5.4.0_0 on Sierra. I don't remember the details of this problem, though.

comment:10 Changed 7 years ago by mf2k (Frank Schima)

Resolution: worksforme
Status: assignedclosed

OK, thank you for the update. Let's close this old ticket then.

Note: See TracTickets for help on using tickets.