This is an archive of the discontinued LLVM Phabricator instance.

[NFC][libc] Find the benchmark package and adjust the dependency targets
AbandonedPublic

Authored by lgxbslgx on Mar 24 2022, 6:05 AM.

Details

Reviewers
gchatelet
Summary

This commit removed unneeded gtest and benchmark configuration.

But it could not find the right benchmark package and provided the non-existent dependency targets.

This patch fixes it and the test check-llvmlibc passed locally(x86-linux).

Thanks for taking the time to review.

Best Regards,

  • Guoxiong

Diff Detail

Event Timeline

lgxbslgx created this revision.Mar 24 2022, 6:05 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 24 2022, 6:05 AM
lgxbslgx requested review of this revision.Mar 24 2022, 6:05 AM

Related issue: https://github.com/llvm/llvm-project/issues/53686


The premerge check(x64-debian) failed just now. But the patch passed locally. It seems to be ralated to the OS or cmake.

My local environment is shown below:

OS:
$ uname -a
Linux lgx-Aspire-E5-574G 5.4.0-105-generic #119~18.04.1-Ubuntu SMP Tue Mar 8 11:21:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

cmake:
$ cmake -version
cmake version 3.22.3

compiler:
$ clang-10 -v
clang version 10.0.0-4ubuntu1~18.04.2 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

This patch fails locally for me in the same way it fails on the build bot.

Also it compiles just fine without the patch.
Can you share the error message you're getting in the first place?

Also it compiles just fine without the patch.
Can you share the error message you're getting in the first place?

The error message I got is same as the https://github.com/llvm/llvm-project/issues/53686

When I removed the build directory to clean the cache and then rebuilt the project by using my patch, I got the error which is same as the premerge checks in the build bot.
Apologize for the confusedly previous information.

Conclusively, currently, the main branch and my patch can't be built successfully locally.
When using the main branch, it reports : The target "benchmark" does not exist. like the issue-53686
When using my patch, it reports: Could not find a package configuration file provided by "benchmark" like the premerge checks

When I try the following configuration, I get the error message like https://discourse.llvm.org/t/error-when-building-llvm-libc-with-gcc/4166.(Another error which is unrelated to this issue)
It seems that the package benchmark and the targets were found, which means the issue-53686 can be solved by the following configuration.
Could I get your help to try it in your environment to verify it? Thanks a lot.

find_package(benchmark REQUIRED PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../build/third-party/benchmark)
add_dependencies(libc-benchmark benchmark::benchmark)

I believe the benchmark CMake target is gated on some variable being defined.
Let me have a look, I'll reply ASAP.

@lgxbslgx I'vre created D122481 that should fix the issue.

@lgxbslgx can you abandon this patch?

lgxbslgx abandoned this revision.Mar 29 2022, 1:50 AM

Closing this revision because the issue has been solved in https://reviews.llvm.org/D122481.