How to enforce a minimum version of clang on macOS? #5977
-
Description of issueOn macOS, the latest version of the "Xcode command line tools" installs Apple clang 16.0.0. How would you enforce that minimum version of clang in a formula? The problem is the support of C++20. Up to version 15, clang support for C++20 is buggy. So, when an application is developed in C++20 (or whose code has been upgraded to C++20), building it requires clang 16.0.0 or higher. The problem just emerged with the auto-bump of the new version of the TSDuck project. See the auto-bump PR here. It seems that the tests started with a build on macOS 13 with some old version of clang. The build failed (because of the bugs in the old clang) and the whole process stopped. Between the last version and the new one, the code of the project has been upgraded to C++20 (allowing a lot of code simplifications). In the CI of the project, on macOS, the setup phase tests the version of clang and enforces an upgrade of the "Xcode command line tools" if clang version is lower than 16. How would you transpose that requirement in a formula? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The You can also conditionally add a dependency based on the version of the compiler available, like done here. |
Beta Was this translation helpful? Give feedback.
The
fails_with
DSL method should be able to do what you're asking for here. You can see this in action in thebtop
formula. See also this doc section about compiler selection.You can also conditionally add a dependency based on the version of the compiler available, like done here.