Problem building libf2c with mingw-get-setup.exe

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem building libf2c with mingw-get-setup.exe

Jack LaVigne
In 2011 on a windows 7 system I downloaded
mingw-get-inst-20110316.exe and was able to build libf2c after
make a few changes to makefile.u.

#    Original                  Edit
--   --------                  ----
1    CC = cc                   CC = gcc
2    SHELL = /bin/sh           # SHELL = /bin/sh
3    CFLAGS = -O               CFLAGS = -DMSDOS -O
4    ./a.out >arith.h          /d/libf2c/a.exe >arith.h
5    rm -f a.out arithchk.o    rm -f a.exe arithchk.o

Now in 2014 on a new computer (same windows 7 I think) I was
unable to download mingw-get-inst-20110316.exe and ended up using
mingw-get-setup.exe.

I asked for the same components as in 2011:

      mingw-developer-toolkig
      mingw32-base
      mingw32-gcc-fortran
      mingw32-gcc-g++
      msys-base

I was able to compile some simple test c programs succesfully.

However I have a problem building libf2c.

I made the same changes to the libf2c makefile.u as in 2011 but
now I get an error message.

uninit.c: In function 'ieee0':
uninit.c:161:21: error: '_EM_DENORMAL' undeclared (first use in this
function)
 #define EM_DENORMAL _EM_DENORMAL
                     ^
uninit.c:172:13: note: in expansion of macro 'EM_DENORMAL'
  _control87(EM_DENORMAL | EM_UNDERFLOW | EM_INEXACT, MCW_EM);
             ^
uninit.c:161:21: note: each undeclared identifier is reported only once for
each function it appears in
 #define EM_DENORMAL _EM_DENORMAL
                     ^
uninit.c:172:13: note: in expansion of macro 'EM_DENORMAL'
  _control87(EM_DENORMAL | EM_UNDERFLOW | EM_INEXACT, MCW_EM);
             ^
uninit.c:164:22: error: '_EM_UNDERFLOW' undeclared (first use in this
function)
 #define EM_UNDERFLOW _EM_UNDERFLOW
                      ^
uninit.c:172:27: note: in expansion of macro 'EM_UNDERFLOW'
  _control87(EM_DENORMAL | EM_UNDERFLOW | EM_INEXACT, MCW_EM);
                           ^
uninit.c:167:20: error: '_EM_INEXACT' undeclared (first use in this
function)
 #define EM_INEXACT _EM_INEXACT
                    ^
uninit.c:172:42: note: in expansion of macro 'EM_INEXACT'
  _control87(EM_DENORMAL | EM_UNDERFLOW | EM_INEXACT, MCW_EM);
                                          ^
uninit.c:170:16: error: '_MCW_EM' undeclared (first use in this function)
 #define MCW_EM _MCW_EM
                ^
uninit.c:172:54: note: in expansion of macro 'MCW_EM'
  _control87(EM_DENORMAL | EM_UNDERFLOW | EM_INEXACT, MCW_EM);
                                                      ^
make: *** [uninit.o] Error 1


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem building libf2c with mingw-get-setup.exe

David Gressett


>Jack LaVigne wrote:
> Problem building libf2c with mingw-get-setup.exe

>In 2011 on a windows 7 system I downloaded
>mingw-get-inst-20110316.exe and was able to build libf2c after
>make a few changes to makefile.u.

... snip ...

>However I have a problem building libf2c.

>I made the same changes to the libf2c make>file.u as in 2011 but
>now I get an error message.

>uninit.c: In function 'ieee0':
>uninit.c:161:21: error: '_EM_DENORMAL' undeclared (first use in this
>function)
>#define EM_DENORMAL _EM_DENORMAL

... snip ...

_EM_DENORMAL is defined in  float.h, but is contained in #ifndef __STRICT_ANSI__




------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem building libf2c with mingw-get-setup.exe

Keith Marshall
On 10/07/14 15:49, David Gressett wrote:
>> Jack LaVigne wrote:
>> Problem building libf2c with mingw-get-setup.exe

mingw-get-setup.exe is, in no way, pertinent to this issue; see below.

>> In 2011 on a windows 7 system I downloaded
>> mingw-get-inst-20110316.exe and was able to build libf2c after
>> make a few changes to makefile.u.

mingw-get-inst.exe was never intended to be anything, other than a
temporary kludge; it was always intended that it would eventually be
replaced, and now it has -- by mingw-get-setup.exe!  No way will we
continue to offer, much less support, the old, temporary facility, which
is long obsolete, and has been permanently withdrawn.

> ... snip ...
>
>> However I have a problem building libf2c.
>
>> I made the same changes to the libf2c make>file.u as in 2011 but
>> now I get an error message.
>
>> uninit.c: In function 'ieee0':
>> uninit.c:161:21: error: '_EM_DENORMAL' undeclared (first use in this
>> function)
>> #define EM_DENORMAL _EM_DENORMAL
>
> ... snip ...
>
> _EM_DENORMAL is defined in float.h,

