Conan executable not found!
jeffkershner opened this issue · comments
I am on pop_os 20.0.4 and using the latest CLion.
When I load the CMakeLists.txt, I get:
/app/extra/clion/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/jeff/projects/personal/cpp_starter_project
-- ccache found and enabled
-- Conan: checking conan executable
CMake Error at cmake-build-debug/conan.cmake:531 (message):
Conan executable not found!
Conan is installed with pip3 globally and a which conan
on the command line gives me this:
/usr/local/bin/conan
I don't have python (python2 installed). Everything everything is python3
and pip3
. Might that be the problem?
I don't think that python3
is an issue; Conan shouldn't need python2 to run. That error message occurs when CMake fails to locate conan
in several locations, including your PATH
. See CMake docs for find_program() to see everywhere CMake will look. From what you've written, it sounds like conan
is available in the PATH
environment variable that's available to you in a terminal, but not in CLion.
Can you build the project successfully from a terminal? If you can, then all you need to do is get /usr/local/bin
into the PATH
environment variable that CLion makes available to CMake. One way to do that from CLion is via Settings > Build, Execution, Deployment > CMake > Environment
.
Keep in mind that anything added to your PATH
from .bash_profile
, .profile
, or .bash_login
will only be in your PATH
while you're in an interactive terminal, and will not be available to processes spawned by CLion. Anything you add to your .bashrc
should be available to processes spawned by CLion. If you are using some shell other than bash
in your terminal, the filenames will be different than these.
If I go into the cmake directory and run cmake ../src
, that seems to work. Then I run make
and I get speedlog errors:
[ 50%] Building CXX object CMakeFiles/intro.dir/main.o
/home/jeff/projects/personal/cpp_starter_project/src/main.cpp:4:10: fatal error: spdlog/spdlog.h: No such file or directory
4 | #include <spdlog/spdlog.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/intro.dir/build.make:63: CMakeFiles/intro.dir/main.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/intro.dir/all] Error 2
make: *** [Makefile:84: all] Error
Looks like running in the terminal, it got passed the conan error.
So that seems to work by adding the path to the CMake PATH variable, but now I get this error:
/app/extra/clion/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/jeff/projects/personal/cpp_starter_project
-- ccache found and enabled
-- Conan: checking conan executable
-- Conan: Found program /home/jeff/.local/bin/conan
-- Conan: Version found Traceback (most recent call last):
File "/home/jeff/.local/bin/conan", line 5, in <module>
from conans.conan import run
ModuleNotFoundError: No module named 'conans'
The first time you run CMake from the terminal, CMake should call Conan and build four packages: catch2, docopt, fmt, and spdlog. If everything everything built properly, the next time you run CMake, it should just locate those four packages in cache and tell you that they're already installed. On my machine, I get output from CMake that looks like this:
conanfile.txt: Installing package
Requirements
catch2/2.11.0 from 'conan-center' - Cache
docopt.cpp/0.6.2 from 'conan-center' - Cache
fmt/6.1.2 from 'conan-center' - Cache
spdlog/1.5.0 from 'conan-center' - Cache
Packages
catch2/2.11.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
docopt.cpp/0.6.2:1a651c5b4129ad794b88522bece2281a7453aee4 - Cache
fmt/6.1.2:1a651c5b4129ad794b88522bece2281a7453aee4 - Cache
spdlog/1.5.0:86d1b143080f2a53f0e90d752cc3bbb08508cc7d - Cache
Installing (downloading, building) binaries...
catch2/2.11.0: Already installed!
docopt.cpp/0.6.2: Already installed!
fmt/6.1.2: Already installed!
spdlog/1.5.0: Already installed!
When you run CMake from the terminal now, do you get output that looks something like this? If not, could you show us any errors or warnings you might be getting from CMake?
I am just going to close this issue. Nothing wrong with this repo and definitely nothing wrong with @ddalcino amazing support. I am just not smart enough for this. :)
I was able to build with cmake from the command line. My issue is with cLion. Thanks for the help!