Как я могу исправить «Нет известных функций для компилятора CXX» при компиляции с CMake (Linux Mint) - PullRequest
2 голосов
/ 24 апреля 2020

Я пытаюсь установить этот плагин: https://github.com/CatxFish/obs-v4l2sink

Я выполнил все шаги (установил QT, получил исходный код obs-studio и затем попытался собрать плагин):

sudo apt install qtbase5-dev

git clone --recursive https://github.com/obsproject/obs-studio.git

git clone https://github.com/CatxFish/obs-v4l2sink.git
cd obs-v4l2sink
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..

Но потом ...

 -- Configuring done
CMake Error in CMakeLists.txt:
  No known features for CXX compiler

  ""

  version .


-- Build files have been written to: /home/********/obs-v4l2sink/build

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

Из того, что я нашел в Интернете, вот что я сделал:

  • build-essential уже установлен;
  • c++, cc и все также установлен;
  • попытался добавить -DCMAKE_CXX_COMPILER=/usr/bin/cc в командную строку cmake (сделал то же самое с c ++);

И, конечно, я сделал update && upgrade

Вот что находится в файле CMakeError.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/cc 
Build flags: 
Id flags:  

The output was:
1
/usr/bin/ld : ne peut pas trouver Scrt1.o : Aucun fichier ou dossier de ce type
/usr/bin/ld : ne peut pas trouver crti.o : Aucun fichier ou dossier de ce type
collect2: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags:  

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: -c 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --c++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --ec++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags:  

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: -c 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --c++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --ec++ 

The output was:
No such file or directory


Determining if the C compiler works failed with the following output:
Change Dir: /home/***********/obs-v4l2sink/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_f18b2/fast"
/usr/bin/make -f CMakeFiles/cmTC_f18b2.dir/build.make CMakeFiles/cmTC_f18b2.dir/build
make[1] : on entre dans le répertoire « /home/***********/obs-v4l2sink/build/CMakeFiles/CMakeTmp »
Building C object CMakeFiles/cmTC_f18b2.dir/testCCompiler.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_f18b2.dir/testCCompiler.c.o   -c /home/***********/obs-v4l2sink/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_f18b2
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f18b2.dir/link.txt --verbose=1
/usr/bin/cc      CMakeFiles/cmTC_f18b2.dir/testCCompiler.c.o  -o cmTC_f18b2 
/usr/bin/ld : ne peut pas trouver Scrt1.o : Aucun fichier ou dossier de ce type
/usr/bin/ld : ne peut pas trouver crti.o : Aucun fichier ou dossier de ce type
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_f18b2.dir/build.make:97: recipe for target 'cmTC_f18b2' failed
make[1]: *** [cmTC_f18b2] Error 1
make[1] : on quitte le répertoire « /home/***********/obs-v4l2sink/build/CMakeFiles/CMakeTmp »
Makefile:126: recipe for target 'cmTC_f18b2/fast' failed
make: *** [cmTC_f18b2/fast] Error 2


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags:  

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: -c 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --c++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --ec++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags:  

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: -c 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --c++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --ec++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags:  

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: -c 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --c++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --ec++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags:  

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: -c 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --c++ 

The output was:
No such file or directory


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND 
Build flags: 
Id flags: --ec++ 

The output was:
No such file or directory


Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
c++: fatal error: no input files
compilation terminated.
Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
c++: fatal error: no input files
compilation terminated.

1 Ответ

1 голос
/ 25 апреля 2020

Превращение моего комментария в ответ:

Сообщение об ошибке является своеобразным. Похоже, CMake ранее обнаружил компилятор C ++ и ищет для него функции компилятора. Однако теперь он не может найти этот компилятор (пустое имя и версия компилятора):

CMake Error in CMakeLists.txt:
  No known features for CXX compiler

  ""

  version .

Это указывает на устаревшую конфигурацию CMake, и может быть полезно ее очистить. Попробуйте полностью удалить папку build и снова запустить шаги CMake из учебника (начиная с создания папки build, как показано ниже). Это поможет очистить старые / кэшированные настройки CMake:

mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install
...