Skip to content

[BUG] Tests fail to build with clang-20 #1966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jdoubleu opened this issue Apr 10, 2025 · 1 comment
Open

[BUG] Tests fail to build with clang-20 #1966

jdoubleu opened this issue Apr 10, 2025 · 1 comment

Comments

@jdoubleu
Copy link

jdoubleu commented Apr 10, 2025

Describe the bug
I noticed, that the unit tests fail to build with clang-20:

c++: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
gmake[2]: *** [test/CMakeFiles/state_assembly_test.dir/build.make:76: test/CMakeFiles/state_assembly_test.dir/state_assembly_test.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1771: test/CMakeFiles/state_assembly_test.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
c++: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
c++: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
gmake[2]: *** [test/CMakeFiles/donotoptimize_assembly_test.dir/build.make:76: test/CMakeFiles/donotoptimize_assembly_test.dir/donotoptimize_assembly_test.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1719: test/CMakeFiles/donotoptimize_assembly_test.dir/all] Error 2
gmake[2]: *** [test/CMakeFiles/clobber_memory_assembly_test.dir/build.make:76: test/CMakeFiles/clobber_memory_assembly_test.dir/clobber_memory_assembly_test.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1823: test/CMakeFiles/clobber_memory_assembly_test.dir/all] Error 2

System
Which OS, compiler, and compiler version are you using:

  • OS: Linux 5.15.167.4
  • Compiler and version: clang 20.1.2

To reproduce
Steps to reproduce the behavior:

docker run --rm -it silkeh/clang:20 sh -c '
apt update && apt install -y git cmake;
mkdir /app && cd /app;
git clone https://github.com/google/benchmark.git;
cmake -B build -S benchmark/ -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON;
cmake --build build/ --parallel;'

Additional context
I find the error messages odd; this might be a CMake issue.

Using cmake --build build/ --verbose I get the following output for the compile command:

[ 62%] Building CXX object test/CMakeFiles/state_assembly_test.dir/state_assembly_test.cc.o
cd /app/build/test && /usr/bin/c++ -DBENCHMARK_STATIC_DEFINE -DHAVE_POSIX_REGEX -DHAVE_PTHREAD_AFFINITY -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -DHAVE_THREAD_SAFETY_ATTRIBUTES -DTEST_BENCHMARK_LIBRARY_HAS_NO_ASSERTIONS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/app/benchmark/include -Wall  -Wextra  -Wshadow  -Wfloat-equal  -Wold-style-cast  -Wconversion  -Werror  -pedantic  -pedantic-errors  -Wshorten-64-to-32  -fstrict-aliasing  -Wno-deprecated-declarations  -Wno-deprecated  -Wstrict-aliasing  -Wthread-safety  -Wno-unused-variable -fvisibility=hidden -fvisibility-inlines-hidden   -UNDEBUG -S -O3 -g0 -fno-stack-protector -std=c++17 -MD -MT test/CMakeFiles/state_assembly_test.dir/state_assembly_test.cc.o -MF CMakeFiles/state_assembly_test.dir/state_assembly_test.cc.o.d -o CMakeFiles/state_assembly_test.dir/state_assembly_test.cc.o -c /app/benchmark/test/state_assembly_test.cc
gmake[2]: Leaving directory '/app/build'
/usr/bin/gmake  -f test/CMakeFiles/repetitions_test.dir/build.make test/CMakeFiles/repetitions_test.dir/build
gmake[2]: Entering directory '/app/build'
gmake[2]: Leaving directory '/app/build'
/usr/bin/gmake  -f test/CMakeFiles/cxx11_test.dir/build.make test/CMakeFiles/cxx11_test.dir/build
c++: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
gmake[2]: *** [test/CMakeFiles/clobber_memory_assembly_test.dir/build.make:76: test/CMakeFiles/clobber_memory_assembly_test.dir/clobber_memory_assembly_test.cc.o] Error 1
gmake[2]: Leaving directory '/app/build'
gmake[1]: *** [CMakeFiles/Makefile2:1823: test/CMakeFiles/clobber_memory_assembly_test.dir/all] Error 2
gmake[2]: Entering directory '/app/build'
c++: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
@jdoubleu
Copy link
Author

This might also be a clang issue, after all: llvm/llvm-project#100909 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant