Skip to content

Commit

Permalink
Try to avoid "LLVM ERROR: out of memory" on Win i686
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Sep 19, 2022
1 parent ecbbb51 commit 0c030c4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,52 @@ jobs:
lib-file-name: realearn.dll
target: x86_64-pc-windows-msvc
use-cross: false
profile: release
- artifact: windows-i686
os: windows-latest
toolchain-suffix: i686-pc-windows-msvc
lib-file-name: realearn.dll
target: i686-pc-windows-msvc
use-cross: false
profile: release-llvm-out-of-memory-fix
- artifact: macos-x86_64
os: macos-latest
toolchain-suffix: x86_64-apple-darwin
lib-file-name: librealearn.dylib
target: x86_64-apple-darwin
use-cross: false
profile: release
- artifact: macos-aarch64
os: macos-latest
toolchain-suffix: x86_64-apple-darwin
lib-file-name: librealearn.dylib
target: aarch64-apple-darwin
use-cross: false
profile: release
- artifact: linux-x86_64
os: ubuntu-latest
toolchain-suffix: x86_64-unknown-linux-gnu
lib-file-name: librealearn.so
target: x86_64-unknown-linux-gnu
use-cross: false
strip-cmd: strip
profile: release
- artifact: linux-aarch64
os: ubuntu-latest
toolchain-suffix: x86_64-unknown-linux-gnu
lib-file-name: librealearn.so
target: aarch64-unknown-linux-gnu
use-cross: true
strip-cmd: aarch64-linux-gnu-strip
profile: release
- artifact: linux-armv7
os: ubuntu-latest
toolchain-suffix: x86_64-unknown-linux-gnu
lib-file-name: librealearn.so
target: armv7-unknown-linux-gnueabihf
use-cross: true
strip-cmd: arm-linux-gnueabihf-strip
profile: release
env:
MACOSX_DEPLOYMENT_TARGET: 10.7 # This is relevant for macOS builds only (and only if not overridden).
steps:
Expand Down Expand Up @@ -100,44 +107,44 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
args: --profile ${{ matrix.profile }} --target ${{ matrix.target }}
use-cross: ${{ matrix.use-cross }}
# Strip debug symbols (Linux and macOS)
# TODO-medium We could replace this with Cargo's recent built-in strip function
- name: Strip debug symbols from Linux binary
if: matrix.os == 'ubuntu-latest'
run: |
cp target/${{ matrix.target }}/release/${{ matrix.lib-file-name }} target/${{ matrix.target }}/release/librealearn-debug.so
${{ matrix.strip-cmd }} target/${{ matrix.target }}/release/${{ matrix.lib-file-name }}
cp target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }} target/${{ matrix.target }}/${{ matrix.profile }}/librealearn-debug.so
${{ matrix.strip-cmd }} target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }}
- name: Strip debug symbols from macOS binary
if: matrix.os == 'macos-latest'
run: |
strip -u -r target/${{ matrix.target }}/release/${{ matrix.lib-file-name }}
strip -u -r target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }}
# Upload plug-in (all)
- name: Upload plug-in to artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/${{ matrix.lib-file-name }}
path: target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }}
# Upload debug symbols (all)
- name: Upload Windows debug symbols to artifact
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/realearn.pdb
path: target/${{ matrix.target }}/${{ matrix.profile }}/realearn.pdb
- name: Upload macOS debug symbols to artifact
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/deps/librealearn.dylib.dSYM/
path: target/${{ matrix.target }}/${{ matrix.profile }}/deps/librealearn.dylib.dSYM/
- name: Upload Linux debug symbols to artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/librealearn-debug.so
path: target/${{ matrix.target }}/${{ matrix.profile }}/librealearn-debug.so

create-release:
name: Publish release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-i686.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
# We build with --release because without that, LLVM runs out of memory on GitHub actions
args: --release --target i686-pc-windows-msvc
# Prevent "LLVM ERROR: out of memory"
args: --profile dev-llvm-out-of-memory-fix --target i686-pc-windows-msvc
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ members = [
# This is important for having line numbers in bug reports.
debug = 2

[profile.dev-llvm-out-of-memory-fix]
inherits = "dev"
# Lately, i686 Windows builds often fail due to "LLVM ERROR: out of memory".
# Lowering the amount of debug information included in the binary is supposed to fix that.
debug = 1

[profile.release-llvm-out-of-memory-fix]
inherits = "release"
# Lately, i686 Windows builds often fail due to "LLVM ERROR: out of memory".
# Lowering the amount of debug information included in the binary is supposed to fix that.
debug = 1

[patch.crates-io]

# TODO-low-wait
Expand Down
2 changes: 1 addition & 1 deletion main/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "realearn"
version = "2.14.0-pre.2"
version = "2.14.0-pre.3"
authors = ["Benjamin Klum <benjamin.klum@helgoboss.org>"]
edition = "2021"
build = "build.rs"
Expand Down

0 comments on commit 0c030c4

Please sign in to comment.