Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_ASM_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

Hello!
I have recently installed the ClickHouse from here: (How to Build ClickHouse on Mac OS X - ClickHouse Documentation).
Successfully I have download the Clickhouse but when I run this command from documentation:
“cmake … -DCMAKE_CXX_COMPILER=which g++-8 -DCMAKE_C_COMPILER=which gcc-8” then it returns me errors like:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: /path/to/clang

I’ve tried a lot of solutions but all in vain. I don’t know in mac how can I make my cmake to get the C, CXX or ASM compiler.
Seeking Help!

I guess you have a different g++ version installed or none at all.
Try the which g++-8 call directly to see if it is found.
Try to look for the version-less binary which g++

when I install gcc with brew on current OSX it will be gcc-12 and which returns a full path:

Claus-iMac: clausklein$ brew install gcc
Warning: gcc 12.2.0 is already installed and up-to-date.
To reinstall 12.2.0, run:
  brew reinstall gcc
Claus-iMac: clausklein$ which g++-12
/usr/local/bin/g++-12

and it works with simple environment vars too:

Claus-iMac:agent++-4.5.1 clausklein$ head GNUmakefile
BUILD_TYPE?=Debug

export CXX=g++-12
export CC=gcc-12

export CMAKE_BUILD_TYPE=$(BUILD_TYPE)
export CPM_USE_LOCAL_PACKAGES=0
export CPM_SOURCE_CACHE=${HOME}/.cache/CPM

MACHINE:=$(shell uname -m)
Claus-iMac:agent++-4.5.1 clausklein$ make build
mkdir -p ../build-agent++-4.5.1-x86_64-Debug
cmake -B ../build-agent++-4.5.1-x86_64-Debug -S . -G Ninja -D BUILD_SHARED_LIBS=YES
-- The CXX compiler identification is GNU 12.2.0
-- The C compiler identification is GNU 12.2.0
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/g++-12 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/gcc-12 - skipped
-- Detecting C compile features
-- Detecting C compile features - done

Hey @ClausKlein,
I’ve checked that i’ve already installed g+±12.

lalarukh@lalarukhs-MacBook-Pro ~ % brew install gcc
Warning: gcc 12.2.0 is already installed and up-to-date.
To reinstall 12.2.0, run:
  brew reinstall gcc

need your guidance that how can i make cmake to find the CC, CXX and ASM in my mac.

When I checked my g++, it was 12.
So, instead of g+±8 I ran this command with g+±12:

cmake .. -DCMAKE_CXX_COMPILER=`which g++-12` -DCMAKE_C_COMPILER=`which gcc-12`

And it ran perfectly, found the C and CXX but again couldn’t found the ASM.

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is unknown

Let me know how can I make ASM to be recognizable by g+±12.

I have never used or needed an ASM.

Perhaps this helps: GitHub - jaredsburrows/assembly-example: Common Functions and Code written in Assembly Language

Take a try with NASM:

bash-3.2$ brew info nasm
==> nasm: stable 2.16.01 (bottled)
Netwide Assembler (NASM) is an 80x86 assembler
https://www.nasm.us/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/nasm.rb
License: BSD-2-Clause

I have installed the NASM using brew.
And replaced ASM with NASM in CMakeLists file. But still I’m getting this:
Getting this error again:

CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_NASM_COMPILER could be found.

  Tell CMake where to find the compiler by setting the CMake cache entry
  CMAKE_NASM_COMPILER to the full path to the compiler, or to the compiler
  name if it is in the PATH.

The right language should be ASM_NASM.

1 Like

Thank you so much for this much support.
Now ASM_NASM identification is known. But this time I ran into this issue:

-- The ASM_NASM compiler identification is NASM
-- Found assembler: /usr/local/bin/nasm
-- Using compiler:
g++-12 (Homebrew GCC 12.2.0) 12.2.0
CMake Error at cmake/tools.cmake:24 (message):
  Compilation with GCC is unsupported.  Please use Clang instead.
Call Stack (most recent call first):
  CMakeLists.txt:18 (include)

IMHO: You should read How to Build ClickHouse on macOS | ClickHouse Docs