The specific features I am thinking that Autoconf lacks are
Both of these are non essential, but good for various experiments:
This lowers the list down to Meson and CMake, AFIAK. I prefer Meson because:
CC @taktoa
Sadly ninja2nix doesn't really exist -- I tried my best to convert Ninja features into Nix ones using IFD where necessary, but it's just not feasible. If you want to take another crack at it using Recursive Nix, language-ninja is still quite a good library for Ninja-related stuff in Haskell. I think the feature that I couldn't figure out how to compile to IFD was depfile, but I might be mistaken.
@taktoa But meson doesn't use depfile out of an ideological stance against dynamic dependencies / crawling the filesystem. Problem avoided!
So the only Recursive Nix / IFD would be converting the ninja file. Everything inside should be "static Nix".
This lowers the list down to Meson and CMake, AFIAK. I prefer CMake because:
s/I prefer CMake/I prefer Meson/ presumably?
Haha yeah. thanks
I think «Windows support with MinGW» is something Autotools have. Or you could say that one of the goals of MSYS is to support Autotools on Windows with MinGW toolchain (and I would say it generally achieves that).
Indeed it does. But there's also MSVC and Clang/LLVM. The latter now supports the MSVC++ ABI, after Chrome and Firefox have all pushed hard on it. MinGW has a different C++ ABI (last I checked), and so is only a first class solution for C.
I am not sure clang is hard with Autoconf and MSYS. Of course, MSVC is another story (not sure if you actually want to build Nix with it — I agree it is useful for some Windows-only or Windows-first packages).
The only build system rewrite I'm down with is to a Nix-based build ("nix-make"). Anything else seems pretty much a waste of time to me.
IMO nix as a build tool to build nix itself should not be a consideration of any work in the near future. At most it should be a happy accidental benefit
Would Nix-based Nix build process make compiling Nix for the first time on an exotic (Linux-based) platform more annoying?
Yes, I expect so, unless we set up some kind of automatic bootstrapping (but that probably won't be easy).
@vcunat: on the other hand, nix has somewhat better reflection capabilities than many alternatives. Therefore, even where cross-compiling is hard, perhaps it would still be feasible to use nix to calculate a build script suitable for the target platform.
@edolstra: regarding nix-make: have you done any additional thinking on this topic since a few years ago? (e.g., perhaps in light of https://www.microsoft.com/en-us/research/uploads/prod/2018/03/build-systems-final.pdf being published earlier this year?)
So in the imagined Meson (or CMake) + Nix setup, there's really quite little overlap. Most of what Meson does is random domain specific logic for building C/C++ apps. Nix is a perfectly normal C++ program; there's no reason to reinvent the wheel just for Nix-based caching.
@7c6f434c The conventional way to build Windows apps with clang is actually the clang-cl frontend which exposes a MSVC-style instead of GCC-style CLI. I'm not sure the normal GCC-style even exposes all the necessary options.
What's nice about autoconf is it just needs bash & gnumake to work. Meson at least pulls in an entire python runtime. We don't want to add anything more to the "common-path" than we already have:
@matthewbauer
Autoconf should be supported on windows through MSYS.
But GCC doesn't support MSVC C++ ABIs. Many windows APIs are C++, and so I rather unteather us to having to stick to C ones. Who knows how deep we'd have to dig to find the right primitives for sandboxing, for example.
Updated the OP to emphasize this important point.
We don't want to add anything more to the "common-path" than we already have?
I'm confused. This common path sounds like stdenv stuff, but Nix already has non-stdenv library dependencies. Python would just be a build-time dependency, as it is for systemd and other core things that use Meson. Furthermore, if one is really in the pickle, they can stub the build platform in Meson to generate the Ninja files on a different platform than the one where it will be run. (TBH not yet implemented but I think I convinced them to let me do it.)
I can't really think of any reason as to why we would want to support Windows. Windows has a less efficient kernel to do anything interesting on the platform, so it's not fit to do serious computing. So, all you are doing is porting an interesting program (Nix) to a technically inferior platform (HPC community can tell you more), which is going to increase maintenance cost.
Open-source economics imply that the owner of the project needs to see and trust that someone is going to compensate that maintenance cost or it should be made in such a way that it is easy to rip it out when you get hit by a bus or something (assuming nobody else cares about the feature).
Why did you not just fork Nix and make a Windows port dazzling us with numbers on your build system is faster and more portable, etc.? If the code is that good, I am sure it would get merged in.
@coretemp good code with nontrivial trade-offs is quite often not merged, so it _is_ indeed a good idea to have a discussion about limits of likely-to-be-acceptable changes.
@coretemp so no one in this thread loves Autoconf. The consensus opinion out there is that even on Unix alone, CMake or Meson or whatever else is more maintainable (except if you need to support ancient propriety Unix, which we don't.) Now, I wouldn't push for a rewrite for that benefit alone, but certainly it should nullify any argument that a rewrite is going to hurt regular Unix users.
@7c6f434c The code can be perfect at implementing something people don't even want. I just don't let that fall under "good code".
"Good code" solves a problem. Here there is, as you say a trade-off, because it is not going to solve the problem. It trades one set of problems (no Windows support) for less portability. That's the main reason this would be controversial. If it was really " good code", portability, readability, code-size, build-time, would not be impacted along with a whole list of other metrics.
I am pretty sure one could build a simple machine learning model that predicts whether a given implementation design of a feature is going to be controversial or not.
With the cross-compilation topic there was a use case for it, so it got in. If @Ericson2314 wouldn't have done it, someone else would have, because porting nixpkgs is a simple way to popularize a particular cloud vendor on a particular instruction set.
Convincing people that have literally built build-systems to do something controversial is never going to work. That's why my issues come with proper rationalization. It is not necessarily a disadvantage that Windows is not supported, but @Ericson2314 implies that this is the case. Forming a correct argument is key to getting changes you want to see in an open-source project. With the proper motivation, you can even convince others to implement the feature for you, because you have informed them that they can improve their business/life by implementing that feature.
@Ericson2314 I like the autotools including autoconf and @matthewbauer seemed to be supportive of autoconf, but I don't particularly care about what other people think when I know better and I consider democratic decisions a failure. You are just alienating the audience by saying things that just aren't true: There is no consensus that CMake is better than autoconf, not in this thread, and certainly not on the Internet.
There is zero chance of convincing me, but luckily for you, you don't have to. If this would have been my project, you would have received a lot less words. All you need to do is either convince the owner of the project, or to fork. It seems you are having little success with the former.
readability, … would not be impacted along with a whole list of other metrics.
You say «not impacted» as if there are no trade-offs inside readability. I think there is no clear consensus whether various pieces of Perl code in Nixpkgs are readble, or whether they are more readable than natural rewrites into Shell or C… Which basically means that there is no non-controversial metric called «readability».
less portability
Where can't Python run that anyone cares about? The original author may not love Python either, but choose it specifically for build-time portability http://mesonbuild.com/FAQ.html#why-is-meson-implemented-in-python-rather-than-programming-language-x
I agree with @7c6f434c. Any opinionated metric will just flood this thread. The facts are:
compile_commands.json which can be used by IDEs/editors/code analsys to figure out how to compile code(relevant for users that have to compile meson themselves)
I believe you mean Nix itself, haha. But great list!
Maybe the thing to so is just do the conversion in a PR, and let people try out those sweet fast rebuilds for themselves.
I would not recommend to do that without any blessing from the Nix core team as empirically this could be wasted effort.
Update this was not meant as critic I just wanted to avoid frustration upfront.
@7c6f434c Yes, you picked out one metric that has no consensus. The rest of the argument still applies.
@Mic92 Creates his own independent argument (with some relevant information, so that's good), but it does not and cannot address the portability side of the equation.
@Ericson2314 Just ignores the portability side of the argument, which is generally not a good way to convince people. And then he alludes to the designers of Meson as if they are an authority :rofl:.
Ok, just for completeness.
Build time. This is not a single metric but a trade-off, because some ways to get better CPU utilisation for the actual compile can make storage unhappy.
Portability. This is a trade-off, because you need to assign weights to Windows support, OpenBSD support and Linux-on-exotic-CPU support. I wonder if «probability of surviving Apple SDK update» is also a possible part of the portabilty trade-off.
Code-size — is it token count (depending on the parser some things might count or not, so it is not a single objective metric) that ignores cyclomatic complexity? Also, if there is a feature (or platform support) improvement, you won't get a consensus that code size is not allowed to increase.
PS. Speaking of portability — significantly editing GitHub comment after initial creation is not too portable, because it breaks email notifications with high probability. And rendering a GitHub page requires a larger client-side codebase than just handling an email.
@Mic92 to be clear I was going to make the PR not out of stubbornness, but because I also want to do the windows experiments I deem blocked on this.
@Ericson2314 I never doubt that.
Started working on a meson version here in https://github.com/NixOS/nix/pull/2613
Please don't make Nix depend on nix-make; doing so would make bootstrapping a raw from-source build of Nix significantly more complicated, and we'd have to continue to maintain all of the autotools build scripts for that purpose. This is not just a considerations for "exotic linux distros" but also for standard Debian or CentOS packaging as well, and a thorn in the side of initiatives like https://reproducible-builds.org/ that are trying to build everything from source with as few pre-built binaries as possible.
I can understand @NixOS/nix-core not wanting to spend their time shaving the build-system yak. Autotools seems to be doing OKish as it is, but if @Ericson2314 wants to do it it seems like a nice thing for the community and I hope it gets a serious review/consideration! Either cmake or meson would be faster to compile, have better error messages, and support things like clang compilation databases for YCM and other LLVM tools. Modern C++ build system tooling has come a long way in the last decade and it'd be nice to take advantage of it!
Most helpful comment
compile_commands.jsonwhich can be used by IDEs/editors/code analsys to figure out how to compile code