mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-24 18:55:55 +03:00
[GH-ISSUE #2348] environment variable CARGO_PKG_VERSION not defined at compile time #970
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#970
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jagill on GitHub (Aug 7, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2348
Describe the bug
When building with a non-Cargo build tool,
CARGO_PKG_VERSIONis not set at compile time. But inresolver'slib.rsline 316, theenv!("CARGO_PKG_VERSION")assumes it exists and compilation fails.Hickory should instead use
option_env!and handle the None case.To Reproduce
Attempt to build without Cargo. We use Buck2 (https://buck2.build/).
Expected behavior
Crate should build without errors.
System:
Version:
Crate: resolver
Version: 0.24.1
Additional context
The build system, while on CentOS, also builds MacOS architectures.
@djc commented on GitHub (Aug 7, 2024):
Why can't you not simply set the environment variable in your Buck2 build environment? IMO it is not unreasonable for Rust code to depend on well-defined environment variables like this.
@bluejekyll commented on GitHub (Aug 7, 2024):
This is also very common for CLIs (via clap) to depend on Cargo environment variables for things like description, name, version, or authors.
It would be my opinion that these are properties defined in the Cargo.toml that should be read by any build tool and exposed to make the builds of those tools work correctly, just like would be done with the dependencies lists defined in the Cargo.toml.