Skip to content
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

Compilation fails on 32-bit architectures: LLVM ERROR: out of memory #1021

Closed
vt-alt opened this issue Jan 27, 2024 · 9 comments
Closed

Compilation fails on 32-bit architectures: LLVM ERROR: out of memory #1021

vt-alt opened this issue Jan 27, 2024 · 9 comments
Labels
A-build Area: Related to the build system C-question Category: Further information is requested O-unix Operating system: Unix-like

Comments

@vt-alt
Copy link

vt-alt commented Jan 27, 2024

Compile fails on 32-bit architectures such as x86 (i586) and armv7hf:

   Compiling rustic-rs v0.6.1 (/usr/src/RPM/BUILD/rustic-0.6.1)
LLVM ERROR: out of memory
Allocation failed
error: could not compile `rustic-rs` (bin "rustic")

Caused by:
  process didn't exit successfully: `rustc --crate-name rustic --edition=2021 src/bin/rustic.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto=fat -C codegen-units=1 --cfg 'feature="default"' -C metadata=ec8c948345e3b89b -C extra-filename=-ec8c948345e3b89b --out-dir /usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps -L dependency=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps --extern abscissa_core=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libabscissa_core-c475e661bccb7d88.rlib --extern anyhow=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libanyhow-dac24142f176942a.rlib --extern bytesize=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libbytesize-8badc08db7ed5508.rlib --extern chrono=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libchrono-fb26853bfb257b29.rlib --extern clap=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libclap-a03042d3b4cf6e39.rlib --extern clap_complete=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libclap_complete-525a70d30545bc39.rlib --extern comfy_table=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libcomfy_table-bf5b2de0f4420a97.rlib --extern dialoguer=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libdialoguer-b1fa0c1b4024acb2.rlib --extern directories=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libdirectories-d4555e7a0dba7870.rlib --extern gethostname=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libgethostname-d848d8e9badbe779.rlib --extern humantime=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libhumantime-6725c88195997e90.rlib --extern indicatif=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libindicatif-8f13853dab470f52.rlib --extern itertools=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libitertools-d64a5b2d1f6da20e.rlib --extern libc=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/liblibc-f5407182451b27b1.rlib --extern log=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/liblog-837b53e3e59a782c.rlib --extern merge=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libmerge-c79aac8b94535288.rlib --extern rhai=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librhai-eb56db5a98385034.rlib --extern rustic_rs=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librustic_rs-4673c60c6fb1e0d6.rlib --extern rustic_core=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librustic_core-242d45e83801dac4.rlib --extern self_update=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libself_update-f70866e3a62851f5.rlib --extern semver=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libsemver-c5aacf3f2e48816e.rlib --extern serde=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde-acd8e412a546ad74.rlib --extern serde_json=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde_json-77dc393250b6dd95.rlib --extern serde_with=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde_with-d95a7272730af8cf.rlib --extern simplelog=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libsimplelog-df966b3283b5d093.rlib --extern thiserror=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libthiserror-dbb947920d68e2ae.rlib -g -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/ring-efcf54ff0ce9a4a4/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/sha2-asm-1514893a37c5f54d/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/sha2-asm-1514893a37c5f54d/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/zstd-sys-416d2f59d561adad/out` (signal: 6, SIGABRT: process abort signal)
error: Bad exit status from /usr/src/tmp/rpm-tmp.12861 (%build)
@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Jan 27, 2024
@aawsome
Copy link
Member

aawsome commented Jan 27, 2024

Thanks for opening this issue!
Looking at the error message, this looks more like you try to compile on a machine with too less memory.

Did you try to cross-compile on a powerful machine to your targets?
Note that armv7 for Raspberry Pi is included in the nightly builds: https://github.com/rustic-rs/nightly
If you need it,we can try to add the i586-unknown-linux-gnu target as well (not guaranteed, however, that it will work).

@simonsan simonsan added C-question Category: Further information is requested O-unix Operating system: Unix-like A-build Area: Related to the build system and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Jan 28, 2024
@vt-alt
Copy link
Author

vt-alt commented Jan 28, 2024

We build from sources and natively for ALT Linux so I don't even tried to cross-compile. Some other packages I build with cargo-rust compile successfully on 32-bit architectures. I noticed a difference from them is that rustic have long rustc step at the end (before error) taking 2-3 minutes.

There is (temporary) full build log (you may notice timestamps) https://git.altlinux.org/tasks/339191/build/100/i586/log (final step taking 3 minutes)
https://git.altlinux.org/tasks/339191/build/100/armh/log (it taking 7 minutes)
Quote from i586/log:

