Invalid default compiler flag on ARM
thirtythreeforty opened this issue · 1 comments
thirtythreeforty commented
On Ubuntu 22.04 running on a c7g.16xlarge AWS instance with Clang 15, I get the following error following HACKING.md:
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"/usr/bin/clang++-15"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/ubuntu/libfork/build/dev/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_1185a && [1/2] Building CXX object CMakeFiles/cmTC_1185a.dir/testCXXCompiler.cxx.o
FAILED: CMakeFiles/cmTC_1185a.dir/testCXXCompiler.cxx.o
/usr/bin/clang++-15 -Wno-assume -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -std=c++20 -MD -MT CMakeFiles/cmTC_1185a.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_1185a.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_1185a.dir/testCXXCompiler.cxx.o -c /home/ubuntu/libfork/build/dev/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
The following change allows it to build:
diff --git a/CMakePresets.json b/CMakePresets.json
index 3134d07..c173de0 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -61,7 +61,7 @@
"name": "flags-linux",
"hidden": true,
"cacheVariables": {
- "CMAKE_CXX_FLAGS": "-Wno-assume -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast",
+ "CMAKE_CXX_FLAGS": "-Wno-assume -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast",
"CMAKE_EXE_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now",
"CMAKE_SHARED_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now"
}
ConorWilliams commented
These flags are not really intended for benchmarking so I'm going to add a separate pre-set.