CMake неправильно установлен в моем образе докера Ubuntu

Я пытаюсь поэкспериментировать с этим репозиторием git подобия образа в экземпляре образа докера Ubuntu.

Там перечислены инструкции по установке / сборке, включая 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#

и cmake был установлен с помощью apt-get install cmake

root@492332e8a783:/projects/perceptualdiff/perceptualdiff# whereis cmake
cmake: /usr/bin/cmake /usr/share/cmake

Так что может кто-нибудь, пожалуйста, помогите мне собрать этот код с помощью make (который, как я предполагаю, должен использовать cmake )?

0
задан 28 May 2020 в 11:56

1 ответ

In the ubuntu docker image AFAIK there's no compiler for C++ pre-installed . And this is also the problem which CMake is complaining about :

No CMAKE_CXX_COMPILER could be found

So you have to install g++ via

sudo apt install g++

or if you want clang++

sudo apt install clang-9

It has nothing to do with cmake . That's actually the CMake's workflow to gather information about your system to actually generate the required Makefiles. If it cannot find the required softwares ( e.g c++ compiler ) or modules (e.g foo.cmake) it generates such errors.

And note that CMake just creates the Makefiles for you and in order to compile the source code you need to run make.

Best regards :)

1
ответ дан 19 June 2020 в 21:35

Другие вопросы по тегам:

Похожие вопросы: