-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Configurable and distributable toolchains #8274
Comments
Hi @DoDoENT I am reviewing this issue, as we are preparing a package types proposal, and I am struggling to understand some of the use cases and put some reasonable scope to the above comments. It seems there are too many different features in the above, and many of them are a challenge on their own:
Something that can impose settings on a dependency graph is a profile, I am not fully sure what you mean here.
What does it mean to define so many build-requires at the same time? It is not possible to use them, at the same time, so this would be only for installing, but how to specify that some specific build tools should be applied to a given
Anything that is not replacing the whole settings.yml is challenging, as merging/updating yaml is not an easy problem. Adding some values seems doable, but updating things is a different story, specially if removal of things is desired. Seems a relatively minor UX improvement compared to the challenges, instead of updating, replacing the
This is an idea that we like and have considered before, having
Yes, the new In summary: I can understand the value of a potential |
Hi @memsharded. Let me try to explain further my idea:
This is exactly why I call this a "profile-package" - think of it as a configurable and executable profile. Just like what For example, consider what currently needs to be done in order to introduce a new toolchain (i.e. a new version of Android NDK) to a company's ecosystem:
So, as you can see, I need to keep two different things in sync - the profile and settings.yml on the one side and the Conan package containing the NDK on the other. Not to mention that the package is distributed via Artifactory and the configuration zip via a different method (in our case it's via Jenkins' The above proposal would allow me to create a single Conan package that will be both the profile and the toolchain package. Imagine something like following method within the recipe of such package: def update_settings(self):
cc_path = os.path.join(self.package_folder, 'toolchains', 'llvm', 'prebuilt', self._host_os + '-' + self._host_arch, 'bin', 'clang')
clang_version = self.run([cc_path, '--version'])
self.info.settings.compiler = 'clang'
self.info.settings.compiler.version = clang_version
self.info.settings.compiler.libcxx = 'libc++'
self.info.settings.os = 'Android'
self.info.settings.os.api_level = self.options.android_api_level # assumes package has android_api_level option
Here I meant primarily that such packages would be allowed to depend on another package. For example, consider the Android NDK package from the previous example. Imagine that our NDK package does not download prebuilt binaries from Google's server, but instead clones the NDK source code from git and compiles it. In order to compile it, it may require some dependencies, such as
I'm aware of that, but I think it should be enough just to be able to add new values if they don't already exist. Modifying and deleting could be problematic and currently, I don't see use cases for this.
Please let me know if the above NDK example still doesn't make this clearer to you.
Well, that's a problem. This is exactly what I would like to achieve in order to be able to tell conan to rebuild packages when the compiler changes. For example, apple-clang 12.0.0 (Xcode 12.0-12.4) and apple-clang 12.0.5 (Xcode 12.5 and newer) are link-compatible (i.e. binaries have the same ABI), only if built without sanitisers and without LTO. If you enable LTO on a specific package, it needs to be rebuilt. A similar problem is also with MSVC, which caused deprecation of the 'Visual Studio' compiler in favour of MSVC. However, although it's possible to together link binaries built with LTO and binaries built without LTO (thus advocating for letting the package script have control over the final build flags), it's not possible to link together binaries build with address sanitiser and binaries built without the address sanitiser. The problem is that the container overflow detector within the address sanitiser changes the ABI of the STL by adding some runtime checks into the common STL containers. So, when you link together two binaries where one was built with Address Sanitizer and the other without, you end up with an ODR violation in your program. I'm aware that conan cannot strictly enforce the correct compile flags on all packages as, e.g. dds does, but it should be able to affect common build system integrations like CMake, Xcode, MSBuild and Autotools. You said that the Currently, it's possible to introduce LTO and Sanitiser settings into the I hope I made some things clearer. Please let me know if there are still things you struggle to understand. |
But this is a chicken and egg problem, this is why the configuration as profiles need to be separately from the actual package. Lets focus on the consumer user story: You want to build a Conan package for Android, lets call it android_profile1
We can execute this to create my package for this configuration conan create . mylib/1.0@ -pr=android_profile1 Now, there is a new AndroidNDK, with a new compiler version 8.1, etc. Lets say that our devops team does the following steps for us:
Now user story to use the new version is: conan config install # No need to pass the URL, it is cached, and will update from there
conan create . mylib/1.0@ -pr=android_profile2 Note that when the package |
The user story should stay the same, but my proposal advocates for a simpler "DevOps" story, as the DevOps team will not require creating two different things ( Currently, the only possible way is to create a temporary package or side-install the NDK, check the version of the compiler and hardcode that into the profile file. With the proposed approach, the compiler version would be defined automatically, directly from the actual version that the compiler binary reports.
It's not - the installation of the AndroidNDK should be done in Also, for cases when you need profile configurability, like Android API level in this case, but also LTO, sanitiser, etc., that influences the ABI and require the recompilation of the entire graph, it's much easier to have options on profile-package than having a separate profile for each and every combination. What does like more convenient for you?
Or this?
Here I use The number of combinations that need to be built is the same, but the number of files in Of course, my proposal is not to replace the current profile mechanism, but to extend it with above features. |
I still not see it. The advantage that you are describing as user story is doable as today with: conan create . mylib/1.0@ -pr=android_ndk_r22b -o android_ndk:abi=arm64-v8a -o android_ndk:lto=True ... You don't need to have a combinaric explosion of profiles. You can fine tune with added settings and options on the command line, you can conan create . mylib/1.0@ -pr=android_ndk_r22b -pr=v8_lto_asan From Conan 1.38, you can also define jinja templates for profiles, that could define values on the fly based on environment or platform conditions. Having the profile directly fetching and defining configuration could be really problematic:
The problem there could be exactly that, that the proposal is that such package doesn't contain only the profile, but also the package itself. To resolve the package itself, the evaluation of settings, options, etc is necessary. No package is downloaded from the server without evaluating first its package_id, that is a result of settings + options + dependencies. If the settings and options of this package are defined inside the package itself, then it is directly not possible to evaluate it without errors. |
🤔, but this still requires having I wasn't aware of the possibility to compose the profiles - that looks like it could help a lot with the combinatoric explosion of the profiles. It could basically provide the feature mentioned in your NDK example whilst ensuring different package ID for every package due to tweaking of custom settings, without the need for every single package to be aware of the Also, I haven't played yet with jinja templates for profiles - I'll definitely explore that.
I understand 😞. My idea with the proposal was mostly to make the DevOps story simpler and more similar to the user story, but I see now that the build configuration complexity must be expressed somewhere and why it's not possible to have that in one place (package recipe) as my proposal suggested as this would make implementation on Conan side too complex. I'll close this issue so that it doesn't confuse people. We can still discuss the possibility of |
This proposal was originally created as tribe pull request, but after some conversation there I decided to put it here in form of feature request:
Summary
Define a special type of conan package (profile-package) that can be used only in conan profiles or pose instead of conan profile, but have the ability to impose settings on the dependency graph and ability to update
settings.yml
file.Motivation
Conan profiles are a great way of sharing common settings and build requirements in your development team. However, the feature currently does not have enough flexibility, such as enforcing specific compile flags on all packages in the dependency graph. Also, profiles cannot be distributed as a conan package, so different channels must be use to distribute profile to your development team.
The motivation originated from this Github issue comment.
Proposal
Define a special "profile-package" type of the conan package, as special conan package that:
build_requires
andpython_requires
, optionally evenrequires
requires
for such packages, then the build procedure will have to ensure that all tools are repackaged into the toolchain (which makes sense for repackaging emsdk_installer, android_ndk and similar, but I'm not so sure about the purpose of repackaging cmake - for such case it may make sense to allowrequires
, but in some kind of "restricted" form. We need to discuss this further).settings.yml
settings.yml
x86_64
as it will also containarm64
and other slices. However, it's possible to use theios_fat
architecture, which does not exist in the defaultsettings.yml
, so, an iOS toolchain should be able to register new architecture tosettings.yml
during its installation.fastcomp
backend and clang 11.0.0 for theirupstream
backend. This could be addressed by introducing special clang versions6.0-emsdk-1.39.11
,6.0-emsdk-1.39.16
,11-emsdk-1.39.11
,11-emsdk-1.39.16
, ..., insettings.yml
on installation. Additionally, the emscripten toolchain may allow for choosing whether you want to enable emscripten threads and SIMD support, which require imposing specific compile flags on all packages in the dependency graph.conan config install
or similar command. The installation would download the profile-package from the conan repository, create profiles associated with the package and trigger hooks that will allow for custom updates ofsettings.yml
as described above.Alternative Approaches
Alternative approach, using only currently available conan features, is completely described in this Github comment.
Open issues
Future Extensions
The text was updated successfully, but these errors were encountered: