Cmake error at cmakelists txt 2 project

Hello, I am trying to install coinfinder on Linux and having problem running the first step. After running cmake -DCMAKE_BUILD_TYPE=Release . I am getting the following error -- The CXX compiler id...

I am trying to install coinfinder on Linux and having problem running the first step. After running

cmake -DCMAKE_BUILD_TYPE=Release .

-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    /usr/bin/cc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    /usr/bin/c++

  is not a full path to an existing compiler tool.

  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!

I am not sure how to edit the CMakeLists.txt so it searches the right path.

When I am trying to launch flutter desktop application, this error occurred to me:

«CMake Error at CMakeLists.txt:2 (project):

Generator

Visual Studio 16 2019

could not find any instance of Visual Studio.

Building Windows application…

Exception: Unable to generate build files»

What I did…

1- Installed Visual Studio 2022 with (Desktop development with C++ and Universal Windows Platform development)

2- Run these commands:

flutter config —enable-windows-desktop

flutter create .

flutter run -d windows

Also I tried to use dev channel:

flutter channel dev

flutter upgrade

flutter config—enable-windows-uwp-desktop

And these what I have when I run flutter devices and flutter doctor

flutter devices

4 connected devices:
Windows (desktop) • windows • windows-x64 • Microsoft
Windows [Version 10.0.22000.318] Windows (UWP) (desktop) • winuwp •
windows-uwp-x64 • Chrome (web) • chrome • web-javascript
• Google Chrome 94.0.4606.81 Edge (web) • edge •
web-javascript • Microsoft Edge 95.0.1020.44

flutter doctor

[√] Flutter (Channel dev, 2.6.0-11.0.pre, on Microsoft Windows
[Version 10.0.22000.318], locale en-US)

[√] Android toolchain — develop for Android devices (Android SDK
version 31.0.0)

[√] Chrome — develop for the web

[√] Visual Studio — develop for Windows (Visual Studio Community 2022
17.0.0)

[√] Android Studio (version 2020.3)

[√] VS Code (version 1.61.1)

[√] Connected device (4 available)

• No issues found!

Когда я запускаю это: cmake -G "Visual Studio 15 2017 Win64"

У меня есть этот вывод:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/Users/ce/type/CMakeFiles/CMakeOutput.log".
See also "C:/Users/ce/type/CMakeFiles/CMakeError.log".

Это мои CMakeLists (я удалил ненужные вещи для примера)

cmake_minimum_required(VERSION 3.4)
project(type)

option(BUILD_CLIENT "Build Client" ON)
option(BUILD_SERVER "Build Server" ON)

set(CLIENT_NAME "type_client")
set(SERVER_NAME "type_server")

set(CLIENT_SRCDIR "client/src/")
set(SERVER_SRCDIR "server/src/")

set(INC_DIR_CLIENT "client/includes")
set(INC_DIR_SERVER "server/includes")
set(INC_DIR_DLLOADER "DLLoader/")
set(INC_DIR_ECS "ecs/")
set(INC_DIR_PROTOCOL "protocol/")

set(LIB_LINKS "-ldl -lpthread")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

set(CLIENT_SOURCE_FILES
${CLIENT_SRCDIR}main.cpp)

set(SERVER_SOURCE_FILES
${SERVER_SRCDIR}main.cpp)

set(SERVER_SOURCE_FILES_SYSTEMS)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
if(WIN32)
set(SFML_ROOT "dependancies/windows/SFML-2.4.1")
elseif(UNIX)
set(SFML_ROOT "dependancies/linux/SFML-2.4.1")
endif()
find_package(SFML 2 REQUIRED system window graphics network audio)

install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)

