COIN-OR-OptimizationSuite icon indicating copy to clipboard operation
COIN-OR-OptimizationSuite copied to clipboard

Linux-CI builds for Clang should explicitly specify "CC=clang CXX=clang++"

Open jhmgoossens opened this issue 10 months ago • 0 comments

Based on https://github.com/coin-or/COIN-OR-OptimizationSuite/issues/25#issuecomment-2041162969 by @tkralphs : Projects that use a linux-ci yaml workflow specifically to compile with Clang must explicitly specify the C compiler (CC) and C++ compiler (CXX) using CC=clang CXX=clang++. It is not sufficient to specify only CC=clang. Without adding CXX=clang++, the compiler is detected as g++, which is really a wrapper around clang++ on MacOS.

This seems to only cause a problem with SYMPHOY because it decides whether to add -fopenmp based on whether the compiler is g++ or not. However, without this explicit CXX=clang++, the configure script has no way of knowing whether it's using clang or gcc. Thus, we are getting lucky to a certain extent that this is working with most projects.

Any number of things could go wrong at some point in the future due to the configure script thinking that it is working with g++ when it is actually working with clang++. The worst of these would be that the real g++ is actually installed on the build machine and we end up using that when we intended to use clang++, so clang is not really being tested when we thought it was.

jhmgoossens avatar Apr 08 '24 19:04 jhmgoossens