Bug 19481 - libgfortran doesn't build -- configure doesn't handle cabs() well
Summary: libgfortran doesn't build -- configure doesn't handle cabs() well
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.2
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks: 16991
  Show dependency treegraph
 
Reported: 2005-01-17 13:24 UTC by Francois-Xavier Coudert
Modified: 2016-12-07 23:16 UTC (History)
1 user (show)

See Also:
Host:
Target: i686-pc-mingw32
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-05-31 16:58:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2005-01-17 13:24:21 UTC
This one is strange. On i686-mingw, compiling gfortran fails with:
../../../gcc/libgfortran/generated/exp_c8.c:38: error: conflicting types for 'cabs'
/mingw/include/math.h:223: error: previous declaration of 'cabs' was here
make[2]: *** [exp_c8.lo] Error 1
make[2]: Leaving directory `/home/coudert/ibin/i686-pc-mingw32/libgfortran'
make[1]: *** [all] Error 2

I guess, somewhere in the configure process, the presence of cabs() in math.h
was not detected. This is not specific to i686-mingw, since the same thing
happens on mips-sgi-irix6.5 (which I reported as comment #7 in PR15266).

So, I submit a new PR (hope "component=bootstrap" was the right choice, not
sure) so that GNU build utils gurus can get this fixed. I am ready to give any
extra information needed, but I don't know what may be useful at that point.

PS: configure was a simple ../gcc/configure --prefix=/mingw --enable-languages=c,f95
Comment 1 Andrew Pinski 2005-01-17 15:15:18 UTC
I will note this definitation of cbas is not compatible with C99.
Comment 2 Francois-Xavier Coudert 2005-01-17 17:09:28 UTC
I worked around this bug, commenting a line in /mingw/include/math.h (I quote it
here for reference):
//_CRTIMP double __cdecl cabs (struct _complex);

The end of the compilation runs smoothly, but when I try to use gfortran, it
complains at link-time about missing symbol _ftruncate. Indeed, mingw doesn't
have a ftruncate (it has a chsize which has the same prototype and all), but the
libgfortran.a needs one (originally in unix.o). This can be worked around
(create an object file for ftruncate which call chsize directly and "ar -rv" it
into libgortran.a), but it should get fixed nonetheless.
Comment 3 Andrew Pinski 2005-05-01 14:33:17 UTC
(In reply to comment #2)
> I worked around this bug, commenting a line in /mingw/include/math.h (I quote it
> here for reference):
> //_CRTIMP double __cdecl cabs (struct _complex);
> 
> The end of the compilation runs smoothly, but when I try to use gfortran, it
> complains at link-time about missing symbol _ftruncate. Indeed, mingw doesn't
> have a ftruncate (it has a chsize which has the same prototype and all), but the

The ftruncate problem should be fixed now.

Does this work fully or is cabs issue still there?
Comment 4 Francois-Xavier Coudert 2005-05-02 07:42:45 UTC
cabs issue is still here. Will look into it when I have time.
Comment 5 Giovanni Bajo 2005-05-31 16:58:47 UTC
Then, confirmed.
Comment 6 Francois-Xavier Coudert 2005-09-05 10:37:44 UTC
It looks like this issue with cabs declaration is fixed now, with an up-to-date
mingw. Closing the PR.
Comment 7 Alan Modra 2016-12-07 23:16:35 UTC
Author: amodra
Date: Wed Dec  7 23:16:03 2016
New Revision: 243417

URL: https://gcc.gnu.org/viewcvs?rev=243417&root=gcc&view=rev
Log:
sync config/* from binutils

	* elf.m4: Revert 2016-06-21 change.
	* picflag.m4: Likewise.  Revert 2016-04-30 change too.
	* override.m4 (AC_PROG_LEX): Import 2016-01-18 binutils fix
	for PR binutils/19481.

Modified:
    trunk/config/ChangeLog
    trunk/config/elf.m4
    trunk/config/override.m4
    trunk/config/picflag.m4