[00:00:51]    Compiling rustic-rs v0.6.1 (/usr/src/RPM/BUILD/rustic-0.6.1)
[00:00:51]      Running `rustc --crate-name rustic_rs --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C linker-plugin-lto -C codegen-units=1 --cfg 'feature="default"' -C metadata=4673c60c6fb1e0d6 -C extra-filename=-4673c60c6fb1e0d6 --out-dir /usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps -L dependency=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps --extern abscissa_core=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libabscissa_core-c475e661bccb7d88.rmeta --extern anyhow=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libanyhow-dac24142f176942a.rmeta --extern bytesize=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libbytesize-8badc08db7ed5508.rmeta --extern chrono=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libchrono-fb26853bfb257b29.rmeta --extern clap=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libclap-a03042d3b4cf6e39.rmeta --extern clap_complete=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libclap_complete-525a70d30545bc39.rmeta --extern comfy_table=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libcomfy_table-bf5b2de0f4420a97.rmeta --extern dialoguer=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libdialoguer-b1fa0c1b4024acb2.rmeta --extern directories=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libdirectories-d4555e7a0dba7870.rmeta --extern gethostname=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libgethostname-d848d8e9badbe779.rmeta --extern humantime=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libhumantime-6725c88195997e90.rmeta --extern indicatif=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libindicatif-8f13853dab470f52.rmeta --extern itertools=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libitertools-d64a5b2d1f6da20e.rmeta --extern libc=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/liblibc-f5407182451b27b1.rmeta --extern log=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/liblog-837b53e3e59a782c.rmeta --extern merge=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libmerge-c79aac8b94535288.rmeta --extern rhai=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librhai-eb56db5a98385034.rmeta --extern rustic_core=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librustic_core-242d45e83801dac4.rmeta --extern self_update=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libself_update-f70866e3a62851f5.rmeta --extern semver=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libsemver-c5aacf3f2e48816e.rmeta --extern serde=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde-acd8e412a546ad74.rmeta --extern serde_json=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde_json-77dc393250b6dd95.rmeta --extern serde_with=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde_with-d95a7272730af8cf.rmeta --extern simplelog=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libsimplelog-df966b3283b5d093.rmeta --extern thiserror=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libthiserror-dbb947920d68e2ae.rmeta -g -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/ring-efcf54ff0ce9a4a4/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/sha2-asm-1514893a37c5f54d/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/sha2-asm-1514893a37c5f54d/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/zstd-sys-416d2f59d561adad/out`
[00:02:16]      Running `rustc --crate-name rustic --edition=2021 src/bin/rustic.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C lto=fat -C codegen-units=1 --cfg 'feature="default"' -C metadata=ec8c948345e3b89b -C extra-filename=-ec8c948345e3b89b --out-dir /usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps -L dependency=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps --extern abscissa_core=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libabscissa_core-c475e661bccb7d88.rlib --extern anyhow=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libanyhow-dac24142f176942a.rlib --extern bytesize=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libbytesize-8badc08db7ed5508.rlib --extern chrono=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libchrono-fb26853bfb257b29.rlib --extern clap=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libclap-a03042d3b4cf6e39.rlib --extern clap_complete=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libclap_complete-525a70d30545bc39.rlib --extern comfy_table=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libcomfy_table-bf5b2de0f4420a97.rlib --extern dialoguer=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libdialoguer-b1fa0c1b4024acb2.rlib --extern directories=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libdirectories-d4555e7a0dba7870.rlib --extern gethostname=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libgethostname-d848d8e9badbe779.rlib --extern humantime=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libhumantime-6725c88195997e90.rlib --extern indicatif=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libindicatif-8f13853dab470f52.rlib --extern itertools=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libitertools-d64a5b2d1f6da20e.rlib --extern libc=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/liblibc-f5407182451b27b1.rlib --extern log=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/liblog-837b53e3e59a782c.rlib --extern merge=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libmerge-c79aac8b94535288.rlib --extern rhai=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librhai-eb56db5a98385034.rlib --extern rustic_rs=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librustic_rs-4673c60c6fb1e0d6.rlib --extern rustic_core=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/librustic_core-242d45e83801dac4.rlib --extern self_update=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libself_update-f70866e3a62851f5.rlib --extern semver=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libsemver-c5aacf3f2e48816e.rlib --extern serde=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde-acd8e412a546ad74.rlib --extern serde_json=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde_json-77dc393250b6dd95.rlib --extern serde_with=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libserde_with-d95a7272730af8cf.rlib --extern simplelog=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libsimplelog-df966b3283b5d093.rlib --extern thiserror=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/deps/libthiserror-dbb947920d68e2ae.rlib -g -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/ring-efcf54ff0ce9a4a4/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/sha2-asm-1514893a37c5f54d/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/sha2-asm-1514893a37c5f54d/out -L native=/usr/src/RPM/BUILD/rustic-0.6.1/target/release/build/zstd-sys-416d2f59d561adad/out`
[00:05:49] LLVM ERROR: out of memory
[00:05:49] Allocation failed
[00:05:49] error: could not compile `rustic-rs` (bin "rustic")

Maybe it's possible to split this step into smaller ones?

@aawsome
Copy link
Member

aawsome commented Jan 28, 2024

Ah - you could try to remove

opt-level = 3
lto = "fat"
codegen-units = 1

from [profile.release] in Cargo.toml.

These options enable heavy code optimization which maybe fails on your build machine...

@vt-alt
Copy link
Author

vt-alt commented Jan 28, 2024

Thanks. I'm reading https://nnethercote.github.io/perf-book/build-configuration.html and planned to experiment with these too.

@vt-alt
Copy link
Author

vt-alt commented Jan 28, 2024

OK, (If I'm not mistaken) in my tests, either one lto = "thin" (or lto = false) or codegen-units = 16 is enough for compile to finish (tested on i586). Perhaps, I will add both. Thanks for the suggestions!

@vt-alt vt-alt closed this as completed Jan 28, 2024
@aawsome
Copy link
Member

aawsome commented Jan 28, 2024

Note that as an alternative, you could also use a more powerful machine and cross-compile to the desired target.

@vt-alt
Copy link
Author

vt-alt commented Jan 28, 2024

We cannot use cross-compile, since we only build natively for packages (neither our packaging system have cross-comilation infrastructure), but maybe this will help someone else. 🙏

@vt-alt
Copy link
Author

vt-alt commented Feb 5, 2024

JFYI Since 0.7.0 lto = "thin" is not enough anymore, but lto = false does it.

@simonsan
Copy link
Contributor

simonsan commented Feb 5, 2024

Yeah, it's probably related to OpenDAL which is quite a big library to pull in. But with it comes also a lot of opportunity, so it's worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build Area: Related to the build system C-question Category: Further information is requested O-unix Operating system: Unix-like
Projects
None yet
Development

No branches or pull requests

3 participants