MarcinMS
MarcinMS

Reputation: 93

C++: CLion error: the clang compiler does not support '-march=core2

I have a problem with CLion compilation after updating CL tools - it must have overwritten some configurations in gcc/clang, but can't see how to change them.

When trying to compile with CLion or otherwise in command line, I get an error clang: error: the clang compiler does not support '-march=core2'

My CMkaeLists.txt includes standard

cmake_minimum_required(VERSION 3.22)
project(pythontest7)
set(CMAKE_CXX_STANDARD 17)
add_executable(pythontest7 main.cpp)

which was working all the time until today.

I've tried to reinstalling CL dev tools and Xcode and it didn't help. I tried to remove gcc from usr/bin but was not allowed to do it.

I imagine I should change the default march in clang but did no find how to do it. I am really stuck with it, appreciate any help.

Upvotes: 1

Views: 3419

Answers (1)

MarcinMS
MarcinMS

Reputation: 93

After hours of configuration, I discovered that this is an M1-specific problem: after changing the option to cmake -DCMAKE_CXX_FLAGS='-march=apple-a14 -mcpu=cortex-a9 -mfloat-abi=hard', this is compiling again.

Upvotes: 3

Related Questions