Closed Yuri6037 closed 4 years ago
Thanks for the report. What do you think of this change: https://github.com/bincrafters/conan-sdl2/commit/b59c43624ca03753e9c722f383a9b524df1fbc3f ? Can you try it ?
Sounds promessing, do you know how to reference it in my conan script?
unfortunately there's no direct way. you have to clone https://github.com/bincrafters/conan-sdl2/ and then call conan create /path/to/working/copy sdl2/2.0.12@bincrafters/testing -o sdl2:opengl=False -o sdl2:opengles=False
and reference sdl2/2.0.12@bincrafters/testing
from your package.
The package still requires xorg-dev however it should not need xorg-dev to run SDL2 maybe to build it but not to run it so xorg-dev should be not required when a pre-built version of the library is downloaded.
One could think of using self.build_requires("xorg/system")
instead of self.requires("xorg/system")
, but this would have the drawback of not installing/checking any xorg packages at all as soon as a pre-built binary of sdl2 is available. Conan misses some granularity here. You could report this problem on https://github.com/conan-io/conan/issues
I think build_requires is good as in all cases if no xorg is installed then SDL2 would fail when creating a window and the application should just quit with an error message
I just tried using build_requires instead of requires but it does not work instead it throws: AttributeError: 'SDL2Conan' object has no attribute 'build_requires'
build_requires
is probably available only in the build_requirements
method, as showcased in https://docs.conan.io/en/latest/devtools/build_requires.html#build-requires
I saw that I'm going to try setting up a special repo to build a lightweight SDL2 with only window/opengl core context creation I will strip everything else
I think build_requires is good as in all cases if no xorg is installed then SDL2 would fail when creating a window and the application should just quit with an error message
We have to choose between installing too much system packages (the current situation), or installing nothing and leave the user with a run-time/link-time error with no indication of what (s)he needs to do, so (s)he has to figure by himself/herself that system packages needs to be installed, and which packages are missing. The current situation seems the lesser evil
In my opinion the current situation is unacceptable you do not install dev packages in order to run SDL2 apps...
you don't need the dev packages in order to RUN your SDL2 app, even with the current situation. Conan just forces you to install them when BUILDING your SDL2 app.
Which is unacceptable I'm only running SDL2 in my built app I'm not building anything that uses low-level xorg if I would then I would explicitely require xorg/system. What is unacceptable is that sdl2 conan forces requirement all the time of a dependency that is only used for building the package!
as I said earlier, you need to report this on https://github.com/conan-io/conan/issues (and please explain there why it is unacceptable). There is nothing that can be done at the recipe level.
I did some tests locally and I think it is possible to move all requirements to build requirements. The only part that causes problems is system_requirements but you can do something at the package level: support an option like "hackskipdev" which is just going to skip all system_requirements so you can download the pre-built package without having to download all the dev dependencies. That is in the mean time conan decides that it's better to add build_system_requirements
you can already disable system packages by using this https://docs.conan.io/en/latest/reference/env_vars.html#conan-sysrequires-mode.
It's a pain to set environment variables on Windows straightforward things are always better so I keep my hacky way in the mean time conan accepts to do better
I'm a bit surprised by your last message, this environment variable is only relevant on Linux, which is the only OS for which conan is able to install system packages. As the issue you've raised cannot be fixed by this recipe, I'm closing it. Please report it on https://github.com/conan-io/conan-center-index/ or https://github.com/conan-io/conan/
It can be actually using two packages:
The prove is here it is possible and is apparently the solution used by some main conan-center recipes. See my work here:
See response by uilianries here: https://github.com/conan-io/conan/issues/7504
Package and Environment Details (include every applicable attribute)
Conan profile (output of
conan profile show default
orconan profile show <profile>
if custom profile is in use)Steps to reproduce (Include if Applicable)
I think this package should use xorg/system and opengl/system as build requirements: a system does not need any mesa-dev, xorg-dev or gl-dev packages in order to run SDL2 only to build it.