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
Build failure: limine #304746
Comments
I can't reproduce the failure by running edit: I have no issues building Limine from a release tarball manually on my M1 MBA running macOS 14.0, llvm 17.0.6, nasm 2.16.02, GNU mtools 4.0.43 and GNU make 4.4.1 |
yeah, so if the regular llvmPackages can target multiple triplets, while the one used in pkgsCross targets just one. I guess the solution would be to build for just a single arch depending on target host |
I did a bit more research into building Limine's tools, the |
I made a modded version of the package for only x86_64 UEFI and x86 BIOS: {
pkgs ? import <nixpkgs> { },
# Helpers
stdenv ? pkgs.stdenv
, fetchurl ? pkgs.fetchurl
, lib ? pkgs.lib
, # Dependencies
llvmPackages ? pkgs.llvmPackages
, mtools ? pkgs.mtools
, nasm ? pkgs.nasm
}:
let
version = "7.3.1";
in
# The output of the derivation is a tool to create bootable images using Limine
# as bootloader for various platforms and corresponding binary and helper files.
stdenv.mkDerivation {
inherit version;
pname = "limine";
# We don't use the Git source but the release tarball, as the source has a
# `./bootstrap` script performing network access to download resources.
# Packaging that in Nix is very cumbersome.
src = fetchurl {
url = "https://github.com/limine-bootloader/limine/releases/download/v${version}/limine-${version}.tar.gz";
sha256 = "sha256-xlOBBb281W9QT5Fv2Hgw/eyh7K3oyaNY1yU6WktbFro=";
};
nativeBuildInputs = [
llvmPackages.bintools
# gcc is used for the host tool, while clang is used for the bootloader.
llvmPackages.clang
llvmPackages.lld
mtools
nasm
];
configureFlags = [
"--enable-bios-cd"
"--enable-uefi-x86_64"
];
installFlags = [ "destdir=$out" "manprefix=/share" ];
outputs = [ "out" "doc" "dev" "man" ];
meta = with lib; {
homepage = "https://limine-bootloader.org/";
description = "Limine Bootloader";
# Caution. Some submodules have different licenses.
license = [
licenses.bsd2 # limine, flanterm
licenses.bsd0 # freestanding-toolchain, freestanding-headers
licenses.asl20 # cc-runtime
licenses.mit # limine-efi, stb
licenses.zlib # tinf
];
# The platforms on that the Liminine binary and helper tools can run, not
# necessarily the platforms for that bootable images can be created.
platforms = platforms.unix;
maintainers = [
maintainers._48cf
maintainers.phip1611
];
};
} Trying to build with this on macOS + Rosetta 2 (so x86_64 Nix packages are included as well as aarch64), and now I'm getting errors from lld about unknown arguments. https://gist.github.com/T-O-R-U-S/51c181c1aacd2acc45759f3eee11929f |
When I added the derivation to nixpkgs, I decided to use --enable-all with the intention to create a Bootable image on a x86_64 platform that boots on all platforms. I think this is a valid use case, especially if you are creating an EFI application with Rust that you easily can compile for x86, aarch64, and riscv. You can embed this into a Limine iso and add legacy boot capabilities additionally into that image. Hence, I'd like to see the host tools being build for the host architecture but the bootloader files for all architectures. Unfortunately, I don't have an aarch64 or riscv system to that the build.. We might could add a condition to the derivation: if x86_64 we build for all platforms, if we build on another architecture, we only build what the toolchain provides. |
I'd personally disagree and argue that we should try to keep nix packages as similar as possible across all platforms to keep with consumer expectation of replicability, so keeping Here is a useful article section I found on the OSDev wiki, as it points out probably the exact problem we're having.
I think this is why I'm getting all the incorrect argument errors -- by default, the wrong linker is being used because Apple just loves replacing the standard solution with their own home-grown garbage. 🙃 |
FYI: In 26b947c someone removed darwin as platform. |
Steps To Reproduce
Steps to reproduce the behavior:
nix-build https://github.com/NixOS/nixpkgs/archive/master.tar.gz --attr limine
(behaviour is the same when trying tonix-shell -p limine
)Build log
https://gist.github.com/T-O-R-U-S/0ed1610aeb91216fd688153d67799940
Additional context
It asks for a RISC-V compiler because the package is configured with the
--enable-all
flag, so it fails to compile if any architecture is missing. Can be worked around by just enabling it for the platform that you are targeting, so long as that isn't RISC-V...P.S: I only tried with the
--enable-x86_64
flag, and it seems to compile alright with that, but not with RISC-V.Notify maintainers
@48cf
@phip1611
Thank you.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: