make ruzstd an optional dep
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 04a8c46..3f959b3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -92,7 +92,7 @@
if: contains(matrix.os, 'ubuntu')
env:
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zlib"
- - run: cargo test
+ - run: cargo test --features "ruzstd"
if: contains(matrix.os, 'ubuntu-24.04') ||
(contains(matrix.os, 'ubuntu') && contains(matrix.rust, 'nightly'))
env:
diff --git a/Cargo.toml b/Cargo.toml
index 46ee959..27df474 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,7 +43,7 @@
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
miniz_oxide = { version = "0.8", default-features = false }
-ruzstd = { version = "0.7.2", default-features = false }
+ruzstd = { version = "0.7.3", default-features = false, optional = true }
addr2line = { version = "0.24.0", default-features = false }
libc = { version = "0.2.156", default-features = false }
@@ -65,6 +65,8 @@
serialize-serde = ["serde"]
+ruzstd = ["dep:ruzstd"]
+
#=======================================
# Deprecated/internal features
#
diff --git a/src/symbolize/gimli/elf.rs b/src/symbolize/gimli/elf.rs
index b73f6aa..2234028 100644
--- a/src/symbolize/gimli/elf.rs
+++ b/src/symbolize/gimli/elf.rs
@@ -9,9 +9,9 @@
use alloc::sync::Arc;
use core::convert::{TryFrom, TryInto};
use core::str;
-use object::elf::{
- ELFCOMPRESS_ZLIB, ELFCOMPRESS_ZSTD, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED,
-};
+#[cfg(feature = "ruzstd")]
+use object::elf::ELFCOMPRESS_ZSTD;
+use object::elf::{ELFCOMPRESS_ZLIB, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED};
use object::read::elf::{CompressionHeader, FileHeader, SectionHeader, SectionTable, Sym};
use object::read::StringTable;
use object::{BigEndian, Bytes, NativeEndian};
@@ -231,6 +231,7 @@
decompress_zlib(data.0, buf)?;
return Some(buf);
}
+ #[cfg(feature = "ruzstd")]
ELFCOMPRESS_ZSTD => {
let size = usize::try_from(header.ch_size(self.endian)).ok()?;
let buf = stash.allocate(size);
@@ -357,6 +358,7 @@
}
}
+#[cfg(feature = "ruzstd")]
fn decompress_zstd(mut input: &[u8], mut output: &mut [u8]) -> Option<()> {
use ruzstd::frame::ReadFrameHeaderError;
use ruzstd::frame_decoder::FrameDecoderError;