-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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 packages: Init at 13.1 #82131
Conversation
I dropped link to this in https://forums.freebsd.org/threads/can-i-compile-a-freebsd-kernel-from-linux.64582/, a that is vaguely relevant. |
OK need to fix makefiles or bmake itself so non-default system rules |
# versions. That means that putting in the version as part of the | ||
# config string is paramount. | ||
freebsd12 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 12; }; | ||
freebsd13 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 13; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC Nix's configure script makes a point of stripping version information from system doubles, so it might be impossible to get such a double as builtins.currentSystem
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You and @alyssais should work that out :) I am not sure what is more correct. If what we have is more correct, that is fine with me we can worry about native compilation later! :D
(i.e. system
s that builtins.currentSystem
would never produce are not a problem for cross compilation only,)
The libc will be inferred.
A tricky thing about FreeBSD is that there is no stable ABI across versions. That means that putting in the version as part of the config string is paramount. We have a parsed represenation that separates name versus version to accomplish this. We include FreeBSD versions 12 and 13 to demonstrate how it works.
Always set `SRCTOP`, set it with abs path llvmPackages: Bump minimum version for FreeBSD llvmPackages_*, libgcc, compiler_rt: Hack in enough libs that one can compiler C freebsd.compat: Rename some things to work around cc-wrapper change 0bea4a1 / NixOS#191724 in particular
abad155
to
0afe9d1
Compare
Hi, firstly thank you for all the effort that was put into this MR ! unfortunately when i try
I get
can someone double check that this builds for others ? just so I know if there is something with my setup |
hi, actually i found the answer, something is broken with ssl on master, i've rebuild my nixos from previous well known configuration and now it seems to be building |
Is c++ known to work? I just tried cross-compiling patchelf in the patchelf repo and got this:
|
Finally this is merged |
@Mic92 I built zstd and it worked so some C++ does, I thought. |
This pr just adds cross compilation support right? Or does it also add support for building the FreeBSD kernel on FreeBSD in case you get nix running there? |
@9glenda only cross compilation support, but I did cross compile the kernel too! |
My next stop would try to be NetBSD and FreeBSD in https://github.com/cleverca22/not-os. I think just using Nix on stock FreeBSD will actually be harder because modern FreeBSD once to mandate that all syscalls go through the same userland libc --- either we rebuild the entire userland with Nix, or we do impurities. |
It seems that with certain c++ features (i.e. c++17), you need libunwind linked as well. This is what I added for patchelf to get it working:
Probably the macOS version already has something implemented? |
@@ -156,7 +156,7 @@ let | |||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags | |||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' | |||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags | |||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' | |||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mic92 I guess changes like this are adding the problem? But it also didn't work without. Hmm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems wrong as we are doing useLLVM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well forcing -lunwind
is a sledgehammer I am skeptical enough, and it was causing failures even if its absense was also causing failures. I think it would be good to figure out why this was needed in the first place.
See NixOS#194634 for details. PRs: - NixOS#191372 - NixOS#190936 - NixOS#82131 - NixOS#199844 - NixOS#197674 - NixOS#184408 - NixOS#193004
See NixOS#194634 for details. PRs: - NixOS#191372 - NixOS#190936 - NixOS#82131 - NixOS#199844 - NixOS#197674 - NixOS#184408 - NixOS#193004
See NixOS#194634 for details. PRs: - NixOS#191372 - NixOS#190936 - NixOS#82131 - NixOS#199844 - NixOS#197674 - NixOS#184408 - NixOS#193004
See NixOS#194634 for details. PRs: - NixOS#191372 - NixOS#190936 - NixOS#82131 - NixOS#199844 - NixOS#197674 - NixOS#184408 - NixOS#193004
See NixOS#194634 for details. PRs: - NixOS#191372 - NixOS#190936 - NixOS#82131 - NixOS#199844 - NixOS#197674 - NixOS#184408 - NixOS#193004
Motivation for this change
Have working
Running out of memory as NetBSDmakeMinimal
fails to build. Weird, know what's up @matthewbauer?Oh netbsd make is cached, duh, this is freebsd libc itself.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)CC @wahjava