Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#66457 closed defect (fixed)

libmpc Header mpc.h fails to include stdio.h required for FILE

Reported by: ragnese Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: ventura monterey Cc: cjones051073 (Chris Jones), kencu (Ken)
Port: libgcc12 libmpc

Description

I've attached my config.log, but the relevant part is likely this:

configure:8226: /usr/bin/clang -arch x86_64 -c -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk conftest.c >&5
In file included from conftest.c:10:
/opt/local/include/mpc.h:287:35: error: unknown type name 'FILE'
__MPC_DECLSPEC void mpcr_out_str (FILE *f, mpcr_srcptr r);
                                  ^
1 error generated.
configure:8226: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h.  */
| #include <mpc.h>
| int
| main ()
| {
|
|     #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
|     choke me
|     #endif
|
|   ;
|   return 0;
| }
configure:8251: result: no
configure:8309: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
https://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.

Attachments (1)

config.log (24.8 KB) - added by ragnese 17 months ago.
config.log

Download all attachments as: .zip

Change History (22)

Changed 17 months ago by ragnese

Attachment: config.log added

config.log

comment:1 Changed 17 months ago by jmroot (Joshua Root)

Keywords: ventura added; libgcc12 mpc gcc12 libgcc removed

comment:2 Changed 17 months ago by jmroot (Joshua Root)

Port: libmpc added

comment:3 Changed 17 months ago by freedomtan ("freedom" Koan-Sin Tan)

Quick solution is to add #include <stdio.h>, then there won't be FILE problem

comment:4 Changed 17 months ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:5 Changed 17 months ago by cjones051073 (Chris Jones)

Note I am unable to run macOS 13 myself (no hardware that supports it) but I can also reproduce this on macOS12, so probably related to an Xcode update that both macOS12 and 13 now use.

comment:6 Changed 17 months ago by cjones051073 (Chris Jones)

b.t.w. just including stdio.h in the test does not seem enough

configure:8227: /usr/bin/clang -arch x86_64 -c -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk conftest.c >&5
In file included from conftest.c:10:
/opt/local/include/mpc.h:287:35: error: unknown type name 'FILE'
__MPC_DECLSPEC void mpcr_out_str (FILE *f, mpcr_srcptr r);
                                  ^
1 error generated.
configure:8227: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h.  */
| #include <mpc.h>
| #include <stdio.h>
| int
| main ()
| {
| 
|     #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
|     choke me
|     #endif
| 
|   ;
|   return 0;
| }

comment:7 Changed 17 months ago by cjones051073 (Chris Jones)

Issue is easy to reproduce standalone

Oberon ~/Downloads > cat conftest.c
#include <mpc.h>
#include <stdio.h>
int main () {
     #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
     choke me
     #endif
     return 0;
}
Oberon ~/Downloads > clang  -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/opt/local/include conftest.c
In file included from conftest.c:1:
/opt/local/include/mpc.h:287:35: error: unknown type name 'FILE'
__MPC_DECLSPEC void mpcr_out_str (FILE *f, mpcr_srcptr r);
                                  ^
1 error generated.

comment:8 Changed 17 months ago by cjones051073 (Chris Jones)

Also now seen in the new macOS 13 buildbots

https://ports.macports.org/port/libgcc12/builds/

comment:9 Changed 17 months ago by cjones051073 (Chris Jones)

Cc: kencu added

comment:10 Changed 17 months ago by cjones051073 (Chris Jones)

Ken, any thoughts here ? Do you know if Iain is aware of this or not ?

comment:11 Changed 17 months ago by cjones051073 (Chris Jones)

Keywords: monterey added

comment:12 Changed 17 months ago by cjones051073 (Chris Jones)

OK, my mistake. stdio.h needs to be included *before* mpc.h

Oberon ~/Downloads > cat conftest.c                                                                                           
#include <stdio.h>
#include <mpc.h>
int main () {
     #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
     choke me
     #endif
     return 0;
}
Oberon ~/Downloads > clang -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/opt/local/include conftest.c
Oberon ~/Downloads >

comment:13 Changed 17 months ago by cjones051073 (Chris Jones)

I have pushed

https://github.com/macports/macports-ports/commit/9332dbb202005f90c4aa5c9e069edeb4d804d117

The issue is, I think, with libmpc as mpc.h directly uses FILE so it should directly first include stdio.h

Last edited 17 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:14 Changed 17 months ago by cjones051073 (Chris Jones)

Summary: libgcc12 build fails during configure test for MPC dep.libmpc Header mpc.h fails to include stdio.h required for FILE

comment:15 in reply to:  10 Changed 17 months ago by kencu (Ken)

Replying to cjones051073:

Ken, any thoughts here ? Do you know if Iain is aware of this or not ?

I don't see anything yet on his pages, no.

comment:16 Changed 17 months ago by cjones051073 (Chris Jones)

Thanks. I am more inclined to consider this an issue with libmpc than gcc, as its header directly refers to FILE but does not explicitly include the header that declares it, which breaks the ‘include what you use’ principle. Yes it seems that perhaps some recent Xcode change appears to have exposed this, but i think the core issue is there.

Last edited 17 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:17 Changed 17 months ago by Gcenx

This wasn’t an Xcode related change as this also affected one of my users on macOS Mojave.

comment:18 Changed 17 months ago by cjones051073 (Chris Jones)

Interesting....

I can only then presume maybe it was an issue introduced with the update from 1.2.1 to 1.3.0 that happened a few days back..

https://github.com/macports/macports-ports/commit/af6232833ada36aafff504cd4e181fca5cc759a7

Last edited 17 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:19 in reply to:  18 Changed 17 months ago by Gcenx

Replying to cjones051073:

Interesting....

I can only then presume maybe it was an issue introduced with the update from 1.2.1 to 1.3.0 that happened a few days back..

https://github.com/macports/macports-ports/commit/af6232833ada36aafff504cd4e181fca5cc759a7

I’d think that’s correct as I’d built mingw-w64 on macOS Ventura before this without issue.

comment:20 Changed 17 months ago by cjones051073 (Chris Jones)

Resolution: fixed
Status: newclosed

comment:21 Changed 17 months ago by cjones051073 (Chris Jones)

Just to note upstream have indeed already released 1.3.1 that addresses this

https://www.multiprecision.org/mpc/

For whatever reason though the source for version 1.3.1 is not yet available to the GNU sites the port file fetches it from,

https://ftp.gnu.org/gnu/mpc/

so we cannot update to this version quite yet.

Last edited 17 months ago by cjones051073 (Chris Jones) (previous) (diff)
Note: See TracTickets for help on using tickets.