Using MacPorts gcc14 (stdio.h trouble error: unknown type name 'FILE)
Chris Jones
jonesc at hep.phy.cam.ac.uk
Thu Feb 13 11:46:33 UTC 2025
Hi,
Looks like its this
https://github.com/iains/gcc-14-branch/issues/7
Basically, GCC is sensitive to the SDK it was built against. Looks like
you are likely using the binary install of gcc14 on macOS14, which would
have been built using the macOS14 SDK, but you are giving it the macOS15
SDK. This is known to have problems, see the above.
You need to match SDKs. So either build GKlib using macOS14 SDK, or
rebuild locally your gcc14 port against macOS15 SDK.
Or just use clang, which is anyway the defacto default C(C++) compiler
on macOS.
Chris
On 12/02/2025 9:46 pm, Gerben Wierda wrote:
> I am trying to compile a library (GKlib) with MacPorts gcc14 on Sonoma
> 14.7,3. MacPorts is up to date
>
>
> I have set thing sup with
>
> git clone https://github.com/KarypisLab/GKlib.git <https://github.com/
> KarypisLab/GKlib.git>
>
> cd GKlib
>
> make config cc=gcc-mp-14 prefix=../GKlibInstall
>
> make
>
>
> /opt/local/bin/gcc-mp-14 -I/Users/gerben/RenskeDev/Leon/fromsource/
> GKlib/. -I/Users/gerben/RenskeDev/Leon/fromsource/GKlib/test -DLINUX -
> D_FILE_OFFSET_BITS=64 -std=c99 -fno-strict-aliasing -march=native -fPIC
> -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-
> variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label -
> DNDEBUG -DNDEBUG2 -DHAVE_EXECINFO_H -DHAVE_GETLINE -O3 -isysroot /
> Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX15.2.sdk -mmacosx-version-min=14.7 -MD -MT
> CMakeFiles/GKlib.dir/b64.c.o -MF CMakeFiles/GKlib.dir/b64.c.o.d -o
> CMakeFiles/GKlib.dir/b64.c.o -c /Users/gerben/RenskeDev/Leon/fromsource/
> GKlib/b64.c
>
> In file included from */Users/gerben/RenskeDev/Leon/fromsource/GKlib/
> GKlib.h:32*,
>
> from */Users/gerben/RenskeDev/Leon/fromsource/GKlib/
> b64.c:20*:
>
> */opt/local/lib/gcc14/gcc/x86_64-apple-darwin23/14.2.0/include-fixed/
> stdio.h:83:8:* *error: *unknown type name '*FILE*'
>
> 83 | extern *FILE**__stdinp;
>
> | *^~~~*
>
> *
> *
>
> A test file in the directory above compiles fine. I’ve seen messages
> with this kind of trouble but I don’t understand exactly where this is
> going wrong.
>
>
> */opt/local/lib/gcc14/gcc/x86_64-apple-darwin23/14.2.0/include-fixed/
> stdio.h* starts with:
>
> #ifndef _STDIO_H_
>
> #define _STDIO_H_
>
>
> #include <_stdio.h>
>
>
> #include <sys/_types/_seek_set.h>
>
>
> __BEGIN_DECLS
>
> extern FILE *__stdinp;
>
>
> When testing with the test file, the culprit seems to be
>
>
> -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/
> MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk
>
>
> It’s been far too long I have been doing stuff like this, so I could use
> tips.
>
>
> Thanks,
>
>
> G
>
More information about the macports-users
mailing list