The which_freebsd detection is cross-compilation unfriendly
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 69
Description
The detection of freebsd version invokes a freebsd-version executable:
https://github.com/rust-lang/libc/blob/5f7c6c1ef93ff4fcfa3d767aac93c2b261c8f140/build.rs#L122-L123
however that only meaningfully works when building on a freebsd host. When building on any other host and targeting a freebsd, libc will always default to targeting a freebsd11.0:
https://github.com/rust-lang/libc/blob/5f7c6c1ef93ff4fcfa3d767aac93c2b261c8f140/build.rs#L26-L34
Thus making it difficult to e.g.
- Cross-compile a library or binary that relies on freebsd12.0 or freebsd13.0 APIs;
- CI test other libraries that rely on freebsd12.0 or freebsd13.0 APIs.
Note that adding a freebsd-version executable to the path is not a very viable solution – some builds running in parallel may target other versions of freebsd too.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in build.rs at the linked FreeBSD version detection and follow how target versions are chosen when the host is not FreeBSD. Determine how cross-compilation can select FreeBSD 12.0 or 13.0 APIs without relying on a shared freebsd-version executable; done means those targets can be selected reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100