rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.64k stars 306 forks source link

Build error: /bin/sh: 1: ctest: not found #554

Closed hrcHarry closed 8 months ago

hrcHarry commented 8 months ago

Hi, I tried to build Bear and get error as follows.

[ 95%] Performing test step for 'BearSource'
/bin/sh: 1: ctest: not found
CMakeFiles/BearSource.dir/build.make:125: recipe for target 'subprojects/Stamp/BearSource/BearSource-test' failed
make[2]: *** [subprojects/Stamp/BearSource/BearSource-test] Error 127
CMakeFiles/Makefile2:173: recipe for target 'CMakeFiles/BearSource.dir/all' failed
make[1]: *** [CMakeFiles/BearSource.dir/all] Error 2
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2

I have no idea how to fix it. Could any one help? Is there something I missed? Thanks.

rizsotto commented 8 months ago

Well, it's hard to help if you give so little context. Try google for ctest: not found? Or just check your CMake installation?

hrcHarry commented 8 months ago

Thanks for replying.

I think CMake installation is fine. The info cmake --version gives

cmake version 3.28.0-rc3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

The complete info is as follows. Hope that helps.

[  2%] Creating directories for 'grpc_dependency'
[  4%] Performing download step (git clone) for 'grpc_dependency'
-- Avoiding repeated git clone, stamp file is up to date: '/home/USER/Desktop/123/Bear/build/subprojects/Stamp/grpc_dependency/grpc_dependency-gitclone-lastrun.txt'
[  7%] No update step for 'grpc_dependency'
[  9%] No patch step for 'grpc_dependency'
[ 12%] Performing configure step for 'grpc_dependency'
-- grpc_dependency configure command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/grpc_dependency/grpc_dependency-configure-*.log
[ 14%] Performing build step for 'grpc_dependency'
-- grpc_dependency build command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/grpc_dependency/grpc_dependency-build-*.log
[ 17%] Performing install step for 'grpc_dependency'
-- grpc_dependency install command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/grpc_dependency/grpc_dependency-install-*.log
[ 19%] Completed 'grpc_dependency'
[ 19%] Built target grpc_dependency
[ 19%] Built target googletest_dependency
[ 21%] Creating directories for 'nlohmann_json_dependency'
[ 24%] Performing download step (download, verify and extract) for 'nlohmann_json_dependency'
-- Downloading...
   dst='/home/USER/Desktop/123/Bear/build/subprojects/Download/nlohmann_json_dependency/v3.11.2.tar.gz'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/nlohmann/json/archive/v3.11.2.tar.gz'
-- verifying file...
       file='/home/USER/Desktop/123/Bear/build/subprojects/Download/nlohmann_json_dependency/v3.11.2.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/USER/Desktop/123/Bear/build/subprojects/Download/nlohmann_json_dependency/v3.11.2.tar.gz'
     dst='/home/USER/Desktop/123/Bear/build/subprojects/Source/nlohmann_json_dependency'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 26%] No update step for 'nlohmann_json_dependency'
[ 29%] No patch step for 'nlohmann_json_dependency'
[ 31%] Performing configure step for 'nlohmann_json_dependency'
-- nlohmann_json_dependency configure command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/nlohmann_json_dependency/nlohmann_json_dependency-configure-*.log
[ 34%] Performing build step for 'nlohmann_json_dependency'
-- nlohmann_json_dependency build command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/nlohmann_json_dependency/nlohmann_json_dependency-build-*.log
[ 36%] Performing install step for 'nlohmann_json_dependency'
-- nlohmann_json_dependency install command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/nlohmann_json_dependency/nlohmann_json_dependency-install-*.log
[ 39%] Completed 'nlohmann_json_dependency'
[ 39%] Built target nlohmann_json_dependency
[ 41%] Creating directories for 'fmt_dependency'
[ 43%] Performing download step (download, verify and extract) for 'fmt_dependency'
-- Downloading...
   dst='/home/USER/Desktop/123/Bear/build/subprojects/Download/fmt_dependency/10.1.0.tar.gz'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/fmtlib/fmt/archive/10.1.0.tar.gz'