if(WIN32)
include_directories(${INC_DIR_DLLOADER}/win)
elseif(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
include_directories(${INC_DIR_DLLOADER}/linux)

set(SFML_ROOT "dependancies/SFML-2.4.1")
endif()

include_directories(${SFML_INCLUDE_DIR})

if(BUILD_CLIENT)
add_executable(${CLIENT_NAME} ${CLIENT_SOURCE_FILES})
target_link_libraries(${CLIENT_NAME} ${SFML_LIBRARIES} ${LIB_LINKS})
endif()

if(BUILD_SERVER)
if(WIN32)
add_executable(${SERVER_NAME} ${SERVER_SOURCE_FILES}
${SERVER_SOURCE_FILES_SYSTEMS} ${SERVER_SOURCE_FILES_WIN})
target_link_libraries(${SERVER_NAME} -lws2_32)

elseif(UNIX)
add_executable(${SERVER_NAME} ${SERVER_SOURCE_FILES}
${SERVER_SOURCE_FILES_SYSTEMS} ${SERVER_SOURCE_FILES_LINUX})
target_link_libraries(${SERVER_NAME} ${LIB_LINKS})
endif()
endif()

Я установил компилятор C ++ с Visual Studio, поэтому не понимаю, почему компилятор не обнаружен.

2

Решение

Попробуй скомпилировать с cmake -G "Visual Studio 14 2015"

1

Другие решения

Других решений пока нет …

Я пытаюсь установить набор исполняемых файлов на компьютер под управлением Windows 10, и после загрузки их источников мне нужно скомпилировать их с помощью cmake. Я загрузил последнюю версию cmake и (после установки соответствующего рабочего каталога) пытался запустить следующие команды в командной строке Windows, чтобы установить исполняемые файлы:

mkdir build
cd build
cmake ../
make

Однако команды cmake последовательно приводят к следующей ошибке и не могут создать какой-либо файл make, который может использовать команда make:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  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 "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeError.log".

Я попробовал множество решений для работы cmake, и никто из них не работал. Я попытался добавить bin моей папки cmake в свою переменную окружения PATH, я попытался переустановить мою копию cmake и попытался использовать графический интерфейс CMake для создания файла make (Запуск CMake в Windows) и даже загружая Visual Studio (как установить переменную CMake CXX в Windows), но поскольку у меня недостаточно опыта использования графического интерфейса CMake или Visual Studio, или потому, что что-то происходит неправильно, ничего не работает вообще, cmake../ дает ту же самую ошибку.

Может ли кто-нибудь предложить мне несколько альтернативных решений о том, как заставить эту команду работать?

Hi all,

My name is Felipe. I am new to this forum :)

I am installing software on a cluster with CentOS Linux release 7.7.1908.

My software installation fails with ‘unknown language compiler’. Specifically:

— The C compiler identification is unknown
— The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_C_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment variable «CC» or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

..and then the same for CXX
##########################################################

But, in any terminal command line, I can check this:

[Felipe@mu01]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure —prefix=/usr —mandir=/usr/share/man —infodir=/usr/share/info —with-bugurl=http://bugzilla.redhat.com/bugzilla —enable-bootstrap —enable-shared —enable-threads=posix —enable-checking=release —with-system-zlib —enable-__cxa_atexit —disable-libunwind-exceptions —enable-gnu-unique-object —enable-linker-build-id —with-linker-hash-style=gnu —enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto —enable-plugin —enable-initfini-array —disable-libgcj —with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install —with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install —enable-gnu-indirect-function —with-tune=generic —with-arch_32=x86-64 —build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
####################################################
and similarly for g++ -v

I also have cmake
[Felipe@mu01]$ cmake -version
cmake version 3.16.0-rc3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
######################################################
And I also have mpich, which seems to handle mpicc, mpicxx, mpif90, mpif77.
For example:
mpicc -v
mpicc for MPICH version 3.1.4
##########################################################

I tried editing my ~/.bash_profile , but it did not help. Maybe I did not do it right.

I am rather lost on this. :(

1) Do my gcc, cmake and mpich suffice for all these purposes?
2) Where and how should I set those environment variables to be properly accepted by my software installer? /.bashrc ? .bash_profile? /etc/profile?

I appreciate your help,
Felipe

  • Remove From My Forums
  • Question

  • Using Visual Studio 2019 Developer Command Prompt v16.3.5, cmake -G «Visual Studio 15 2017» -A x64  <path to source here> has the following error:

    CMake Error at CMakeLists.txt:3 (project): Generator
    Visual Studio 15 2017
      could not find any instance of Visual Studio.

    This is the same type of issue reported here: https://developercommunity.visualstudio.com/content/problem/433328/cmake-visual-studio-2017-generator-does-not-work.html

    Anyone have any ideas on how to fix this?

Answers

  • Hi Brigity,

    Welcome to the MSDN forum.

    According to your description, I have tried to reproduce your issue in my side.

    I tried to create two files (CMakeLists.txt file and XXX.cpp file) in the same folder and use Command Prompt(2019 and 2017), type cmake –g “Visual Studio 15 2017” –A x64 <path> and
    cmake –g “Visual Studio 16 2019” –A x64 <path> separately to
    check but both of them could work well.

    Not sure if the “-G” command maybe affect this build, because I first use
    cmake –G “Visual Studio 15 2017” –A x64 <path> like you said but it failed with error like : The C compiler identification is unknown… though not the same error like you but when I changed it to –g it works.

    Maybe you could also check if the path of your source files are correct.

    In addition, I also researched more, You could try to install these components:
    Visual C++ tools for CMake, C++/CLI support,
    VC++ 2015.3 v14.00 (v140) toolset for desktop. (to install them from Visual Studio installer -> find VS 2017 -> Modify -> Individual components)

    If this issue still persists feel free to contact us.

    BTW, since it is hard for us to reproduce your issue, if possible could you share us with a
    simple sample then upload via onedrive or github and I will go to download and check in my side.

    Hope all above could help you. 

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by

      Friday, October 18, 2019 8:29 AM

    • Marked as answer by
      Brigity
      Friday, October 18, 2019 6:07 PM

  • Your recommendations worked!

    a) Without installing any components, using lower case «-g» instead of «-G» did not work, I got the same result as with «-G»

    b) I had all the components installed that you recommended EXCEPT for:

    b.1) C++/CLI support for v142 build tools (14.20)

    b.2) C++/CLI support for v142 build tools (14.21)

    b.3) C++/CLI support for v142 build tools (14.23)

    b.4) VC++ 2015.3 v14.00 (v140) toolset for desktop (I have MSVC v140 — VS 2015 C++ build tools (v14.00) component installed. I could not install VC++ 2015.3 v14.00 (v140) component since it is not listed in the Visual Studio installer
    -> find VS 2010 -> Modify -> Individual components section (I am using VS2019 community and do not have vs2017)

    c) I installed the components in (b.1), (b.2), and (b.3), left everything else same and rebooted. Then inside vs2019 developer command prompt I typed as you recommended: cmake –g “Visual Studio 15 2017” –A x64 <path> and it worked! Also cmake –g “Visual
    Studio 16 2019” –A x64 <path> worked!

    Thank you for your excellent and timely advise!

    Sincerely, Brigity

    • Marked as answer by
      Brigity
      Friday, October 18, 2019 6:07 PM

I just installed cmake but I’m getting compiler not found error.

In trying to build https://gitlab.com/interception/linux/tools on a new Kubuntu installation, running cmake .. from the tools/build directory returns the error:

CMake Error at CMakeLists.txt:3 (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.

What’s wrong? I assumed cmake would be equipped with its compiler, but maybe it needs to be configured before it can be used???

asked Mar 25, 2020 at 21:09

alec's user avatar

alecalec

1,3083 gold badges12 silver badges26 bronze badges

0

The «compiler» is a separate package that needs to be installed. One called g++ can be installed on it’s own and is also included within a bundle of packages called «build-essential».

Thus sudo apt-get install build-essential solves the problem (and sudo apt-get install g++ should also work), allowing cmake .. to work with no configuration necessary.

answered Mar 25, 2020 at 21:11

alec's user avatar

alecalec

1,3083 gold badges12 silver badges26 bronze badges

2

I ran into the same issue with Alpine. After installing the following libraries, everything went through as expected:

apk add git cmake make clang build-base llvm-static llvm-dev clang-static clang-dev

answered Dec 28, 2022 at 13:40

wout's user avatar

woutwout

1113 bronze badges

For CenOS variant distros it was missing nasm. Installing it solves the issue:

yum install -y nasm 

alec's user avatar

alec

1,3083 gold badges12 silver badges26 bronze badges

answered May 27, 2022 at 9:20

Salem F's user avatar

First download eCAL archives(latest version) install. Go to terminal type:

sudo apt-get update
sudo apt-get install ecal
sudo apt-get install build-essential
sudo apt install cmake g++ libprotobuf-dev protobuf-compiler
sudo apt-get update

Fco Javier Balón's user avatar

answered Jan 16 at 11:09

Rohit Gupta's user avatar

1

Понравилась статья? Поделить с друзьями:
  • Clx 2160 ошибка датчика тонера
  • Clutch down ошибка скания
  • Cluster service on node did not reach the running state the error code is 0x5b4
  • Cluster physical disk resource encountered an error while attempting to terminate
  • Cluster error видеорегистратор