6 ms·
I think one of the biggest issues for adoption will be the Bazel build system. The C++ world seems to be slowly standardizing on CMake. Having to use another bu
by RcouF1uZ4gsC 9y ago
I think one of the biggest issues for adoption will be the Bazel build system. The C++ world seems to be slowly standardizing on CMake. Having to use another build system to incorporate this library will give people second thoughts about incorporating this library.
- 0xbear 9y agoBazel is not just a build system though. It’s also dependency management system, parallel test system, cross language build system, cross platform build system, and a bunch of other things, with build file syntax a 10 year old could learn in an hour. Some of those things you could plausibly do with CMake, but a lot more effort. Once you learn how to use it (which doesn’t take long) Bazel is pretty darn nice.
- mikepurvis 9y agoNonetheless, Bazel is very much set up for Google's mentality of building giant static binaries from head and shipping them off to a server somewhere, where they'll be replaced in two weeks with the next release, and then never thought of again. There's some software out here in the world that works like that, but most of it doesn't. In any case, CMake is _also_ a dependency management system, but works with libraries in the way that they are shipped on a typical Linux distribution. It lets you find common stuff easily, and has multiple extension points in terms of adding support for new libraries. CMake itself can ship your find module, the library you're linking against can ship it, or you can ship it yourself.
- justicezyx 9y agoTrend wise, applications are expanding more and more into controlling its whole life-cycle from binary to deployment. Repeatable build Containers VM Unikernels Standardized libraries There are other means to share build artifacts or code across language boundary, not necessarily through availability from OS distros. For example, Docker registry solves this issue with container images and overlay FS. I think one way or another, Google's model has been proven to work for large-scale (probably the largest C++ code base on earth) c++ code base. In that I have my full confidence of adopting Google's proven approach. disclaimer: Work at google, but not the c++ team
- vvanders 9y ago> Trend wise, applications are expanding more and more into controlling its whole life-cycle from binary to deployment. Repeatable build Containers VM Unikernels Standardized libraries Maybe in the cloud, however that's only a portion of where you see C++ deployed. For embedded systems(where C & Rust are the only other options) I don't see it going this way anytime soon.
- jopsen 9y agoRepeatable builds are pretty universally desirable, why wouldn't you want it for embedded systems? It seems pretty important for security, etc.. Note: Rust and cargo.lock files another example of things going in this direction.
- jsolson 9y agoAren't embedded systems already there? What is a firmware blob if not a monolithic static build artifact? Bazel is perfect for this. I recently taught it how to build boot images for Xilinx FPGAs including a bitstream, first stage bootloader, kernel, and initial ramdisk, all hermetically built and bottled up into a boot.bin. I can reproduce my firmware from source control and get out the same bits. How neat is that?
- 0xbear 9y agoSpeaking of which, any possibility of open sourcing this? We are looking to get into FPGAs and would rather not reinvent a bicycle.
- jsolson 9y agoYes. It's a little complicated as I did it for a personal project, but I'm also pulling it into Google for my 20% project. It is by FAR easier/faster for me to release under Google's copyright, but there's a bit of "paperwork" I need to go through to get it staged and approved for the Google GitHub. Since it seems there's interest I'll take a stab at that on Monday. It usually takes a week or two, but no promises. I don't anticipate any blocking issues, though, as the bazel bits don't expose anything about Google. One caveat -- as released it won't quite be bitwise hermetic, as it depends on an external Xilinx toolchain, and Xilinx does non-hermetic things to their bits that are awkward to work around (you can, but my code to do that is a much less mature shell script full of dd and cat commands to rip apart bitstreams and glue them back together -- I've since found open source tooling for accomplishing the same task, but haven't adopted it yet). Drop me an email (addr in profile) and I'll tell you when it's up.
- krona 9y ago> Once you learn how to use it (which doesn’t take long) Bazel is pretty darn nice. I've spent a few hundred hours integrating bits of CMake build scripts in to various Bazel builds. If you're doing something which is explicitly catered for by Bazel itself then it works well, so long as you avoid the bugs. Otherwise, you'll have to confront the hermetic build abstractions which prevent otherwise simple operations. Bazel toolchain files are just as bad as CMake, if not worse. I'll give Bazel another try in a few years. For now, I still prefer CMake+Ninja, worts and all.
- 0xbear 9y agoHermetic is good though. Hermetic means reproducible.
- krona 9y agoUse Docker?
- 0xbear 9y agoBazel is on its way to be more like Google’s internal implementation: distributed builds, object file cache, distributed tests. That means your C++ build and test runs will take barely any time at all, same as they do at Google. That, in turn, enables the kind of velocity unachievable through other means.
- dekhn 9y agoI'm sorry but, "bwahahahha". C++ build and test times at Google are astronomical. It's one of the reasons go exists: they built it to compile and link faster.
- 0xbear 9y agoIf a minute to build and link half a million lines of C++ is “astronomical”, then sure. Try to build that on your local box, then get back to me. Go exists solely because Rob Pike had nothing better to do, and a lot of googlers hate Java.
- haberman 9y agoHi there, I work at Google on the Protocol Buffers team. The Abseil team will soon be adding CMake support (and automake, I hope). We need this for Protocol Buffers, which currently supports CMake and automake.
- shahms 9y agoWhy would you wish maintenance of either of those things on your coworkers?
- haberman 9y agoAs grandparent illustrates, this matters to users. So it matters to me too.
- shahms 9y agoAs one of your users, I'd really like to stop maintaining our own BUILD files for proto :-)
- haberman 9y agoI don't follow what you are saying. Protobuf has a BUILD file: https://github.com/google/protobuf/blob/master/BUILD https://github.com/google/protobuf/blob/master/BUILD Do you mean something else? A GitHub issue might be a better place for this discussion.
- packetslave 9y agoAs another of your users, I really wish the proto_library BUILD rules were open-source :-)
- DannyBee 9y agoIf you feel like you are missing implicit dependencies on building haskell in your project, you could always just add it.
- weberc2 9y agoCMake is the biggest reason I left C++ for Rust (there are others, of course), which is a shame because I actually came to like modern C++ (after years of using it). I just don't have time to maintain a complex build program (in a crappy, slow language to boot) when Cargo just works out of the box.
- pjmlp 9y agoCargo still doesn't work out of the box for linking against binary libraries. That, alongside the lack of incremental compiler and linking, means my C++ work projects (native libraries for Java and .NET) actually do compile much faster than Rust occasional weekend projects.
- weberc2 9y agoLooks like incremental compilation hit beta in Feb: https://internals.rust-lang.org/t/incremental-compilation-beta/4721 https://internals.rust-lang.org/t/incremental-compilation-be... For me it's just fine that cargo doesn't support every odd use case of of the box in exchange for supporting the majority of use cases with virtually no effort. CMake hardly supports anything without a bunch of scripting--this includes reproducible builds, unit testing, etc.
- malkia 9y agoI think the opposite - the descriptive language of bazel (buck, pants, build.gn and others too) is the key feature. I haven't seen anything that comes so close to defining in very precise, and clean manner your exact dependencies across multiple build platforms. It is a foreign lang for folks used to MSBuild, .vcxproj/.sln, etc. - like the debug/release, or CRT options are not right away visible (just saw a commit 15-20 hrs ago in bazel to support dynamic CRT linking), but I'm sure this is coming.
- vvanders 9y agoMy experience has been anything but positive in those systems. I spent ~3 hours trying to get build.gn to work for a "non-googler" config to build Chromium, gave up on it. Ditto Buck, hit some random dependency issue and would fail to run. Honestly CMake gets a lot of hell but it's the only one I've seen work wide-scale. Short of a greenfield implementation (like say Rust's package manager) I don't think you'll do much better in C++.
- erichocean 9y agoI freaking LOVE Bazel. Convert every library I use from CMake to Bazel on first use. Fork + BUILD and you're good to go.