Incorrect defaulting of CC/CXX on macOS

Issue #209 resolved
Dan Bonachea created an issue

From INSTALL.md:

On macOS, UPC++ defaults to using the Apple LLVM clang compiler that is part of the Xcode Command Line Tools.

Due to a script bug affecting all current releases, this defaulting is not working correctly for macOS.

Specifically, if the user does not set $CC and $CXX, then the first instances of {gcc,g++} in the user $PATH are always used. This means that if homebrew/fink versions of GCC appear in $PATH before /usr/bin (a common practice), then the install script will default to those instead.

There are two secondary effects of this installer bug when the compiler is defaulted:

  1. the compiler version info printed early in the install output may not reference the compiler actually being used
  2. the compiler compatibility checks performed early in install may be performed against the wrong compiler.

The recommended workaround is for macOS users to explicitly set the variables to select a compiler by full pathname, eg:

env CC=/usr/bin/clang CXX=/usr/bin/clang++ ./install <install-path>

This is highly recommended as the first step when triaging any install/build issues on macOS until this defect is repaired.

Comments (4)

  1. Dan Bonachea reporter

    issue #209: Broken install defaulting of CC/CXX on macOS

    Remove the explicit subshell in platform_sanity_checks that was preventing its defaulting modifications to CC/CXX from propagating to the install script caller.

    Add missing exports to ensure that defaulted CC/CXX are passed to nobs.

    Convert most temporary variables to explicit locals to prevent their propagation.

    Resolves issue #209.

    → <<cset 0fd8fd82aee1>>

  2. Dan Bonachea reporter

    issue #209: Broken install defaulting of CC/CXX on macOS

    Remove the explicit subshell in platform_sanity_checks that was preventing its defaulting modifications to CC/CXX from propagating to the install script caller.

    Add missing exports to ensure that defaulted CC/CXX are passed to nobs.

    Convert most temporary variables to explicit locals to prevent their propagation.

    Resolves issue #209.

    (cherry picked from commit 0fd8fd82aee107f013d91cc1084ff257599611e5)

    → <<cset 4b4d7f9e0a90>>

  3. Log in to comment