diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml new file mode 100644 index 0000000..943550f --- /dev/null +++ b/.github/workflows/semantic-release.yml @@ -0,0 +1,46 @@ +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 🏷️ Semantic Release +on: + push: + branches: [main] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Version + id: version + uses: paulhatch/semantic-version@v5.4.0 + with: + bump_each_commit: true + major_pattern: "(major)" + minor_pattern: "(minor)" + bump_each_commit_patch_pattern: "(patch)" + tag_prefix: "" + debug: true + - name: Release + if: steps.version.outputs.version_type != 'none' + run: | + gh release create ${{ steps.version.outputs.version_tag }} \ + --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }} diff --git a/README.md b/README.md index b41fe1f..d0a28f7 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,22 @@ Missing Architectures: All binaries are downloaded from the official [ARM GNU Toolchain Download Page](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads). +> [!WARNING] +> +> LTO is disabled for ARM GCC 14.x. From testing, it seems that LTO compression +> support for ZSTD is enabled for Linux (maybe Windows too), but not for Mac. +> This results in the following error when Linux built binaries are used on a +> mac build: +> +> ```plaintext +> lto1: fatal error: compiler does not support ZSTD LTO compression +> compilation terminated. +> lto-wrapper: fatal error: bin/arm-none-eabi-g++ returned 1 exit status +> compilation terminated. arm-none-eabi/bin/ld: error: lto-wrapper failed +> collect2: error: ld returned 1 exit status +> ninja: build stopped: subcommand failed. +> ``` + ## 🚀 Quick Start To use the ARM GNU Toolchain for your application, you should install the diff --git a/all/conanfile.py b/all/conanfile.py index d311774..148228f 100644 --- a/all/conanfile.py +++ b/all/conanfile.py @@ -2,6 +2,7 @@ from conan import ConanFile from conan.tools.files import get, copy from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version required_conan_version = ">=2.0.0" @@ -38,7 +39,7 @@ class ArmGnuToolchain(ConanFile): default_options = { "local_path": "", "default_arch": True, - "lto": True, + # "lto" default set in config_options() "fat_lto": True, "function_sections": True, "data_sections": True, @@ -65,6 +66,20 @@ class ArmGnuToolchain(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def config_options(self): + """Set LTO default based on compiler version""" + # Disable LTO for GCC 14 due to ZSTD compression incompatibilities + # between different build environments (Linux/macOS/Windows) + if self.settings_target: + COMPILER_VERSION = str( + self.settings_target.get_safe("compiler.version", "")) + if COMPILER_VERSION.startswith("14"): + self.output.debug("‼️ DISABLING LTO FOR GCC 14 ‼️") + self.options.lto = False + else: + self.output.debug("✅ USING LTO FOR GCC") + self.options.lto = True + def validate(self): supported_build_operating_systems = ["Linux", "Macos", "Windows"] if not self._settings_build.os in supported_build_operating_systems: