我正在尝试这个图像相似度 git repo在 Ubuntu docker 镜像实例中。
安装/构建说明列在那里,其中包括 cmake。
当我进入目录并输入时,make
我收到一些奇怪的构建错误我正在猜测与错误安装的应用程序有关cmake
。
root@492332e8a783:/projects/perceptualdiff/perceptualdiff# ls -al
total 164
drwxr-xr-x 5 root root 4096 May 26 21:22 .
drwxr-xr-x 3 root root 4096 May 26 21:22 ..
-rw-r--r-- 1 root root 1385 May 26 21:22 .clang-format
lrwxrwxrwx 1 root root 21 May 26 21:22 .clang_complete -> .syntastic_cpp_config
drwxr-xr-x 8 root root 4096 May 26 21:22 .git
-rw-r--r-- 1 root root 269 May 26 21:22 .gitignore
-rw-r--r-- 1 root root 11 May 26 21:22 .syntastic_cpp_config
-rw-r--r-- 1 root root 536 May 26 21:22 .travis.yml
-rw-r--r-- 1 root root 2798 May 26 21:22 CMakeLists.txt
-rw-r--r-- 1 root root 2540 May 26 21:22 FindFreeImage.cmake
-rw-r--r-- 1 root root 17990 May 26 21:22 LICENSE
-rw-r--r-- 1 root root 503 May 26 21:22 Makefile
-rw-r--r-- 1 root root 4304 May 26 21:22 README.rst
drwxr-xr-x 3 root root 4096 May 26 21:25 build
-rw-r--r-- 1 root root 10377 May 26 21:22 compare_args.cpp
-rw-r--r-- 1 root root 1937 May 26 21:22 compare_args.h
-rwxr-xr-x 1 root root 206 May 26 21:22 coverage.bash
-rwxr-xr-x 1 root root 535 May 26 21:22 coveralls.bash
-rwxr-xr-x 1 root root 308 May 26 21:22 coverity.bash
-rw-r--r-- 1 root root 1138 May 26 21:22 exceptions.h
-rw-r--r-- 1 root root 3311 May 26 21:22 lpyramid.cpp
-rw-r--r-- 1 root root 1538 May 26 21:22 lpyramid.h
-rwxr-xr-x 1 root root 450 May 26 21:22 memcheck.bash
-rw-r--r-- 1 root root 248 May 26 21:22 memcheck.supp
-rw-r--r-- 1 root root 14705 May 26 21:22 metric.cpp
-rw-r--r-- 1 root root 2209 May 26 21:22 metric.h
-rw-r--r-- 1 root root 2889 May 26 21:22 perceptualdiff.cpp
-rw-r--r-- 1 root root 4885 May 26 21:22 rgba_image.cpp
-rw-r--r-- 1 root root 4123 May 26 21:22 rgba_image.h
drwxr-xr-x 2 root root 4096 May 26 21:22 test
root@492332e8a783:/projects/perceptualdiff/perceptualdiff# make
mkdir -p build
test -f build/Makefile || cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/projects/perceptualdiff/perceptualdiff/build/CMakeFiles/CMakeOutput.log".
See also "/projects/perceptualdiff/perceptualdiff/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:7: build] Error 1
root@492332e8a783:/projects/perceptualdiff/perceptualdiff#
并且安装了 cmakeapt-get install cmake
root@492332e8a783:/projects/perceptualdiff/perceptualdiff# whereis cmake
cmake: /usr/bin/cmake /usr/share/cmake
那么有人可以帮我获取这个代码来构建吗make
(我假设需要使用cmake
)?
答案1
据我所知,在 ubuntu docker 镜像中没有预安装 C++ 编译器。这也是 CMake 抱怨的问题:
No CMAKE_CXX_COMPILER could be found
因此你必须通过以下方式安装 g++
sudo apt install g++
或者如果你想clang++
sudo apt install clang-9
它与 cmake 无关。这实际上是 CMake 的工作流程,用于收集有关您的系统的信息以实际生成所需的 Makefile。如果它找不到所需的软件(例如 c++ 编译器)或模块(例如 foo.cmake),它就会生成此类错误。
请注意,CMake 只会为您创建 Makefile,以便编译您需要运行的源代码make
。
此致 :)