Help with UsingTheRightCompiler

Ryan Schmidt ryandesign at macports.org
Sat Jul 25 03:11:19 UTC 2020



On Jul 24, 2020, at 13:47, Frank Schima wrote:

> I tried setting CC like so:
> 
> build.args          CC="${configure.cpp} [get_canonical_archflags cc]"
> 
> But it still does not work. Here is the resulting compiler used:
> 
> /usr/bin/cpp -arch x86_64 -Wall -g -O2 -I/opt/X11/include -DPNG -DPNG15 -Wno-write-strings -Wno-overflow -c ascii.c

${configure.cpp} is the C preprocessor, not the C++ compiler.


> Also, I don’t see clang++ in the compilers listed in https://trac.macports.org/wiki/UsingTheRightCompiler. 

"In fact there are more variables than just CC: there's also CXX for the C++ compiler and CPP for the C pre-processor."


> So I hacked it by using:
> 
> build.args          CC="/usr/bin/clang++"
> 
> And it builds! But that does not seem to be the Macports way. How can I set the compiler with Macports?

Sounds like the only problem is that the developer put C++ code in a .c file. You should tell the developer to either rename the file to .cpp and use $CXX to compile it, or remove the C++ code from it to leave it as a C file.


More information about the macports-dev mailing list