Yes, but which float.h?  There are two: one in /mingw/include; the other
in /mingw/lib/gcc/mingw32/<version>/include.  It is the former, in which
the definition is to be found.

> but is contained in #ifndef __STRICT_ANSI__

This may be true, but I very much doubt if it is actually the cause of
this problem -- after all, it has always been so, even in the version of
the tools which had previously worked for the OP.

The more likely cause of the problem is the inclusion order of the
header files: when Danny Smith maintained MinGW's GCC, he always made
arrangements for the /mingw/include directory to be searched before
/mingw/lib/gcc/mingw32/<version>/include, and the /mingw/include/float.h
would invoke #include_next, to pull in the GCC specific header; a
courtesy which the GCC header does not extend in the reverse direction.
 Unfortunately, this arrangement of Danny's is at odds with GCC's
standard configuration, and this problem has always afflicted those of
us who run cross-compilers, which adopt the standard configuration.

Since Danny is no longer maintaining our GCC releases, his special
arrangement has not been carried forward into recent MinGW releases.
Consequently, '#include <float.h>' finds the GCC version before the
/mingw/include version, which is thus ignored altogether, and the extra
definitions which it exposes are never seen by the compiler!

The bottom line is that this is a GCC bug -- their float.h needs to pull
in the extra content from MinGW's -- but past requests to have it fixed
have not borne fruit.  As a work around, try adding

  -isystem /mingw/include

to the CPPFLAGS, when compiling your code.

--
Regards,
Keith.

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem building libf2c with mingw-get-setup.exe

Keith Marshall
On 10/07/14 17:09, Keith Marshall wrote:
> As a work around, try adding
>
>   -isystem /mingw/include
>
> to the CPPFLAGS, when compiling your code.

FWIW, with this sample:

  $ cat conftest.c
  #include <float.h>

  int main(){
    _control87( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );
    return 0;
  }

my cross-compiler says:

  $ mingw32-gcc -v conftest.c
  ...
  GNU C (GCC) version 4.8.2 (mingw32)
  ...
  #include "..." search starts here:
  #include <...> search starts here:
   /home/keith/mingw32-gcc-4.8.2/bin/../lib/gcc/mingw32/4.8.2/include
   /home/keith/mingw32-gcc-4.8.2/bin/../lib/gcc/mingw32/4.8.2
     /include-fixed
   /home/keith/mingw32-gcc-4.8.2/bin/../lib/gcc/mingw32/4.8.2/../..
     /../../mingw32/include
   /home/keith/mingw32-gcc-4.8.2/bin/../../mingw32/mingw/include
  End of search list.
  ...

which, as you may note, places the GCC headers before MinGW's in the
search order, and it reproduces the OP's problem:

  ...
  conftest.c: In function 'main':
  conftest.c:4:15: error: '_EM_DENORMAL' undeclared (first use in this
  conftest.c:4:15: function)
     _control87( _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM );
                 ^
  conftest.c:4:15: note: each undeclared identifier is reported only
  conftest.c:4:15: once for each function it appears in

However, when I reorder the header search:

  $ mingw32-gcc -isystem ~/mingw32-gcc-4.8.2/include conftest.c
  $

it compiles just fine, which tends to support my diagnosis.

--
Regards,
Keith.

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem building libf2c with mingw-get-setup.exe

Jack LaVigne
In reply to this post by Jack LaVigne
Keith,

Thank you much.

Your solution of adding -isystem /mingw/include worked perfectly.

I am new to this user group and don't know how to actually use it.

I don't know how to reply, I hope sending this e-mail is the proper way to
do so.


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem building libf2c with mingw-get-setup.exe

Keith Marshall
On 11/07/14 11:40, Jack LaVigne wrote:
> Your solution of adding -isystem /mingw/include worked perfectly.

Which reinforces my diagnosis of the problem, thanks.

Clearly, this float.h header ordering bug will continue to bite us,
until some co-operative solution is thrashed out between the GCC folks,
MinGW.org, and other interested/affected parties.  There has been some
previous discussion, on gcc-patches and gcc-bugzilla:

https://gcc.gnu.org/ml/gcc-patches/2010-06/msg00387.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54750

but the entire issue seems to have died on the vine.

> I am new to this user group and don't know how to actually use it. I
> don't know how to reply, I hope sending this e-mail is the proper way
> to do so.

You broke threading, which perhaps isn't ideal, but is certainly
preferable to the common novice practice of top posting.  Some quoted
context may have been helpful, with interleaved replies, as I've done it
above.  Also, adding a sig-break -- a line comprising exactly "-- " --
helps to avoid regurgitation of garbage footers, at least for users of
more standards compliant mail clients than the execrable MS-Outlook.

--
Regards,
Keith.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe