Repository: conan-io/conan

Issue:
Support for gcc 6.1 and clang 3.8
I've tried building the sample project in the Getting started section, but at first I ran into connan not finding any compiler on my system (arch linux with both gcc 6.1 and clang 3.8 installed)

```
$ conan

It seems to be the first time you run conan
Auto detecting your dev setup to initialize conan.conf
ERROR: Unable to find a working compiler
Default conan.conf settings
        os=Linux
        arch=x86_64
        build_type=Release
*** You can change them in ~/.conan/conan.conf ***
*** Or override with -s compiler='other' -s ...s***
```

I tried fixing this by specifying the settings manually as the error message suggests, but it wouldn't let me use a newer version of both GCC and Clang than the ones conan knows about.

```
$ conan install .. -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=6.1 --build                                                              ERROR: '6.1' is not a valid 'settings.compiler.version' value.
Possible values are ['4.4', '4.5', '4.6', '4.7', '4.8', '4.9', '5.1', '5.2', '5.3']
```

and

```
$ conan install .. -s compiler=clang -s compiler.libcxx=libc++ -s compiler.version=3.8 --build                                                                 ERROR: '3.8' is not a valid 'settings.compiler.version' value.
Possible values are ['3.3', '3.4', '3.5', '3.6', '3.7']
```

Is there a way to work around this? It seems reasonable to use any compiler/version I want, no?



Discussion:
Yes, there is a way to do it. The default settings are defined in **~/.conan/settings.yml**. They are defined this way, so they are common ground for most use cases, but this file can be user defined. Just add your settings to this file. Custom settings are also allowed, a few notes:
- Settings are something that are project-wide, as the architecture or the compiler. All packages/dependencies should have the same settings to build, otherwise binary (ABI) incompatibility, linking errors or runtime errors (e.g. sometimes using debug artifacts in release mode) can occur.
- For package-specific things, you can use **options**, check the documentation how to define and use them
- You can define in your **~/.conan/conan.conf** the default settings you want to use in your projects, so you dont have to fully specify them at `conan install` with `-s` parameters. They can be overriden for a specific invocation using the parameters.
- When modifying _settings.yml_, if you want to share your packages with  other developers, they have to modify their own _settings.yml_ too.

In any case, it is true that our default settings have not been updated to use the latest gcc and clang versions, I will add them. Thanks very much for pointing this out!


Resolving patch:
diff --git a/conans/__init__.py b/conans/__init__.py
--- a/conans/__init__.py
+++ b/conans/__init__.py
@@ -9,4 +9,4 @@
 from conans.util.files import load
 import os
 
-__version__ = '0.9.2'
+__version__ = '0.10.dev'
diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py
--- a/conans/client/conf/__init__.py
+++ b/conans/client/conf/__init__.py
@@ -14,13 +14,13 @@
 arch: [x86, x86_64, armv6, armv7, armv7hf, armv8]
 compiler:
     gcc:
-        version: ["4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5.1", "5.2", "5.3"]
+        version: ["4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5.1", "5.2", "5.3", "6.1"]
         libcxx: [libstdc++, libstdc++11]
     Visual Studio:
         runtime: [MD, MT, MTd, MDd]
         version: ["8", "9", "10", "11", "12", "14"]
     clang:
-        version: ["3.3", "3.4", "3.5", "3.6", "3.7"]
+        version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8"]
         libcxx: [libstdc++, libstdc++11, libc++]
     apple-clang:
         version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3"]
diff --git a/conans/client/migrations.py b/conans/client/migrations.py
--- a/conans/client/migrations.py
+++ b/conans/client/migrations.py
@@ -3,8 +3,6 @@
 from conans.model.version import Version
 import os
 from conans.client.conf import default_settings_yml
-from conans.server.store.disk_adapter import DiskAdapter
-from conans.server.store.file_manager import FileManager
 
 
 class ClientMigrator(Migrator):
@@ -15,6 +13,19 @@ def __init__(self, paths, current_version, out, manager):
         super(ClientMigrator, self).__init__(paths.conan_folder, paths.store,
                                              current_version, out)
 
+    def _update_settings_yml(self, old_settings):
+        self.out.warn("Migration: Updating settings.yml")
+
+        current_settings = load(self.paths.settings_path)
+        if current_settings != old_settings:
+            backup_path = self.paths.settings_path + ".backup"
+            save(backup_path, current_settings)
+            self.out.warn("*" * 40)
+            self.out.warn("A new settings.yml has been defined")
+            self.out.warn("Your old settings.yml has been backup'd to: %s" % backup_path)
+            self.out.warn("*" * 40)
+        save(self.paths.settings_path, default_settings_yml)
+
     def _make_migrations(self, old_version):
         # ############### FILL THIS METHOD WITH THE REQUIRED ACTIONS ##############
         # VERSION 0.1
@@ -34,7 +45,6 @@ def _make_migrations(self, old_version):
                                     'version: ["4.6", "4.7", "4.8", "4.9", "5.1", "5.2", "5.3"]')
             save(self.paths.settings_path, default_settings)
         elif old_version < Version("0.7"):
-            self.out.warn("Migration: Updating settings.yml")
             old_settings = """
 os: [Windows, Linux, Macos, Android]
 arch: [x86, x86_64, armv]
@@ -51,15 +61,7 @@ def _make_migrations(self, old_version):
 
 build_type: [None, Debug, Release]
 """
-            current_settings = load(self.paths.settings_path)
-            if current_settings != old_settings:
-                backup_path = self.paths.settings_path + ".backup"
-                save(backup_path, current_settings)
-                self.out.warn("*" * 40)
-                self.out.warn("A new settings.yml has been defined")
-                self.out.warn("Your old settings.yml has been backup'd to: %s" % backup_path)
-                self.out.warn("*" * 40)
-            save(self.paths.settings_path, default_settings_yml)
+            self._update_settings_yml(old_settings)
         elif old_version < Version("0.8"):
             self.out.info("**** Migrating to conan 0.8 *****")
             settings_backup_path = self.paths.settings_path + ".backup"
@@ -115,4 +117,24 @@ def _make_migrations(self, old_version):
                                     'version: ["5.0", "5.1", "6.0", "6.1", "7.0"]',
                                     'version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3"]')
             save(self.paths.settings_path, default_settings)
+        elif old_version < Version("0.10"):
+            old_settings = """
+os: [Windows, Linux, Macos, Android, iOS]
+arch: [x86, x86_64, armv6, armv7, armv7hf, armv8]
+compiler:
+    gcc:
+        version: ["4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5.1", "5.2", "5.3", "6.1"]
+        libcxx: [libstdc++, libstdc++11]
+    Visual Studio:
+        runtime: [MD, MT, MTd, MDd]
+        version: ["8", "9", "10", "11", "12", "14"]
+    clang:
+        version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8"]
+        libcxx: [libstdc++, libstdc++11, libc++]
+    apple-clang:
+        version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3"]
+        libcxx: [libstdc++, libc++]
 
+build_type: [None, Debug, Release]
+"""
+            self._update_settings_yml(old_settings)


Test patch: