question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: wrong compiler version (specified through profile)

See original GitHub issue

Hi 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
memshardedcommented, Mar 31, 2017

Yes, I’d say there is a misconception of the scope of the environment variables:

  • The env vars defined in the profile, they affect to the dependencies being installed. If they have to be built from sources, they will use gcc-5. But they are not permanent, they only affect while the command conan install is running.
  • when you finish conan install, you have generated a conanbuildinfo.cmake and your own project and CMakeLists.txt. Conan, or the generated conanbuildinfo.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.
  • So your normal invocation to cmake, in your project, and your local environment must be configured to use gcc-5, probably you want something like cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/user/bin/g++-5...

Please tell me if this helps.

1reaction
memshardedcommented, Apr 1, 2017

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 a build() 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMake Error: mismatch for the compiler version between your ...
You can update your default profile, go to your userhome ~/.conan/profiles/default and change compiler.version=11 for compiler.version=12 .
Read more >
Changelog — conan 1.46.2 documentation
Fix: Fixed failure with the alias packages when the name of the package (excluded the version) was different from the aliased package. Now...
Read more >
Clang Compiler User's Manual
In addition to language specific features, Clang has a variety of features ... exprs.c:47:15:{47:8-47:14}{47:17-47:24}: error: invalid operands to binary ...
Read more >
CUDA Compiler Driver NVCC - NVIDIA Documentation Center
Defined with the major version number of nvcc . ... Using an unsupported host compiler may cause compilation failure or incorrect run time...
Read more >
Fatal Error C1083 | Microsoft Learn
In this article · The specified file name is wrong · The file is not included in the include search path · Third-party...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found