conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
949 stars 1.73k forks source link

[package] glu/system and opengl/system don't work with mingw@Linux #25391

Open madebr opened 5 days ago

madebr commented 5 days ago

Description

When using a mingw toolchain on Linux, you don't want to install system libglvnd or libglu packages. The mingw toolchain provides everything you need.

Applying the patch at the bottom makes the package build and usable.

Package and Environment Details

Conan profile

Host profile:
[settings]
arch=x86
build_type=Release
compiler=gcc
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=win32
compiler.version=13
os=Windows
[buildenv]
*:AR=i686-w64-mingw32-ar
*:AS=i686-w64-mingw32-as
*:CC=i686-w64-mingw32-gcc
*:CXX=i686-w64-mingw32-g++
*:CPP=i686-w64-mingw32-cpp
*:LD=i686-w64-mingw32-ld
*:NM=i686-w64-mingw32-nm
*:OBJCOPY=i686-w64-mingw32-objcopy
*:OBJDUMP=i686-w64-mingw32-objdump
*:RANLIB=i686-w64-mingw32-ranlib
*:RC=i686-w64-mingw32-windres
*:STRIP=i686-w64-mingw32-strip

Steps to reproduce

conan install opengl/system -pr:h mingw32 -pr:b default

Logs

These patches

--- a/recipes/glu/all/conanfile.py
+++ b/recipes/glu/all/conanfile.py
@@ -29,6 +29,8 @@ class SysConfigGLUConan(ConanFile):
         self.info.clear()

     def system_requirements(self):
+        if self.settings.os == "Windows":
+            return
         dnf = package_manager.Dnf(self)
         dnf.install(["mesa-libGLU-devel"], update=True, check=True)

--- a/recipes/opengl/all/conanfile.py
+++ b/recipes/opengl/all/conanfile.py
@@ -23,6 +23,9 @@ class SysConfigOpenGLConan(ConanFile):
         self.info.clear()

     def system_requirements(self):
+        if self.settings.os == "Windows":
+            return
+
         dnf = package_manager.Dnf(self)
         dnf.install_substitutes(["libglvnd-devel"], ["mesa-libGL-devel"], update=True, check=True)
SpaceIm commented 5 days ago

It's likely not needed in other situations (cross-building from Linux to Android for example). I think it could early return if host os is not Linux, FreeBSD or SunOS.

By the way, call to PkgUtil is missing for SunOS in these system recipes.