mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-29 15:29:35 +00:00
c7848df9a0
* fix(build): pin gnu glibc baseline to 2.31 and report compile target in version metadata gnu release binaries were built natively on Ubuntu 24.04, embedding GLIBC_2.38/2.39 symbol references while the RPM/DEB metadata promised glibc >= 2.31, so Rocky/RHEL 9 (glibc 2.34) could not run them (#8062). The two linux-gnu legs now build through cargo-zigbuild pinned to the 2.31 baseline (same-arch; zig acts as the linker), with post-build guards asserting both the embedded version metadata and the highest referenced GLIBC symbol version, keeping the package declarations honest. Version metadata itself now comes from cargo's TARGET cfg instead of shadow-rs' host stamping, so builds whose host differs from their target (cross compilation, musl targets on a glibc-hosted toolchain) report the platform they were compiled for (#8048 follow-up). The cross toolchain (zig 0.14.x, cargo-zigbuild 0.23.4) is pinned in the setup action now that it is load-bearing for releases, the build job gets an explicit matrix-independent name so the connect-* acceptance workflows keep matching it when matrix fields change, and the preview-release workflow contract is updated for the TARGET_ARG build commands. Fixes #8062 Follow-up on #8048 * fix(build): enforce GNU ABI floor and canonical target metadata Pin Zig 0.17.0 and cargo-zigbuild, isolate cross-toolchain caches, and build GNU releases against the declared glibc 2.31 floor. Validate both release ELF binaries using their loader version requirements. Generate target metadata once through shadow-rs and check the actual release version output without adding a parallel metadata facade. Refs: rustfs/backlog#2824 Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * perf(build): reuse GNU release profile across binaries Switching the CLI back to the default strip profile restarted 419 compilation units after the server build. Keep the profiling build profile for both binaries, then strip only the CLI artifact. Retain serial links, server profiling symbols, and post-strip ABI gates. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * perf(build): limit release artifacts to the rustfs server Build only rustfs in the release workflow and remove the CLI build, strip, and packaging paths. Preserve GNU profiling symbols and catalog sidecars, and align strict acceptance archive readers with the new set. Exercise all six build targets, Linux package checks, and all four strict acceptance extractors using their actual workflow scripts. Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> --------- Co-authored-by: majinghe <42570491+majinghe@users.noreply.github.com> Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com>
64 lines
2.7 KiB
Rust
64 lines
2.7 KiB
Rust
// Copyright 2024 RustFS Team
|
|
//
|
|
// 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.
|
|
|
|
use std::io::Write;
|
|
|
|
fn main() -> shadow_rs::SdResult<()> {
|
|
println!("cargo:rerun-if-env-changed=RUSTFS_BUILD_VERSION");
|
|
if let Ok(version) = std::env::var("RUSTFS_BUILD_VERSION")
|
|
&& !version.is_empty()
|
|
{
|
|
assert!(
|
|
!version.contains(['\n', '\r']),
|
|
"RUSTFS_BUILD_VERSION must be a single-line version string"
|
|
);
|
|
println!("cargo:rustc-env=RUSTFS_BUILD_VERSION={version}");
|
|
}
|
|
|
|
println!("cargo:rerun-if-env-changed=RUSTC");
|
|
let target = std::env::var("TARGET")?;
|
|
let target_os = std::env::var("CARGO_CFG_TARGET_OS")?;
|
|
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH")?;
|
|
let output = std::process::Command::new(std::env::var("RUSTC")?).arg("-vV").output()?;
|
|
if !output.status.success() {
|
|
return Err(std::io::Error::other("failed to query the build compiler").into());
|
|
}
|
|
let output = String::from_utf8(output.stdout)?;
|
|
let release = output
|
|
.lines()
|
|
.find_map(|line| line.strip_prefix("release: "))
|
|
.ok_or_else(|| std::io::Error::other("build compiler did not report its release"))?;
|
|
let channel = match release.split_once('-') {
|
|
Some((_, channel)) if matches!(channel.split('.').next(), Some("beta" | "nightly" | "dev")) => {
|
|
channel.split('.').next().unwrap()
|
|
}
|
|
None if release.split('.').count() == 3 && release.split('.').all(|part| part.parse::<u32>().is_ok()) => "stable",
|
|
_ => return Err(std::io::Error::other("unrecognized build compiler release channel").into()),
|
|
};
|
|
|
|
// Generate target metadata once so every shadow-rs consumer agrees, even
|
|
// when the build script and compiler run on a different host platform.
|
|
let mut deny = shadow_rs::default_deny();
|
|
deny.extend([shadow_rs::BUILD_OS, shadow_rs::RUST_CHANNEL]);
|
|
shadow_rs::ShadowBuilder::builder()
|
|
.deny_const(deny)
|
|
.hook(|file: &std::fs::File| {
|
|
writeln!(&*file, "pub const BUILD_OS: &str = {:?};", format!("{target_os}-{target_arch}"))?;
|
|
writeln!(&*file, "pub const RUST_CHANNEL: &str = {:?};", format!("{channel}-{target}"))?;
|
|
Ok(())
|
|
})
|
|
.build()?;
|
|
Ok(())
|
|
}
|