conflicting declaration of 'char
ryandesign at macports.org
Sat Nov 20 07:47:29 UTC 2021
On Nov 19, 2021, at 00:01, Masha Vecherkovskaya wrote:
> Could someone please have a look, I can’t figure out this one myself. I’m trying to build a program and make fails with
> error: conflicting declaration of 'char* ctermid(char*)' with 'C' linkage
> 222 | char *ctermid(char *);
> I’ve attacheched all steps I’ve taken. I have also tried to use apple clang, but configure fails
> <strelka make.txt>
So you're looking for help compiling something called "strelka" using MacPorts gcc11 on macOS 10.14. And it is failing with this error:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/wchar.h:90,
/opt/local/lib/gcc11/gcc/x86_64-apple-darwin18/11.2.0/include-fixed/stdio.h:222:10: error: conflicting declaration of 'char* ctermid(char*)' with 'C' linkage
222 | char *ctermid(char *);
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:525,
/opt/local/lib/gcc11/gcc/x86_64-apple-darwin18/11.2.0/include-fixed/_ctermid.h:26:10: note: previous declaration with 'C++' linkage
26 | char *ctermid(char *);
The first question I would have is: Why use gcc? Can you use clang instead? If so, do that. Clang is the preferred toolchain on macOS.
If gcc is required and that requirement cannot be removed, then you might try the gcc-devel port to get a development version of gcc that's newer than version 11. Maybe this is a gcc bug that has already been fixed after version 11. If not, you may have to report to the bug to the developers of gcc for a fix.
According to this https://github.com/Illumina/strelka/blob/master/docs/userGuide/installation.md#prerequisites-to-build-from-source (if that is indeed the same strelka as the one you're trying to compile) only a C++11-compatible compiler is required, either gcc or clang.
More information about the macports-users