On Sat, Nov 2, 2013 at 11:23 PM, Michael Goffioul <michael.goffioul@gmail.com> wrote:
Hi,

After upgrading my MinGW installation I started to get weird undefined reference to cabsf and cabsl. To be sure, I reinstalled MinGW from scratch (into a different directory) using the graphical installer (0.6.2). I then tried to compile the following test program:

#include <math.h>
#include <complex.h>
#include <stdio.h>

int main (int argc, char **argv)
{
  float complex x = 1 + 1*I;
  double complex y = 1 + 1*I;

  printf ("%g\n", cabsf (x));
  printf ("%g\n", cabs (y));

  return 0;
}

I then try to compile it as follows:

$ gcc -Wall -o test-cabsf test-cabsf.c -lm
C:\DOCUME~1\goffioul\LOCALS~1\Temp\ccSz5blq.o:test-cabsf.c:(.text+0x44): undefined reference to `cabsf'
collect2.exe: error: ld returned 1 exit status

AFAIK this used to be in libmingwex.a, I could verify it by using "nm" on that library from the old version of the mingwrt archive I still had in cache (3.20-2). However the same library from the newer mingwrt (4.0.3) does not contain it.

Is it a packaging bug, or have those functions been removed from the runtime libraries (or moved elsewhere)?

As a follow-up, I've compared the file list for libmingwex.a in versions 3.20-1 and 4.0.3 of mingwrt and I noticed that the latter was missing all complex-related source files. If I may make a suggestion, I would suspect this line:

http://sourceforge.net/p/mingw/mingw-org-wsl/ci/master/tree/Makefile.in#l307

It looks fairly redundant with the previous complex_SOURCES definition and may not work properly when building out the source directory.

Michael.