Opening here after recommended from https://github.com/bincrafters/community/issues/871.
When using a package which uses os_build or arch_build, the user must specify those settings even if they aren't cross compiling, otherwise they get the error: 'settings.arch_build' value not defined.
To quote Eric Lemanissier:
As we are reading
settings.os_buildandsettings.arch_buildinside the recipe (in the build method), we have to declare them in https://github.com/bincrafters/conan-qt/blob/testing/5.13.0/conanfile.py#L55. It is the declaration which makes conan error, and recipes have no way to define fallback values at this level.
Also, note that if the user does provide the *_build settings, they get a warning that they should only specify the *_build settings if they are cross compiling.
This has been verified on conan 1.15.1 and 1.17.0.
Steps reproduced here from the linked issue.
[settings]
os=Linux
compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++11
build_type=Debug
arch=x86_64
compiler.cppstd=17
[options]
[env]
CC=/usr/bin/gcc-8
CXX=/usr/bin/g++-8
Using gcc-8 (v 8.3.0), but it shouldn't matter.
[requires]
qt/5.12.1@bincrafters/stable
Anything from qt/5.12.1 through qt/5.13.0 reproduce this.
conan install -pr the.profile conanfile.txt
Output:
Configuration:
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=8
os=Linux
[options]
[build_requires]
[env]
CC=/usr/bin/gcc-8
CXX=/usr/bin/g++-8
ERROR: qt/5.12.1@bincrafters/stable: 'settings.arch_build' value not defined
Setting arch_build=x86_64 yields settings.os_build value not defined`.
There are some possibilities here.
arch_build and os_build are set, and do something depending on this.settings.*_build could automatically resolve to settings.*.And there are probably other possible fixes.
Hi there,
normally the *_build settings are present in your settings.yml (docs). If one does not provide any specific setting at Conan invocation (like conan install ... -s os_build=...) then Conan uses the default settings from settings.yml.
Your proposal to fallback to the normal os and arch could be problematic too. Because if someone does not provide these settings (e.g. by accident) then the whole build process could build false packages and one could overlook this e.g. on a CI system.
I think the best way would be that Conan ensures that the *_build settings are added to the settings.yml (if missing) then the whole situation would be solved without special treatment by the recipes or any additional logic to circumvent the problem.
The warning has been discussed multiple times. The Conan developers are aware of that :) (e.g. here https://github.com/conan-io/conan/issues/4602).
I don't quite understand. I thought settings.yml lists legal values for the different settings. I don't see how a default value can be chosen from it. Yes, my settings.yml looks basically like that one in the docs. Or were you referring to a profile? I don't see why the user should have to specify their *_build settings in their profile when they are only building for themselves; os and arch should be enough information, and the packages should be able to know that there is no cross compilation going on.
Your proposal to fallback to the normal
osandarchcould be problematic too. Because if someone does not provide these settings (e.g. by accident) then the whole build process could build false packages and one could overlook this e.g. on a CI system.
I don't understand how this could happen. Why would this build false packages? If the *_build settings are not set, and you try to build a package that needs them, do you not get an error?
But I'm not familiar enough with the internals of Conan to know the right way to fix this.
Ouh, I am sorry. I meant the default profile from Conan (see here). From there the default values will be pulled.
You can let Conan regenerate it by just deleting it. With the next conan install ... it will be recreated.
With false packages I meant that one thinks he builds a package for arch x but e.g. through a misconfiguration does that for arch y. This will not be a severe problem but certainly annoying if building something that takes hours/days.
This will be solved with the new model of cross building where we will be deprecating these settings. There is an ongoing effort here: #5202 but it still requires working on it.
But yes, as @Johnnyxy said, these settings should be in the profile and are usually autogenerated.
@lasote I am trying to install qt and I'm getting the same message. I have read the error message a few times, read the discussions in this thread and I'm still lost as to how address this issue.
The most you can do right now is to declare os_build and arch_build values in your default profile at ~/.conan/profiles/default.
Most helpful comment
This will be solved with the new model of cross building where we will be deprecating these settings. There is an ongoing effort here: #5202 but it still requires working on it.
But yes, as @Johnnyxy said, these settings should be in the profile and are usually autogenerated.