-- verifying file...
       file='/home/USER/Desktop/123/Bear/build/subprojects/Download/fmt_dependency/10.1.0.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/USER/Desktop/123/Bear/build/subprojects/Download/fmt_dependency/10.1.0.tar.gz'
     dst='/home/USER/Desktop/123/Bear/build/subprojects/Source/fmt_dependency'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 46%] No update step for 'fmt_dependency'
[ 48%] No patch step for 'fmt_dependency'
[ 51%] Performing configure step for 'fmt_dependency'
-- fmt_dependency configure command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/fmt_dependency/fmt_dependency-configure-*.log
[ 53%] Performing build step for 'fmt_dependency'
-- fmt_dependency build command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/fmt_dependency/fmt_dependency-build-*.log
[ 56%] Performing install step for 'fmt_dependency'
-- fmt_dependency install command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/fmt_dependency/fmt_dependency-install-*.log
[ 58%] Completed 'fmt_dependency'
[ 58%] Built target fmt_dependency
[ 60%] Creating directories for 'spdlog_dependency'
[ 63%] Performing download step (download, verify and extract) for 'spdlog_dependency'
-- Downloading...
   dst='/home/USER/Desktop/123/Bear/build/subprojects/Download/spdlog_dependency/v1.12.0.tar.gz'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/gabime/spdlog/archive/v1.12.0.tar.gz'
-- verifying file...
       file='/home/USER/Desktop/123/Bear/build/subprojects/Download/spdlog_dependency/v1.12.0.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/USER/Desktop/123/Bear/build/subprojects/Download/spdlog_dependency/v1.12.0.tar.gz'
     dst='/home/USER/Desktop/123/Bear/build/subprojects/Source/spdlog_dependency'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 65%] No update step for 'spdlog_dependency'
[ 68%] No patch step for 'spdlog_dependency'
[ 70%] Performing configure step for 'spdlog_dependency'
-- spdlog_dependency configure command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/spdlog_dependency/spdlog_dependency-configure-*.log
[ 73%] Performing build step for 'spdlog_dependency'
-- spdlog_dependency build command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/spdlog_dependency/spdlog_dependency-build-*.log
[ 75%] Performing install step for 'spdlog_dependency'
-- spdlog_dependency install command succeeded.  See also /home/USER/Desktop/123/Bear/build/subprojects/Stamp/spdlog_dependency/spdlog_dependency-install-*.log
[ 78%] Completed 'spdlog_dependency'
[ 78%] Built target spdlog_dependency
[ 80%] Creating directories for 'BearSource'
[ 82%] No download step for 'BearSource'
[ 85%] No update step for 'BearSource'
[ 87%] No patch step for 'BearSource'
[ 90%] Performing configure step for 'BearSource'
loading initial cache file /home/USER/Desktop/123/Bear/build/subprojects/tmp/BearSource/BearSource-cache-Release.cmake
-- Looking for protoc ... /home/USER/Desktop/123/Bear/build/subprojects/Install/grpc_dependency/bin/protoc
-- Looking for grpc_cpp_plugin ... /home/USER/Desktop/123/Bear/build/subprojects/Install/grpc_dependency/bin/grpc_cpp_plugin
-- Configuring done (0.0s)
-- Generating done (0.1s)
-- Build files have been written to: /home/USER/Desktop/123/Bear/build/subprojects/Build/BearSource
[ 92%] Performing build step for 'BearSource'
[  1%] Building CXX object libflags/CMakeFiles/flags_a.dir/source/Flags.cc.o
[  1%] Built target flags_a
[  3%] Built target shell_a
[  5%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Os.cc.o
[  6%] Building CXX object libsys/CMakeFiles/sys_a.dir/source/Process.cc.o
[ 13%] Built target sys_a
[ 15%] Building CXX object libmain/CMakeFiles/main_a.dir/source/ApplicationLogConfig.cc.o
[ 16%] Building CXX object libmain/CMakeFiles/main_a.dir/source/ApplicationFromArgs.cc.o
[ 18%] Building CXX object libmain/CMakeFiles/main_a.dir/source/SubcommandFromArgs.cc.o
[ 18%] Built target main_a
[ 28%] Built target rpc_a
[ 32%] Built target domain_a
[ 33%] Building CXX object intercept/CMakeFiles/events_db_a.dir/source/collect/db/EventsDatabaseReader.cc.o
[ 35%] Building CXX object intercept/CMakeFiles/events_db_a.dir/source/collect/db/EventsDatabaseWriter.cc.o
[ 35%] Built target events_db_a
[ 49%] Built target exec_a
[ 50%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/SessionLibrary.cc.o
[ 52%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/Intercept.cc.o
[ 54%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/Reporter.cc.o
[ 55%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/Session.cc.o
[ 57%] Building CXX object intercept/CMakeFiles/intercept_a.dir/source/collect/SessionWrapper.cc.o
[ 59%] Built target intercept_a
[ 61%] Building CXX object intercept/CMakeFiles/wrapper_a.dir/source/report/wrapper/RpcClients.cc.o
[ 62%] Building CXX object intercept/CMakeFiles/wrapper_a.dir/source/report/wrapper/Application.cc.o
[ 66%] Built target wrapper_a
[ 67%] Building CXX object intercept/CMakeFiles/wrapper.dir/source/report/wrapper/main.cc.o
[ 69%] Linking CXX executable wrapper
[ 69%] Built target wrapper
[ 74%] Built target exec
[ 76%] Building CXX object citnames/CMakeFiles/citnames_json_a.dir/source/Configuration.cc.o
[ 77%] Building CXX object citnames/CMakeFiles/citnames_json_a.dir/source/Output.cc.o
[ 77%] Built target citnames_json_a
[ 79%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/Citnames.cc.o
[ 81%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/Build.cc.o
[ 83%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/Parsers.cc.o
[ 84%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/Semantic.cc.o
[ 86%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/ToolClang.cc.o
[ 88%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/ToolCuda.cc.o
[ 89%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/ToolGcc.cc.o
[ 91%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/ToolWrapper.cc.o
[ 93%] Building CXX object citnames/CMakeFiles/citnames_a.dir/source/semantic/ToolExtendingWrapper.cc.o
[ 94%] Built target citnames_a
[ 96%] Building CXX object bear/CMakeFiles/bear_a.dir/source/Application.cc.o
[ 96%] Built target bear_a
[ 98%] Building CXX object bear/CMakeFiles/bear.dir/main.cc.o
[100%] Linking CXX executable bear
[100%] Built target bear
[ 95%] Performing test step for 'BearSource'
/bin/sh: 1: ctest: not found
CMakeFiles/BearSource.dir/build.make:125: recipe for target 'subprojects/Stamp/BearSource/BearSource-test' failed
make[2]: *** [subprojects/Stamp/BearSource/BearSource-test] Error 127
CMakeFiles/Makefile2:173: recipe for target 'CMakeFiles/BearSource.dir/all' failed
make[1]: *** [CMakeFiles/BearSource.dir/all] Error 2
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2
rizsotto commented 8 months ago

Could you run these commands for me?

hrcHarry commented 8 months ago

Thanks for replying

> uname -a
Linux USER-VirtualBox 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

> ctest --version
Command 'ctest' not found, but can be installed with:

sudo snap install cmake  # version 3.27.7, or
sudo apt  install cmake

See 'snap info cmake' for additional versions.

> which cmake
/usr/local/bin/cmake

> which ctest
>                                 # (No result shown)

> echo $PATH
/home/USER/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

I think the problem may be the installation of cmake so I re-install it, by snap, again. (I installed it by vcpkg last time)

After re-installing cmake, ctest --version and which ctest now give the information

> which ctest
/snap/bin/ctest

> ctest --version
ctest version 3.27.7
CMake suite maintained and supported by Kitware (kitware.com/cmake).

And, finally, bear make all and make install work.

> bear --version
bear 3.1.3

Thanks for giving the hint. 😀