Repository: conan-io/conan-center-index

Issue:
[package] fast-dds/2.11.2: Incorrect detection of C++11 compiler support
### Description

building with fast-dds on Ubuntu1804 or Ubuntu 2004 results in incorrect detection of lacking C++11 support. Specifically these lines of the conanfile.py:
https://github.com/conan-io/conan-center-index/blob/master/recipes/fast-dds/all/conanfile.py#L91

```
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
            if minimum_version and Version(self.settings.compiler.version) < minimum_version:
```

Which will throw if your compiler is < gcc 10, but C++11 support in gcc was introduced as far back as gcc 4.3
https://en.cppreference.com/w/cpp/compiler_support/11

There is no reason why gcc10 should be the minimum supported version. gcc7 on ubuntu1804 should support fast-dds just fine.


### Package and Environment Details

* Package Name/Version: **fast-dds/2.11.2**
* Operating System+version: **Linux Ubuntu 18.04**
* Compiler+version: **GCC 7**
* Docker image: **ubuntu:18.04**
* Conan version: **conan 2.1.0**
* Python version: **Python 3.8.3**


### Conan profile

{% set compiler, version, compiler_exe = detect_api.detect_default_compiler() %}

[settings]
arch={{detect_api.detect_arch()}}
build_type={{ BUILD_TYPE if BUILD_TYPE else "Debug" }}
compiler={{compiler}}
compiler.cppstd=11
compiler.libcxx=libstdc++11
compiler.version={{detect_api.default_compiler_version(compiler, version)}}
compiler.threads=posix
os=Linux

[options]
*:shared=False
*:fPIC=True


### Steps to reproduce

docker run --rm -it ubuntu:18.04
apt update
apt install python3-pip build-essential cmake
pip3 install conan cmake 

conan profile detect
conan install --requires=fast-dds/2.11.2


### Logs

<details><summary>Click to expand log</summary>

```
root@4f08035457fd:/# conan profile detect
detect_api: Found gcc 7
detect_api: gcc>=5, using the major as version
detect_api: gcc C++ standard library: libstdc++11

Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux

WARN: This profile is a guess of your environment, please check it.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to /root/.conan2/profiles/default
root@4f08035457fd:/# conan install --requires=fast-dds/2.11.2

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux


======== Computing dependency graph ========
fast-dds/2.11.2: Not found in local cache, looking in remotes...
fast-dds/2.11.2: Checking remote: conancenter
fast-dds/2.11.2: Downloaded recipe revision 3433faa99242ae7573a2c7d7cfe86f09
tinyxml2/10.0.0: Not found in local cache, looking in remotes...
tinyxml2/10.0.0: Checking remote: conancenter
tinyxml2/10.0.0: Downloaded recipe revision 832c7f8038cef53f6427577d6e66a7a8
asio/1.29.0: Not found in local cache, looking in remotes...
asio/1.29.0: Checking remote: conancenter
asio/1.29.0: Downloaded recipe revision 52d17a857aa6f978d8c17d7c38eae5ad
fast-cdr/1.1.0: Not found in local cache, looking in remotes...
fast-cdr/1.1.0: Checking remote: conancenter
fast-cdr/1.1.0: Downloaded recipe revision 7a8cd8ddb1cf8242f0debd09c3644f5b
cmake/3.29.0: Not found in local cache, looking in remotes...
cmake/3.29.0: Checking remote: conancenter
cmake/3.29.0: Downloaded recipe revision a055de871f63a7904aa3dcb9f3c61242
foonathan-memory/0.7.3: Not found in local cache, looking in remotes...
foonathan-memory/0.7.3: Checking remote: conancenter
foonathan-memory/0.7.3: Downloaded recipe revision e15d6872869ad2a42dc4e8b95e624772
Graph root
    cli
Requirements
    asio/1.29.0#52d17a857aa6f978d8c17d7c38eae5ad - Downloaded (conancenter)
    fast-cdr/1.1.0#7a8cd8ddb1cf8242f0debd09c3644f5b - Downloaded (conancenter)
    fast-dds/2.11.2#3433faa99242ae7573a2c7d7cfe86f09 - Downloaded (conancenter)
    foonathan-memory/0.7.3#e15d6872869ad2a42dc4e8b95e624772 - Downloaded (conancenter)
    tinyxml2/10.0.0#832c7f8038cef53f6427577d6e66a7a8 - Downloaded (conancenter)
Build requirements
    cmake/3.29.0#a055de871f63a7904aa3dcb9f3c61242 - Downloaded (conancenter)
Resolved version ranges
    cmake/[>=3.16.3 <4]: cmake/3.29.0

======== Computing necessary packages ========
foonathan-memory/0.7.3: Checking 7 compatible configurations
foonathan-memory/0.7.3: Compatible configurations not found in cache, checking servers
foonathan-memory/0.7.3: '463fc09f05013a0f300d697d9762ddb13a1ff22d': compiler.cppstd=98
foonathan-memory/0.7.3: '12356dd58a632cc2352b8d5f07d4877f220306e5': compiler.cppstd=gnu98
foonathan-memory/0.7.3: 'be9e79090a1659a279d24c2a7c3d37a0cfe67621': compiler.cppstd=11
foonathan-memory/0.7.3: 'dcd6db0234259410fef1ab5e0dbd1492a6586075': compiler.cppstd=gnu11
foonathan-memory/0.7.3: '4bb3fd9bb87c84285a30ee9932310e1db901c74e': compiler.cppstd=14
foonathan-memory/0.7.3: 'c68355ad505ff83a0c01a82d9da4de0d97822fbd': compiler.cppstd=17
foonathan-memory/0.7.3: '44917478fc2e01100db3d7dcb9a56216072798d9': compiler.cppstd=gnu17
tinyxml2/10.0.0: Checking 7 compatible configurations
tinyxml2/10.0.0: Compatible configurations not found in cache, checking servers
tinyxml2/10.0.0: '9c8468a1f6b3ca17c29826f382cbda1bb2d56636': compiler.cppstd=98
tinyxml2/10.0.0: '2e43b1417f7366a284cf768680b997b5f3aad075': compiler.cppstd=gnu98
tinyxml2/10.0.0: 'd370277306d5a7c105cb574c78f1b971cad8a329': compiler.cppstd=11
tinyxml2/10.0.0: 'a9392aeeeda620c0dfb6083e1f5d713722bf5647': compiler.cppstd=gnu11
tinyxml2/10.0.0: '9458ad70969cf459fcf90b8a964f9fcacff6af97': compiler.cppstd=14
tinyxml2/10.0.0: '9488cac798c0df6dd82b05d891fabe561c924c17': compiler.cppstd=17
tinyxml2/10.0.0: '7e08589f777651366a3def6bbe51fa09e7e13996': compiler.cppstd=gnu17
fast-cdr/1.1.0: Checking 5 compatible configurations
fast-cdr/1.1.0: Compatible configurations not found in cache, checking servers
fast-cdr/1.1.0: 'd370277306d5a7c105cb574c78f1b971cad8a329': compiler.cppstd=11
fast-cdr/1.1.0: 'a9392aeeeda620c0dfb6083e1f5d713722bf5647': compiler.cppstd=gnu11
fast-cdr/1.1.0: '9458ad70969cf459fcf90b8a964f9fcacff6af97': compiler.cppstd=14
fast-cdr/1.1.0: '9488cac798c0df6dd82b05d891fabe561c924c17': compiler.cppstd=17
fast-cdr/1.1.0: '7e08589f777651366a3def6bbe51fa09e7e13996': compiler.cppstd=gnu17
Requirements
    fast-cdr/1.1.0#7a8cd8ddb1cf8242f0debd09c3644f5b:c4735bf28b871912194110fef2bd705f763687fc - Missing
    fast-dds/2.11.2#3433faa99242ae7573a2c7d7cfe86f09:e94df76a0eaa58f60f3f04774bd2f747f414afb9 - Invalid
    foonathan-memory/0.7.3#e15d6872869ad2a42dc4e8b95e624772:27223d5c06b56d723c34e43dbc17ecd3279040ea - Missing
    tinyxml2/10.0.0#832c7f8038cef53f6427577d6e66a7a8:c4735bf28b871912194110fef2bd705f763687fc - Missing
Build requirements
Skipped binaries
    asio/1.29.0, cmake/3.29.0
ERROR: There are invalid packages:
fast-dds/2.11.2: Invalid: fast-dds/2.11.2 requires C++11, which your compiler does not support.
root@4f08035457fd:/#
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/fast-dds/all/conanfile.py b/recipes/fast-dds/all/conanfile.py
--- a/recipes/fast-dds/all/conanfile.py
+++ b/recipes/fast-dds/all/conanfile.py
@@ -50,7 +50,7 @@ def _min_cppstd(self):
     @property
     def _compilers_minimum_version(self):
         return {
-            "gcc": "10",
+            "gcc": "6",
             "clang": "3.9",
             "apple-clang": "8",
         }
@@ -83,6 +83,7 @@ def requirements(self):
             self.requires("openssl/[>=1.1 <4]")
 
     def validate(self):
+        # fast-dds requires C++11
         if self.settings.compiler.cppstd:
             check_min_cppstd(self, self._min_cppstd)
         check_min_vs(self, "192")
@@ -92,10 +93,11 @@ def validate(self):
                 raise ConanInvalidConfiguration(
                     f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
                 )
+                
         if self.options.shared and is_msvc(self) and "MT" in msvc_runtime_flag(self):
             # This combination leads to an fast-dds error when linking
             # linking dynamic '*.dll' and static MT runtime
-            raise ConanInvalidConfiguration("Mixing a dll {} library with a static runtime is a bad idea".format(self.name))
+            raise ConanInvalidConfiguration("Mixing a dll {} library with a static runtime is not supported".format(self.name))
 
     def build_requirements(self):
         if Version(self.version) >= "2.7.0":


Test patch: