Repository: conan-io/conan-center-index

Issue:
[package] <llvm-openmp>/<17.0.4>: does not support complier:apple-clang on OS: iOS.
### Description

I want to use openmp on iOS, so I use Conan to install llvm-openmp, but occur a error.

### Package and Environment Details

* Package Name/Version: **llvm-openmp/17.0.4**
* Operating System+version: **macOS**
* Compiler+version: **apple-clang**
* Docker image: ****
* Conan version: **conan 2.0**
* Python version: **Python**


### Conan profile

Profile host:
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.1
os=iOS
os.sdk=iphoneos
os.version=13.1

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=15
os=Macos



### Steps to reproduce

conan install . --output-folder=../build --build=missing --profile:host=ios_profile --profile:build=default

### Logs

<details><summary>Click to expand log</summary>

```
Put your log output here
```

</details>
======== Input profiles ========
Profile host:
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.1
os=iOS
os.sdk=iphoneos
os.version=13.1

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=15
os=Macos


======== Computing dependency graph ========
llvm-openmp/17.0.4: Not found in local cache, looking in remotes...
llvm-openmp/17.0.4: Checking remote: conancenter
llvm-openmp/17.0.4: Downloaded recipe revision 218e6e0600c0c1edd51a9b5aa63f0cc2
Graph root
    conanfile.txt: /Users/janson/Documents/workspace2024/modelDemoIOS/src/conanfile.txt
Requirements
    boost/1.83.0#7825569cd0622461dec7bc87dfdf47ae - Cache
    bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c - Cache
    flann/1.9.2#9a94fb20c9db33ab6102182ee62f671c - Cache
    fmt/10.1.0#51d8d1db43672712db81b146a85ca73d - Cache
    laszip/3.4.3#8c1587d195e07cd77291cb3d6bee842c - Cache
    libbacktrace/cci.20210118#ec1aa63bbc10145c6a299e68e711670c - Cache
    libpcap/1.10.4#445e56446ac3cbd5705cacaaa379e3ee - Cache
    libpng/1.6.40#0337b7b87ac125307ed70fd064c31eea - Cache
    libusb/1.0.26#c0c00750b383839aa140a0be628d552c - Cache
    llvm-openmp/17.0.4#218e6e0600c0c1edd51a9b5aa63f0cc2 - Downloaded (conancenter)
    lz4/1.9.4#1217a03c990b79aa34ed0faede18f534 - Cache
    pcl/1.13.1#f3d0c7c6c4e0b0d731acd45f21f9c4af - Cache
    qhull/8.0.1#3aaac5ed74195de160ced00fd7ce8f6c - Cache
    sophus/1.22.10#17408e6514c607b88b48ba7cbddab4f6 - Cache
    zlib/1.3#06023034579559bb64357db3a53f88a4 - Cache
Build requirements
    b2/4.10.1#8dc3df1cc73ad65d86cbdfd31fdb011f - Cache
    bison/3.8.2#ed1ba0c42d2ab7ab64fc3a62e9ecc673 - Cache
    cmake/3.27.9#e255e9c6cc3ac4856c44ad84476ec434 - Cache
    flex/2.6.4#e35bc44b3fcbcd661e0af0dc5b5b1ad4 - Cache
    m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache
Resolved version ranges
    cmake/[>=3.20 <4]: cmake/3.27.9
    zlib/[>=1.2.11 <2]: zlib/1.3

