Error: wrong compiler version (specified through profile)
See original GitHub issueHi guys,
This is just a quick question to see if there’s an easy to spot error on how I’m trying to build a package. If not, I’ll post a repo to reproduce the problem.
I was trying to compile with a different version of gcc than the default system-wide one. I mean, compile with gcc-5 instead of gcc-4.8:
/usr/bin/gcc -> gcc-4.8
/usr/bin/gcc-4.8
/usr/bin/gcc-5
I just read that I can do this with the profiles, with this one:
me@computer:~/.conan/profiles$ cat gcc5
[settings]
compiler=gcc
compiler.version=5.4
compiler.libcxx=libstdc++11
[env]
CC=/usr/bin/gcc-5
CXX=/usr/bin/g++-5
the install command (conan install -pr gcc5
) seems to fill conaninfo.txt properly, but cmake (cmake -G"Unix Makefiles"
) fails, it seems to me that the environment variables are not reaching cmake:
CMake Error at conanbuildinfo.cmake:184 (message):
Incorrect 'gcc' version 'compiler.version=5.4' is not the one detected by
CMake: 'GNU=4.8'
Call Stack (most recent call first):
conanbuildinfo.cmake:227 (conan_error_compiler_version)
conanbuildinfo.cmake:272 (check_compiler_version)
conanbuildinfo.cmake:43 (conan_check_compiler)
CMakeLists.txt:5 (conan_basic_setup)
-- Configuring incomplete, errors occurred!
Is there some obvious mistake here? if not, I’ll post the code in a repo with all the other details. I mean, I know this is a pretty basic usage of profiles, but I can’t see any difference between this and how the docs do it (mastering and reference).
The reason why I don’t want to change the system-wide default is that for some time I’ve been using update-alternatives and changing the conan settings (-s compiler…), but it became a bad idea when I wanted to use different versions in several projects…
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Yes, I’d say there is a misconception of the scope of the environment variables:
conan install
is running.conan install
, you have generated aconanbuildinfo.cmake
and your own project and CMakeLists.txt. Conan, or the generatedconanbuildinfo.cmake
will not change or define compiler. It never does it, the only thing it does is to check for consistency between the dependencies (installed with 5.4) and your current setup, which is using the system-default.cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/user/bin/g++-5...
Please tell me if this helps.
Yes, I think it is a typo, thanks for telling!
The trick with
conan test_package
is that it is using a consumer conanfile.py with abuild()
method, and it will take care of applying the settings and env vars from the profile. If you want, you can use that approach too, like: http://conanio.readthedocs.io/en/latest/mastering/conanfile_py.html#use-conanfile-py-for-consumers If you are calling ```cmake`` directly, then you have to take care yourself to provide the correct environment.About CMake, yes, it can be a pain, but the truth is that it is very mainstream and there are lots of responses to problems in SO. Premake is good, but its usage is much lower, so less community and when there are problems (even if they are less problems, there will be), it might be also difficult to find solutions.