Skip to content

Commit eb53a82

Browse files
prontclaude
andcommitted
fix(deps): gate Unix-only dependencies to enable Windows MSVC builds
Move `tikv-jemallocator` to a Unix-only target dependency (it requires autoconf which is unavailable with MSVC). Enable `rdkafka/cmake_build` on Windows via a target-specific dependency entry so rdkafka builds using cmake instead of the Unix autotools path. Gate `sources-dnstap` module declarations on Unix to match the Unix-only `framestream` crate it depends on. Add `#[cfg(unix)]` to jemalloc allocator blocks in `src/lib.rs`. Tested on Windows with Cyrus SASL installed via MSYS2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f62a9ff commit eb53a82

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ sqlx = { version = "0.8.6", default-features = false, features = ["derive", "pos
435435
stream-cancel = { version = "0.8.2", default-features = false }
436436
strip-ansi-escapes = { version = "0.2.1", default-features = false }
437437
syslog = { version = "6.1.1", default-features = false, optional = true }
438-
tikv-jemallocator = { version = "0.6.0", default-features = false, features = ["unprefixed_malloc_on_supported_platforms"], optional = true }
439438
tokio-postgres = { version = "0.7.13", default-features = false, features = ["runtime", "with-chrono-0_4"], optional = true }
440439
tokio-tungstenite = { workspace = true, features = ["connect"], optional = true }
441440
toml.workspace = true
@@ -462,9 +461,11 @@ byteorder = "1.5.0"
462461
windows-service = "0.8.0"
463462
windows = { version = "0.58", features = ["Win32_System_EventLog", "Win32_Foundation", "Win32_System_Com", "Win32_Security", "Win32_Security_Authorization", "Win32_System_Threading", "Win32_Storage_FileSystem"], optional = true }
464463
quick-xml = { version = "0.31", default-features = false, features = ["serialize"], optional = true }
464+
rdkafka = { version = "0.39.0", default-features = false, features = ["cmake_build"], optional = true }
465465

466466
[target.'cfg(unix)'.dependencies]
467467
nix = { version = "0.31", default-features = false, features = ["socket", "signal", "fs"] }
468+
tikv-jemallocator = { version = "0.6.0", default-features = false, features = ["unprefixed_malloc_on_supported_platforms"], optional = true }
468469

469470
[target.'cfg(target_os = "linux")'.dependencies]
470471
procfs = { version = "0.18.0", default-features = false }

src/internal_events/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mod datadog_traces;
4040
mod dedupe;
4141
#[cfg(feature = "sources-demo_logs")]
4242
mod demo_logs;
43-
#[cfg(feature = "sources-dnstap")]
43+
#[cfg(all(unix, feature = "sources-dnstap"))]
4444
mod dnstap;
4545
#[cfg(feature = "sources-docker_logs")]
4646
mod docker_logs;
@@ -194,7 +194,7 @@ pub(crate) use self::datadog_traces::*;
194194
pub(crate) use self::dedupe::*;
195195
#[cfg(feature = "sources-demo_logs")]
196196
pub(crate) use self::demo_logs::*;
197-
#[cfg(feature = "sources-dnstap")]
197+
#[cfg(all(unix, feature = "sources-dnstap"))]
198198
pub(crate) use self::dnstap::*;
199199
#[cfg(feature = "sources-docker_logs")]
200200
pub(crate) use self::docker_logs::*;

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ pub use indoc::indoc;
3535
// re-export codecs for convenience
3636
pub use vector_lib::codecs;
3737

38-
#[cfg(all(feature = "tikv-jemallocator", not(feature = "allocation-tracing")))]
38+
#[cfg(all(unix, feature = "tikv-jemallocator", not(feature = "allocation-tracing")))]
3939
#[global_allocator]
4040
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
4141

42-
#[cfg(all(feature = "tikv-jemallocator", feature = "allocation-tracing"))]
42+
#[cfg(all(unix, feature = "tikv-jemallocator", feature = "allocation-tracing"))]
4343
#[global_allocator]
4444
static ALLOC: self::internal_telemetry::allocations::Allocator<tikv_jemallocator::Jemalloc> =
4545
self::internal_telemetry::allocations::get_grouped_tracing_allocator(

src/sources/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod aws_sqs;
1717
pub mod datadog_agent;
1818
#[cfg(feature = "sources-demo_logs")]
1919
pub mod demo_logs;
20-
#[cfg(feature = "sources-dnstap")]
20+
#[cfg(all(unix, feature = "sources-dnstap"))]
2121
pub mod dnstap;
2222
#[cfg(feature = "sources-docker_logs")]
2323
pub mod docker_logs;

0 commit comments

Comments
 (0)