Raspbian Buster: cargo build --release crash

Hi,
I tried to compile and run my code on Raspberry PI (which run on Linux and windows).
If I do :

  • test using > cargo test it compile test and run
  • Build in debug cargo build it compile and run
  • Build in release cargo build --release it crash
    The first error is:

'A macro to generate structures which behave like bitflags.
' CARGO_PKG_HOMEPAGE='https://github.com/bitflags/bitflags' CARGO_PKG_VERSION_PATCH=0 CARGO_MANIFEST_DIR=/home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.0 CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO=/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/bin/cargo CARGO_PKG_REPOSITORY='https://github.com/bitflags/bitflags' rustc --crate-name build_script_build /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.0/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' -C metadata=b8f67689abe13aac -C extra-filename=-b8f67689abe13aac --out-dir /home/pi/dev/sha3sum/target/release/build/bitflags-b8f67689abe13aac -L dependency=/home/pi/dev/sha3sum/target/release/deps --cap-lints warnerror: Could not compilebitflags`.

Caused by:
process didn't exit successfully: LD_LIBRARY_PATH='/home/pi/dev/sha3sum/target/release/deps:/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib:/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/lib' CARGO_PKG_VERSION_PRE= CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION=1.2.0 CARGO_PKG_NAME=bitflags CARGO_PKG_DESCRIPTION='A macro to generate structures which behave like bitflags. ' CARGO_PKG_HOMEPAGE='https://github.com/bitflags/bitflags' CARGO_PKG_VERSION_PATCH=0 CARGO_MANIFEST_DIR=/home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.0 CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO=/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/bin/cargo CARGO_PKG_REPOSITORY='https://github.com/bitflags/bitflags' rustc --crate-name build_script_build /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.0/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' -C metadata=b8f67689abe13aac -C extra-filename=-b8f67689abe13aac --out-dir /home/pi/dev/sha3sum/target/release/build/bitflags-b8f67689abe13aac -L dependency=/home/pi/dev/sha3sum/target/release/deps --cap-lints warn (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
double free or corruption (!prev)
error: Could not compile libc.

Have you any advices ?

Thanks

This seems to be exactly what's noted in Rust 1.38 compatibility:

The armv7-unknown-linux-gnueabihf platform is known to have issues with certain crates such as libc.

The workaround in that linked issue is to use RUSTFLAGS=-Ccodegen-units=1.

Hi,
Thank you very much I would not have guessed a rustc issue.