我正在尝试在 Ubuntu docker 图像实例中使用这个图像相似性 git repo 。
那里列出了安装/构建说明,其中包括 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
)?
在 ubuntu docker 映像 AFAIK 中,没有预安装 C++ 的编译器。这也是 CMake 抱怨的问题:
所以你必须通过安装 g++
或者如果你想
clang++
它与 cmake 无关。这实际上是 CMake 收集系统信息以实际生成所需 Makefile 的工作流程。如果它找不到所需的软件(例如 c++ 编译器)或模块(例如 foo.cmake),则会生成此类错误。
请注意,CMake 只是为您创建 Makefile,以便编译您需要运行的源代码
make
。此致 :)