Zulip Chat Archive

Stream: lean4

Topic: clang: error: unknown argument: '-fstack-clash-protection'


Heather Macbeth (Dec 31 2023 at 21:56):

I'm trying to build Lean core (reason). Here's where things started to go wrong:

[ 61%] Building CXX object library/compiler/CMakeFiles/compiler.dir/ir.cpp.o
[ 61%] Building CXX object library/compiler/CMakeFiles/compiler.dir/implemented_by_attribute.cpp.o
[ 62%] Building CXX object library/compiler/CMakeFiles/compiler.dir/ir_interpreter.cpp.o
[ 63%] Building CXX object library/compiler/CMakeFiles/compiler.dir/llvm.cpp.o
[ 63%] Built target compiler
[ 63%] Linking CXX static library lib/lean/libleancpp.a
[ 63%] Built target leancpp
[    ] Building ../stdlib//Init/NotationExtra.c
clang: error: unknown argument: '-fstack-clash-protection'
make[7]: *** [../../build/release/stage0/lib/temp/Init/NotationExtra.o] Error 1
make[6]: *** [Init] Error 2
make[5]: *** [CMakeFiles/make_stdlib] Error 2
make[4]: *** [CMakeFiles/make_stdlib.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [stage0-prefix/src/stage0-stamp/stage0-build] Error 2
make[1]: *** [CMakeFiles/stage0.dir/all] Error 2
make: *** [all] Error 2

Can anyone troubleshoot this?

Henrik Böving (Dec 31 2023 at 22:00):

@Heather Macbeth what is the version of your clang? stack-clash-protection is a flag from 2020 so if your thing is too old it might not have this yet. The solution would be to...pretty much get a clang that is not almost 4 years old

Mario Carneiro (Dec 31 2023 at 22:01):

Are you on linux? Maybe try running the sudo apt-get install git libgmp-dev cmake ccache clang line again

Heather Macbeth (Dec 31 2023 at 22:03):

I'm on an old MacOS (Catalina). But cmake --version says

cmake version 3.28.1

which appears to be the latest.

Mario Carneiro (Dec 31 2023 at 22:03):

what about clang --version?

Heather Macbeth (Dec 31 2023 at 22:03):

Apple clang version 12.0.0 (clang-1200.0.26.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Henrik Böving (Dec 31 2023 at 22:03):

cmake is the thing that figures out what clang commands to run, clang is the thing that translates C so they can be completely different

Mario Carneiro (Dec 31 2023 at 22:03):

I get

Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Henrik Böving (Dec 31 2023 at 22:04):

clang 12 is very early 2021, so I would guess you are probably exactly one version off

Heather Macbeth (Dec 31 2023 at 22:06):

Do you happen to know how to update clang on MacOS?

Henrik Böving (Dec 31 2023 at 22:07):

I believe clang is part of the apple developer tools? So however you might update those...

Mario Carneiro (Dec 31 2023 at 22:07):

https://stackoverflow.com/questions/74744762/how-can-i-upgrade-the-built-in-apple-clang-on-macos

Mario Carneiro (Dec 31 2023 at 22:07):

I cannot vouch for any of the things written there though


Last updated: May 02 2025 at 03:31 UTC