You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
lilith
changed the title
Tests fail to build under opt-level 1,2, or 3 on aarch64-unknown-linux-gnu (Error: unaligned opcodes detected in executable segment)
Doesn't build in release mode or under opt-level 1,2, or 3 on aarch64-unknown-linux-gnu (Error: unaligned opcodes detected in executable segment)
Aug 20, 2024
So, it appears that libwebp can't compile successfully with ANY optimizations enabled if debugging info is also enabled - but only on ARM. So turning optimizations on for testing fails, as does having debugging symbols on for a release build. "-gdwarf-4" and "-O2" cannot co-exist on ARM for this lib.
The patch for build.rs:
"aarch64" => {
if cfg!(feature = "neon") {
build.define("WEBP_HAVE_NEON", Some("1"));
}
// If any optimizations are ennabled, we must remove -gdwarf flags
// Which we can only do by stopping debug mode entirely since we can't
// fix env flags.
let gccflags = build.get_compiler().cflags_env().to_string_lossy().to_string();
if gccflags.contains("-O0") || gccflags.contains("-O1")
|| gccflags.contains("-O2") || gccflags.contains("-O3")
|| gccflags.contains("-Ofast") || gccflags.contains("-Os")
|| gccflags.contains("--opt-level=0") || gccflags.contains("--opt-level=1")
|| gccflags.contains("--opt-level=2") || gccflags.contains("--opt-level=3")
|| gccflags.contains("--opt-level=s") || gccflags.contains("--opt-level=z") {
build.debug(false);
}
}
To reproduce, add to Cargo.toml
Then run
cross test --target aarch64-unknown-linux-gnu -v
To get cross running quickly on CI, you could use these commands. Github arm-linux runners won't be free for a while, but cross is fast
To install binstall
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
or
Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
To install cross
cargo binstall cross
This also affects
The text was updated successfully, but these errors were encountered: