Skip to content

runtimes incremental build didn't rebuild GoogleTest when it is changed #66272

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
zeroomega opened this issue Sep 13, 2023 · 1 comment
Open

Comments

@zeroomega
Copy link
Contributor

I noticed that a few bots (e.g. https://lab.llvm.org/buildbot/#/builders/240/builds/15001) reports linker error after my GoogleTest patch was landed, error message:

FAILED: compiler-rt/lib/fuzzer/tests/FuzzerUtils-aarch64-Test /b/sanitizer-aarch64-linux-fuzzer/build/llvm_build0/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/tests/FuzzerUtils-aarch64-Test 
cd /b/sanitizer-aarch64-linux-fuzzer/build/llvm_build0/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/tests && /b/sanitizer-aarch64-linux-fuzzer/build/llvm_build0/./bin/clang++ FuzzedDataProviderTestObjects.FuzzedDataProviderUnittest.cpp.aarch64.o FuzzedDataProviderTestObjects.gtest-all.cc.aarch64.o -o /b/sanitizer-aarch64-linux-fuzzer/build/llvm_build0/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/tests/./FuzzerUtils-aarch64-Test -fuse-ld=lld -Wl,--color-diagnostics -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -lpthread -nostdlib++ -fno-exceptions /b/sanitizer-aarch64-linux-fuzzer/build/llvm_build0/runtimes/runtimes-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_aarch64/lib/libc++.a -march=armv8-a
ld.lld: error: undefined symbol: testing::internal2::PrintBytesInObjectTo(unsigned char const*, unsigned long, std::__Fuzzer::basic_ostream<char, std::__Fuzzer::char_traits<char>>*)
>>> referenced by gtest-printers.h:158 (/b/sanitizer-aarch64-linux-fuzzer/build/llvm-project/runtimes/../third-party/unittest/googletest/include/gtest/gtest-printers.h:158)
>>>               FuzzedDataProviderTestObjects.FuzzedDataProviderUnittest.cpp.aarch64.o:(std::__Fuzzer::basic_string<char, std::__Fuzzer::char_traits<char>, std::__Fuzzer::allocator<char>> testing::internal::FormatForComparisonFailureMessage<FuzzedDataProvider_ConsumeEnum_Test::TestBody()::Enum, FuzzedDataProvider_ConsumeEnum_Test::TestBody()::Enum>(FuzzedDataProvider_ConsumeEnum_Test::TestBody()::Enum const&, FuzzedDataProvider_ConsumeEnum_Test::TestBody()::Enum const&))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

The line number gtest-printers.h:158, however, doesn't match the file patched by my PR, instead, it matches the old version before my patch was landed. This indicates that the bot was doing an incremental build and somehow the changed GoogleTest wasn't being rebuilt in this process. This issue can be reproduced in following steps locally:

In LLVM source tree:

$ git checkout 58d50b0cadafe118faf2e7d7bf738d2daa38bb73
$ mkdir build-incremental
$ cd build-incremental
$ /mnt/nvme_sec/SRC/llvm-prebuilts/cmake/linux-amd64/bin/cmake -DLLVM_APPEND_VC_REV=OFF -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm
$ ninja
$ ninja -C runtimes/runtimes-bins check-fuzzer
# Test should pass.

# Now patch the GoogleTest
$ cd ..
$ git checkout 54c1a9b20d89e85cd60d002c77b34c00f36520f4
$ cd build-incremental
$ ninja -C runtimes/runtimes-bins check-fuzzer
# Test will fail with error message above
# Test will pass if doing a clean build

I think this is an dependency bug in runtimes' build file and it should be fixed.

@zeroomega
Copy link
Contributor Author

C.C. @petrhosek

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

No branches or pull requests

2 participants