On Sonntag, 12. Mai 2019 20:01:21 CEST Segher Boessenkool wrote:
> On Sun, May 12, 2019 at 03:53:53PM +0100, Iain Sandoe wrote:
> > Right now, we don’t install a “cc”  [we install gcc]  but we do install
> > “c++” [ we also install g++, of course].
> > 
> > Some configure scripts (and one or two places in the testsuite) do try to
> > invoke ‘cc’ which can lead to inconsistent tools being used, if a GCC
> > install is ahead in the PATH of some other install which does provide cc.
> > 
> > Is there a reason for this omission, or is it unintentional?
> 
> "cc" isn't POSIX, since over a decade I think.  "c99" is POSIX, and it is
> a shell script calling whatever "gcc" is first in the PATH, on most distros.
> 
> Many scripts that call "cc" expect to find a K&R compiler, historically at
> least -- maybe all such scripts went the way of the dodo, that wouldn't be
> so bad.
> 
> I don't know about "c++", and it is pretty much impossible to search for.
> Jeff added it in <https://gcc.gnu.org/r34527>, maybe he can clarify?  But
> that was quite some time ago ;-)

My experience on a cluster at GSI was that the missing cc threw off cmake. 
Environment modules are used to provide newer GCC installs than the (old) 
system compiler. But those module scripts only prefix the PATH. Thus, without 
$CXX and $CC, cmake went out looking for whatever c++ and cc in the path would 
do. And so it found GCC 8 for C++ and GCC 4.8 for C.

Since I took over creating those environment modules for newer GCC 
installations, I added a cc hardlink into prefix/bin (just as the c++ one) and 
started to set the CXX and CC envvars.

cmake 3.10.2 still does it that way if CXX/CC are not set:
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works

-- 
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                                https://kretzfamily.de
 GSI Helmholtzzentrum für Schwerionenforschung             https://gsi.de
 SIMD easy and portable                     https://github.com/VcDevel/Vc
──────────────────────────────────────────────────────────────────────────

Reply via email to