Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to detect gcc when gcc is compiled with --with-gcc-major-version-only #1127

Closed
barcharcraz opened this issue Mar 22, 2017 · 4 comments
Milestone

Comments

@barcharcraz
Copy link
Contributor

Opensuse has been shipping gccs that output just the major number for gcc -dumpversion for many years. In gcc7 there is a switch --with-gcc-major-version-only that triggers this behavior (and suse's gcc7 packages use it). Because of the regex used on line 28 of detect.py conan fails to detect gcc in these cases.

@memsharded
Copy link
Member

Sorry didn't get the proper solution. How should gcc --version be invoked to get the minor too? The minor is also needed.

In any case, not a critical issue, if detect fails to detect the default gcc, it can be easily configured editing conan.conf

@memsharded
Copy link
Member

Hi @barcharcraz, we could include this for next release, but I have been googling for a solution, and still not clear. Would it work if we did gcc --version and parse the output, instead of gcc -dumpversion?

@SSE4
Copy link
Contributor

SSE4 commented Sep 6, 2017

@memsharded I use the following code in my scripts to detect GCC version

COMPILER_MAJOR=$(touch test.c && gcc -E -dM test.c  | grep -o '__GNUC__ [[:digit:]]' | cut -d' ' -f2)
COMPILER_MINOR=$(touch test.c && gcc -E -dM test.c  | grep -o '__GNUC_MINOR__ [[:digit:]]' | cut -d' ' -f2)

and for clang

COMPILER_MAJOR=$(touch test.c && clang -E -dM test.c  | grep -o '__clang_major__ [[:digit:]]' | cut -d' ' -f2)
COMPILER_MINOR=$(touch test.c && clang -E -dM test.c  | grep -o '__clang_minor__ [[:digit:]]' | cut -d' ' -f2)

basically idea is to use compiler version macro rather parsing --version output which may be hard to parse in reliable manner.
do you think if it makes sense to add something like that to conan detection?

@memsharded
Copy link
Member

Sorry for leaving this so long unresolved.
@SSE4 I think implementing that in conan codebase is too much, so far doesn't seem worth to deserve the effort.
@barcharcraz The regex has improved, now able to use only the major (and #2084 introduces support for major-only gcc setting for 5, 6, 7.

@memsharded memsharded added this to the 0.30 milestone Nov 27, 2017
@lasote lasote added the fixed label Dec 1, 2017
@pvicente pvicente added the fixed label Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants