[GH-ISSUE #778] including socket2 reuseport feature causes build failure on smartos/illumos #290

Closed
opened 2026-03-07 23:17:28 +03:00 by kerem · 3 comments
Owner

Originally created by @rjloura on GitHub (May 21, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/778

Describe the bug
Currently smartos does not expose SO_REUSEPORT for native zones, so when trust-dns-resolver is included as a dependency cargo build fails with the following error:

error[E0425]: cannot find value `SO_REUSEPORT` in module `libc`
   --> /home/rui/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.9/src/sys/unix/mod.rs:745:70
    |
745 |             let raw: c_int = self.getsockopt(libc::SOL_SOCKET, libc::SO_REUSEPORT)?;
    |                                                                      ^^^^^^^^^^^^ help: a constant with a similar name exists: `SO_REUSEADDR`

error[E0425]: cannot find value `SO_REUSEPORT` in module `libc`
   --> /home/rui/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.9/src/sys/unix/mod.rs:752:58
    |
752 |         unsafe { self.setsockopt(libc::SOL_SOCKET, libc::SO_REUSEPORT, reuse as c_int) }
    |                                                          ^^^^^^^^^^^^ help: a constant with a similar name exists: `SO_REUSEADDR`

   Compiling atty v0.2.11
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
error: Could not compile `socket2`.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project on smartos
  2. add `trust-dns-resolver = "0.11.0" to Cargo.toml dependencies
  3. Run Cargo build

Expected behavior

Expect trust-dns to build.

System:

  • OS: [e.g. smartos]
  • Architecture: [e.g. x86_64]
  • Version [e.g. joyent_20190228T233723Z trunk]
  • rustc version: [e.g. 1.33]

Version:
Crate: [e.g. resolver]
Version: [e.g. 0.11.0]

Additional context
Workaround: Removing the reuseport feature from socket2 in trust-dns's proto dependencies "fixes" the issue. Although this is probably not the best long term fix. Perhaps the reuseport feature should be conditional on linux or exclude illumos.
github.com/rjloura/trust-dns@5cb9bb035d

Originally created by @rjloura on GitHub (May 21, 2019). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/778 **Describe the bug** Currently smartos does not expose SO_REUSEPORT for native zones, so when trust-dns-resolver is included as a dependency `cargo build` fails with the following error: ``` error[E0425]: cannot find value `SO_REUSEPORT` in module `libc` --> /home/rui/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.9/src/sys/unix/mod.rs:745:70 | 745 | let raw: c_int = self.getsockopt(libc::SOL_SOCKET, libc::SO_REUSEPORT)?; | ^^^^^^^^^^^^ help: a constant with a similar name exists: `SO_REUSEADDR` error[E0425]: cannot find value `SO_REUSEPORT` in module `libc` --> /home/rui/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.9/src/sys/unix/mod.rs:752:58 | 752 | unsafe { self.setsockopt(libc::SOL_SOCKET, libc::SO_REUSEPORT, reuse as c_int) } | ^^^^^^^^^^^^ help: a constant with a similar name exists: `SO_REUSEADDR` Compiling atty v0.2.11 error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. error: Could not compile `socket2`. ``` **To Reproduce** Steps to reproduce the behavior: 1. Create a new project on smartos 2. add `trust-dns-resolver = "0.11.0" to Cargo.toml dependencies 3. Run `Cargo build` **Expected behavior** Expect trust-dns to build. **System:** - OS: [e.g. smartos] - Architecture: [e.g. x86_64] - Version [e.g. joyent_20190228T233723Z trunk] - rustc version: [e.g. 1.33] **Version:** Crate: [e.g. resolver] Version: [e.g. 0.11.0] **Additional context** Workaround: Removing the `reuseport` feature from socket2 in trust-dns's proto dependencies "fixes" the issue. Although this is probably not the best long term fix. Perhaps the `reuseport` feature should be conditional on linux or exclude illumos. https://github.com/rjloura/trust-dns/commit/5cb9bb035db0ca1f930f486f7df0abcdfc7746b9
kerem 2026-03-07 23:17:28 +03:00
Author
Owner

@bluejekyll commented on GitHub (May 21, 2019):

I think this is only needed for the mDNS feature. This feature should be defaulted to off as it’s got some unresolved issues.

Is this a build configuration issue?

<!-- gh-comment-id:494513886 --> @bluejekyll commented on GitHub (May 21, 2019): I think this is only needed for the mDNS feature. This feature should be defaulted to off as it’s got some unresolved issues. Is this a build configuration issue?
Author
Owner

@bluejekyll commented on GitHub (May 21, 2019):

Ok, yes. The proto crate should default the reuseport feature to off, and enable it when the mDNS feature is enabled. That should resolve this issue.

<!-- gh-comment-id:494515799 --> @bluejekyll commented on GitHub (May 21, 2019): Ok, yes. The proto crate should default the reuseport feature to off, and enable it when the mDNS feature is enabled. That should resolve this issue.
Author
Owner

@bluejekyll commented on GitHub (May 21, 2019):

See #779 for what I think is the fix.

<!-- gh-comment-id:494519825 --> @bluejekyll commented on GitHub (May 21, 2019): See #779 for what I think is the fix.
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/hickory-dns#290
No description provided.