[GH-ISSUE #86] Allow avahi support using dns-sd for Discovery #73

Closed
opened 2026-02-27 19:28:41 +03:00 by kerem · 3 comments
Owner

Originally created by @sashahilton00 on GitHub (Jan 29, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/86

Issue by shanemeagher
Tuesday Sep 05, 2017 at 15:13 GMT
Originally opened as https://github.com/plietar/librespot/pull/246


rust-mdns is still the default but can also be specified explicitly with
--feature "with-internal-mdns" switch at build time.

Added --feature "with-external-mdns" switch to build librespot to use
avahi for discovery using dns-sd package.

This commit does not provide option for building without mdns.

This pull request replaces pull request https://github.com/plietar/librespot/pull/201 started by @awiouy and has been rebased on the current master branch.


shanemeagher included the following code: https://github.com/plietar/librespot/pull/246/commits

Originally created by @sashahilton00 on GitHub (Jan 29, 2018). Original GitHub issue: https://github.com/librespot-org/librespot/issues/86 <a href="https://github.com/shanemeagher"><img src="https://avatars3.githubusercontent.com/u/2144292?v=4" align="left" width="96" height="96" hspace="10"></img></a> **Issue by [shanemeagher](https://github.com/shanemeagher)** _Tuesday Sep 05, 2017 at 15:13 GMT_ _Originally opened as https://github.com/plietar/librespot/pull/246_ ---- rust-mdns is still the default but can also be specified explicitly with `--feature "with-internal-mdns"` switch at build time. Added `--feature "with-external-mdns"` switch to build librespot to use avahi for discovery using dns-sd package. This commit does not provide option for building without mdns. This pull request replaces pull request https://github.com/plietar/librespot/pull/201 started by @awiouy and has been rebased on the current master branch. ---- _**[shanemeagher](https://github.com/shanemeagher)** included the following code: https://github.com/plietar/librespot/pull/246/commits_
kerem 2026-02-27 19:28:41 +03:00
Author
Owner

@sashahilton00 commented on GitHub (Jan 29, 2018):

Comment by shanemeagher
Wednesday Sep 06, 2017 at 14:00 GMT


@plietar,
It seems I'm still having an issue when building with --no-default-features. As mdns is optional and not a dependency of an enabled feature (with-internal-mdns) in cargo.toml, cargo doesn't pass it to rustc.

In src/lib.rs, I've used cfg-if to reference mdns:

cfg_if! {
    if #[cfg(feature = "with-internal-mdns")] {
        extern crate mdns;
    } else if #[cfg(feature = "with-external-mdns")] {
        extern crate dns_sd;
    } else {
        extern crate mdns;
    }
}

resulting in this error: https://travis-ci.org/plietar/librespot/jobs/272099406#L929

In the PR201, you asked:

Did you use #[cfg(mdns)] around the extern crate mdns ?
Would this not have just checked if the dependency mdns was enabled? Which it isn't?

Is there a way to make one of the features a default requirement if none is specified?

<!-- gh-comment-id:361276691 --> @sashahilton00 commented on GitHub (Jan 29, 2018): <a href="https://github.com/shanemeagher"><img src="https://avatars3.githubusercontent.com/u/2144292?v=4" align="left" width="48" height="48" hspace="10"></img></a> **Comment by [shanemeagher](https://github.com/shanemeagher)** _Wednesday Sep 06, 2017 at 14:00 GMT_ ---- @plietar, It seems I'm still having an issue when building with `--no-default-features`. As mdns is optional and not a dependency of an enabled feature (`with-internal-mdns`) in `cargo.toml`, cargo doesn't pass it to rustc. In `src/lib.rs`, I've used `cfg-if` to reference mdns: ``` cfg_if! { if #[cfg(feature = "with-internal-mdns")] { extern crate mdns; } else if #[cfg(feature = "with-external-mdns")] { extern crate dns_sd; } else { extern crate mdns; } } ``` resulting in this error: https://travis-ci.org/plietar/librespot/jobs/272099406#L929 In the PR201, you asked: > Did you use `#[cfg(mdns)]` around the `extern crate mdns` ? Would this not have just checked if the dependency `mdns` was enabled? Which it isn't? Is there a way to make one of the features a default requirement if none is specified?
Author
Owner

@awiouy commented on GitHub (Jan 29, 2018):

Documentation for #13
Could be closed

<!-- gh-comment-id:361300416 --> @awiouy commented on GitHub (Jan 29, 2018): Documentation for #13 Could be closed
Author
Owner

@ComlOnline commented on GitHub (Jan 29, 2018):

Thank you @awiouy.

<!-- gh-comment-id:361328188 --> @ComlOnline commented on GitHub (Jan 29, 2018): Thank you @awiouy.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#73
No description provided.