Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Rework scope + building libc #298849

Merged
merged 2 commits into from
May 12, 2024

Conversation

rhelmot
Copy link
Contributor

@rhelmot rhelmot commented Mar 25, 2024

Description of changes

This PR depends on #298717, however it is a little big so I would like to get started on reviews now.

This reworks the building of packages based on the FreeBSD source tree in order to support choosing a source branch. It adds the bare minimum number of packages to be able to cross compile the FreeBSD libc (pkgsCross.x86_64-freebsd.freebsd.libc), and it removes the major version number from the target tuple, as per prior discussion.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
    • x86_64-freebsd
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@Mic92
Copy link
Member

Mic92 commented Mar 25, 2024

Part of #296581

@alyssais
Copy link
Member

Please explain the reasons for changes in commit messages, not just the PR body, in as much detail as you can. For core changes like this, it's really important to be able to look back and understand why things are the way they are, when there's a need to change them later.

It adds the bare minimum number of packages to be able to cross compile the FreeBSD libc (pkgsCross.x86_64-freebsd.freebsd.libc)

I'm a bit confused by this, because this attribute already builds for me?

@Ericson2314
Copy link
Member

Ericson2314 commented Mar 25, 2024

The build just failed for me with

/build/xinstall-bootstrap-filtered-src/lib/libnetbsd/sha2.h:38:10: fatal error: sha384.h: No such file or directory

I definitely like the by-name thing! I wonder if it makes sense to do that separately, without any semantic changes.

@Ericson2314 Ericson2314 changed the base branch from staging to master March 25, 2024 12:14
@Ericson2314 Ericson2314 changed the base branch from master to staging March 25, 2024 12:14
@Ericson2314
Copy link
Member

I definitely like the by-name thing! I wonder if it makes sense to do that separately, without any semantic changes.

I might actually take a stab at this, to help things along.

@ofborg ofborg bot added 2.status: merge conflict This PR has merge conflicts with the target branch ofborg-internal-error Ofborg encountered an error and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 25, 2024
@Ericson2314
Copy link
Member

#299347 OK an here it is. This should be a much simpler diff on top :).

@Ericson2314
Copy link
Member

#299347 is now, merged, and I did a crude rebase on top

@Ericson2314 Ericson2314 force-pushed the freebsd-minimal2/fblibc branch 8 times, most recently from d48664c to 0798558 Compare May 6, 2024 21:07
@Ericson2314 Ericson2314 marked this pull request as ready for review May 6, 2024 21:07
@Ericson2314
Copy link
Member

OK the diff has been minimized in a number of ways. The question to @alyssais, @rhelmot and @artemist are:

  1. Do we drop 13.0 and just do 14.0?
  2. If so, can we get rid of all the hostVersion checks?

@rhelmot
Copy link
Contributor Author

rhelmot commented May 6, 2024

I was actually working on simplifying this last night and then I woke up and you were messing with this branch! I would like to keep 13 support, but I can simplify it to just the major version as a differentiator and not any minor versions.

@Ericson2314
Copy link
Member

@rhelmot sorry for the belated response! Yeah if you have use for 13, then sure that plan sounds good. Just wanted to be clear that I don't care about 13 / don't think because Nixpkgs was doing 13 Nixpkgs is insisting on supporting 13.

@Ericson2314
Copy link
Member

I hope resurrecting your work simplifying after my rebasing and things will not be too hard :)

@rhelmot rhelmot force-pushed the freebsd-minimal2/fblibc branch from 433a5b6 to c445839 Compare May 10, 2024 18:03
@rhelmot
Copy link
Contributor Author

rhelmot commented May 10, 2024

I came up with one last simplification in order to improve the portability of the nixpkgs code across FreeBSD versions. The rationale and usage are in the most recent commit message.

@Ericson2314
Copy link
Member

Ericson2314 commented May 10, 2024

@rhelmot do you want to undo my deleting the version 13 patches? Also see the formatter failure --- I made formatting required for all things BSD recently.

@rhelmot
Copy link
Contributor Author

rhelmot commented May 10, 2024

Yes, I didn't realize that was easily revertable.

Could you explain how to run the formatter? I looked on the nixpkgs-fmt repo but couldn't find anything.

@Ericson2314
Copy link
Member

(messaged in #exotic:nixos.org answering)

@rhelmot rhelmot force-pushed the freebsd-minimal2/fblibc branch from c445839 to f7d1442 Compare May 11, 2024 22:00
@rhelmot
Copy link
Contributor Author

rhelmot commented May 11, 2024

There are no more changes I want to make before merge. Review time!

@rhelmot rhelmot force-pushed the freebsd-minimal2/fblibc branch from 7a38218 to 6ecc99b Compare May 11, 2024 23:10
artemist and others added 2 commits May 11, 2024 21:52
* Extend libc

  Include non-libc core libraries in the libc package. Many of these
  mirror libraries present in glibc on linux, such as libgcc, libraries
  used for iconv, and libraries used for reading kernel info (libkvm,
  libprocstat, libmemstat).

  Without this many packages outside the freebsd tree would need to be
  modified to include standard dependencies which would already be on
  the system for other packages.

* Mark FreeBSD as using LLVM

* Update default LLVM version FreeBSD

* Use patch monolith

  The patchesRoot system combined with the fact that each derivation
  will Request specific names of patches makes it very annoying to use
  other FreeBSD source trees with nixpkgs. This new system allows
  providing one Or more entire trees of patches whose contents will be
  dynamically Parsed and only the relevant patches will be applied for
  any one Derivation.

  With this commit, the following knobs are available for specifying the
  FreeBSD source:

  - overriding `freebsd.versionInfo`, for picking another official
    supported FreeBSD release.

  - overriding `freebsd.source` for specifying a specific unpatched
    FreeBSD source tree.

  - overriding `freebsd.patches`, for specifying the patches to apply.

Co-Authored-by: Audrey Dutcher <[email protected]>
Co-Authored-by: John Ericson <[email protected]>
The old patches are kept because the version is actually configurable.
In the future both versions may be exposed.

Co-Auhtored-By: Artemis Tosini <[email protected]>
Co-Authored-by: John Ericson <[email protected]>
@Ericson2314 Ericson2314 force-pushed the freebsd-minimal2/fblibc branch from 6ecc99b to 2cc214b Compare May 12, 2024 01:52
@Ericson2314
Copy link
Member

Ericson2314 commented May 12, 2024

Looks great!! I just read redid the history but kept the final contents. So merging.

(6ecc99b14640c75d1cff45e6a54dca4d7d040905: == 2cc214b:)

@Ericson2314 Ericson2314 merged commit f8dff35 into NixOS:master May 12, 2024
7 of 8 checks passed
@Ericson2314 Ericson2314 deleted the freebsd-minimal2/fblibc branch May 12, 2024 01:56
@cole-h cole-h removed the ofborg-internal-error Ofborg encountered an error label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: bsd Running or building packages on BSD 6.topic: lib The Nixpkgs function library 10.rebuild-darwin: 101-500 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants