Hi Chris, Chris Marusich <cmmarus...@gmail.com> skribis:
> l...@gnu.org (Ludovic Courtès) writes: > >> First of all, it’s never been a goal of Guix to run on non-GNU systems. >> Now, I have nothing against it in principle, as long as (1) this can be >> achieved in a maintainable way, and (2) the targeted user-land software >> is free and buildable from source. > > I understand, and I agree with your criteria. > > I don't want to use Guix on macOS to package, promote, or make it easy > to use non-free software. I also don't want to port Guix to macOS in a > way that's difficult to maintain. > > I want users and developers who are currently using macOS to be able to > easily use Guix and all the free software that it provides. To borrow > the language used in the "GNU Emacs FAQ for MS Windows", I hope that the > experience of using GNU Guix on macOS will give programmers a taste of > freedom, and that this will later inspire them to move to a free > operating system such as GNU/Linux (hopefully one that uses Guix, like > GuixSD!) [1]. I think this is a reasonable motivation. Understood. At the same time, one could hope that, if freedom is not enough, the nifty features of GuixSD, GNOME, the GNU toolchain, etc. would be enough of an incentive to switch. But hey, it’s complicated! > Currently, I hope that we can get Guix working on macOS via a plan like > the following: > > 1) On an x86_64-linux GuixSD system, use Guix to cross-build Guix for > the x86_64-darwin target [2]. We would use GNU libc. > > 2) Install the output of (1) on a macOS system, following a procedure > similar to the one in the manual for binary installation ((guix) > Binary Installation). > > Is this plan feasible? In theory, yes. That’s roughly the plan outlined at <https://www.gnu.org/software/guix/manual/html_node/Porting.html>. Now, glibc proper only supports Linux and the Hurd. Debian has a port of glibc to the kernel of FreeBSD (“kFreeBSD”). But AFAIK, these are the only working ports of glibc. Ricardo mentioned a glibc port to Darwin (or XNU?), but I suspect that was very experimental no? So your best bet would be to cross-compile using the macOS libc, similar to what Jan did with MinGW cross-compilation support. But again, this is assuming that the macOS libc is free, and that both that libc and the GNU toolchain support cross-compilation. I don’t know if this is the case. > Please understand that I'm genuinely curious, and I just want to help. > I might be missing some information that's obvious to others. If > there are gaps in my understanding, please help me to fill them. Sure, I understand. It’s a perfectly valid question to ask! > I imagine that there might be other ways to get Guix working on macOS. > Here are some possibilities that I've thought of or that others have > already mentioned: > > * Compile Guix (and its bootstrap binaries, I guess?) natively for > x86_64-darwin on macOS using Xcode, etc. This seems undesirable for > a lot of reasons. Some reasons I can think of are: the build > process would rely on non-free software, it probably wouldn't be > easily reproducible, and it would probably place a significant > additional burden on the Guix maintainers. I suppose the only > saving grace in this case might be that once we had a working Guix > (with bootstrap binaries) for macOS, call it G1, we might be in a > position to use G1 to reproducibly build Guix (with GNU libc) on > macOS going forward. I agree that this is undesirable. :-) > * Run Guix compiled for x86_64-linux on macOS using some kind of a > shim layer. This is pretty vague, but not without precedent: > consider virtual machines, WINE, and similar technologies. This > seems undesirable for a lot of reasons. Some reasons I can think of > are: any solution like this would probably be fragile, and as far as > I know there is no turn-key solution for running ELF executables on > macOS, so we'd have to build our own, and building our own would > entail the same kinds of problems as mentioned in the previous > bullet point. Windows recently gained an in-kernel Linux syscall emulation, which means that (GNU/)Linux binaries can run unmodified on Windows. If macOS had a similar feature, that’d be perfect: we wouldn’t have anything to do. Perhaps Docker-for-Mac actually provides something close to that? I really don’t know. >> I’m afraid this is not the answer you were looking for. WDYT? > > This is exactly what I was hoping for: the start of a discussion! If we > can get Guix working on macOS while meeting the criteria you mentioned, > I think it'd be great for the reasons I mentioned at the start of this > email. If it isn't feasible, then I'd like to understand why. Yes, let’s see! Thanks, Ludo’.