======== Computing necessary packages ========
Requirements
    boost/1.83.0#7825569cd0622461dec7bc87dfdf47ae:070f91e1f7108e313541422926c61cac019122ce#452207278da0ee823252741d74aa54f6 - Cache
    bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d:d6cbe242d441a6a4aba0facf219ea85da3ad4c8b#42e64c6e183ecfd299f27c763a86fd6d - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c:da39a3ee5e6b4b0d3255bfef95601890afd80709#b2e7c2d86c5d1dbefc534889aa72e12c - Cache
    flann/1.9.2#9a94fb20c9db33ab6102182ee62f671c:cf3098e61e590dc0169f118f7ce3f9d707fb3d46#8653c1aa78f5c37319f18f280bc73102 - Cache
    fmt/10.1.0#51d8d1db43672712db81b146a85ca73d:62b31309c3ff1b321d13f3bc7413339e64a9cc3b#7b0b5cd152fb880ad689992c0006eb91 - Cache
    laszip/3.4.3#8c1587d195e07cd77291cb3d6bee842c:0f38b10ab8091eca546c5d10c79a18f1ab7e1839#c9a32fdad6525b45b8e4148e06c997ca - Cache
    libbacktrace/cci.20210118#ec1aa63bbc10145c6a299e68e711670c:b9cd06189c1fcf4bba4b8dbc9659ab5ab5d3d133#351cf17bad05d4d680b629655c4fde18 - Cache
    libpcap/1.10.4#445e56446ac3cbd5705cacaaa379e3ee:b9cd06189c1fcf4bba4b8dbc9659ab5ab5d3d133#a1397d5ba3cfd86770b194cbf6e0bbc2 - Cache
    libpng/1.6.40#0337b7b87ac125307ed70fd064c31eea:932f690aa50c106af3e2c43d917d8b4e805464ac#4110afa7c9c5f0d0aa86964b087ecacb - Cache
    libusb/1.0.26#c0c00750b383839aa140a0be628d552c:b9cd06189c1fcf4bba4b8dbc9659ab5ab5d3d133#db12fdb6e0f720bc6c0c6489430f0cbc - Cache
    llvm-openmp/17.0.4#218e6e0600c0c1edd51a9b5aa63f0cc2:0298b814e14beca9b0e3bdcc5df2a5f64083e80f - Invalid
    lz4/1.9.4#1217a03c990b79aa34ed0faede18f534:b9cd06189c1fcf4bba4b8dbc9659ab5ab5d3d133#c4a739bc95f473a4abb15515be03ec48 - Cache
    pcl/1.13.1#f3d0c7c6c4e0b0d731acd45f21f9c4af:74a15d1e062e17f66936c6068809aeb5baee6fc2#5b707ae968e762a5de1c05a058f5f672 - Cache
    qhull/8.0.1#3aaac5ed74195de160ced00fd7ce8f6c:b9cd06189c1fcf4bba4b8dbc9659ab5ab5d3d133#9f8edf6be8c88ec95c0b5dafc9fa60b8 - Cache
    sophus/1.22.10#17408e6514c607b88b48ba7cbddab4f6:da39a3ee5e6b4b0d3255bfef95601890afd80709#87e727d2f343c4cb8e862b8c8141d355 - Cache
    zlib/1.3#06023034579559bb64357db3a53f88a4:b9cd06189c1fcf4bba4b8dbc9659ab5ab5d3d133#6d408c8939f3c5a7bfe0ee1e9caa31e5 - Cache
Build requirements
Skipped binaries
    b2/4.10.1, bison/3.8.2, cmake/3.27.9, flex/2.6.4, m4/1.4.19

======== Installing packages ========
ERROR: There are invalid packages:
llvm-openmp/17.0.4: Invalid: llvm-openmp doesn't support compiler: apple-clang on OS: iOS.


Discussion:

Resolving patch:
diff --git a/recipes/llvm-openmp/all/conanfile.py b/recipes/llvm-openmp/all/conanfile.py
--- a/recipes/llvm-openmp/all/conanfile.py
+++ b/recipes/llvm-openmp/all/conanfile.py
@@ -8,6 +8,7 @@
 from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
 from conan.tools.env import VirtualBuildEnv
 from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, save, move_folder_contents, rmdir
+from conan.tools.microsoft import is_msvc
 from conan.tools.scm import Version
 
 required_conan_version = ">=1.53.0"
@@ -45,15 +46,6 @@ class LLVMOpenMpConan(ConanFile):
         )
     }
 
-    def _supports_compiler(self):
-        supported_compilers_by_os = {
-            "Linux": ["clang", "gcc", "intel-cc"],
-            "Macos": ["apple-clang", "clang", "gcc", "intel-cc"],
-            "Windows": ["intel-cc"],
-        }
-        the_compiler, the_os = self.settings.compiler.value, self.settings.os.value
-        return the_compiler in supported_compilers_by_os.get(the_os, [])
-
     @property
     def _compilers_minimum_version(self):
         return {
@@ -85,9 +77,12 @@ def layout(self):
         cmake_layout(self, src_folder="src")
 
     def validate(self):
-        if not self._supports_compiler():
-            raise ConanInvalidConfiguration("llvm-openmp doesn't support compiler: "
-                                            f"{self.settings.compiler} on OS: {self.settings.os}.")
+        if is_msvc(self):
+            raise ConanInvalidConfiguration("llvm-openmp is not compatible with MSVC")
+        if self.settings.compiler not in ["apple-clang", "clang", "gcc", "intel-cc"]:
+            raise ConanInvalidConfiguration(
+                f"{self.settings.compiler} is not supported by this recipe. Contributions are welcome!"
+            )
         if self._version_major >= 17:
             if self.settings.compiler.cppstd:
                 check_min_cppstd(self, 17)


Test patch: