Live data from Hacker News

Show HN: I built a Cargo-like build tool for C/C++

github.com

31–40 of 181 posts

Re: Show HN: I built a Cargo-like build tool for C/C++

#32

The least painful C/C++ build tool I've used is xmake https://github.com/xmake-io/xmake The reason why I like it (beyond ease-of-use) is that it can spit out CMakeLists.txt and compile_commands.json for IDE/LSP integration and also supports installing Conan/vcpkg libraries or even Git repos. set_project("myapp") set_languages("c++20") add_requires("conan::fmt/11.0.2", {alias = "fmt"}) add_requires("vcpkg::fmt", {alia…

Agreed, xmake seems very well-thought-out, and supports the most modern use-cases (C++20 named modules, header unit modules, and `import std`, which CMake still has a lot of ceremony around). I should switch to it.

Re: Show HN: I built a Cargo-like build tool for C/C++

#33
post #26

Anyone can make a tool that solves a tiny part of the problem. however the reason no such tool has caught on is because of all the weird special cases you need to handle before it can be useful. Even if you limit your support to desktop: OS/X and Windows that problem will be hard, adding various linux flavors is even more difficult, not to mention BSD. The above is the common/mainstream choices, there Haiku is going…

I will categorize this as a pattern I've seen which leads to stagnation, or is at least aiming for it. Usually these are built on one or more assumption which doesn't hold. The flow of this pattern:

  - Problem exists
  - Proposals of solutions, (varying quality), or not
  - "You can't just solve this. It's complicated! This problem must exist". (The post I'm replying to
  - Problem gets solved, hopefully.
Anecdotes I'm choosing based on proximity to this particular problem: uv and cargo. uv because people said the same thing about python packaging, and cargo because its adjacent to C and C++ in terms of being a low-level compiled language used for systems programming, embedded/bare-metal etc.

The world is rich in complexity, subtlety, and exceptions to categorization. I don't think this should block us from solving problems.

Re: Show HN: I built a Cargo-like build tool for C/C++

#34
post #30
post #20

Uses CMAKE, Sorry not for me. Call me old but i prefere good old make or batch. Maybe it's because i can understand those tools. Debugging CMAKE build problems made me hate it. Also i code for embedded CPU and most of the time CMAKE is just overkill and does not play well the compiler/binutils provided. The Platform independency is just not happening in those environments.

For simple projects. Make is easier for simple things I will grant. However when your projects gets complex at all make becomes a real pain and cmake becomes much easier. Cmake has a lot of warts, but they have also put a lot of effort into finding and fixing all those weird special cases. If your project uses CMake odds are high it will build anywhere.

Odds are high the distro maintainer will lose hair trying to package it

Re: Show HN: I built a Cargo-like build tool for C/C++

#36
If you think cmake isn't very good, the solution isn't to add more layers of crap around cmake, but to replace it. Cmake itself exists because a lot of humans haven't bothered to read the gnu make manual, and added more cruft to manage this. Please don't add to this problem. It's a disease

Re: Show HN: I built a Cargo-like build tool for C/C++

#37

Earlier quoted context omitted.

My thoughts exactly. I thought this was going to be some new thing, but it's just yet another reason that I'll stick with Makefiles.

Do your Makefiles work across Linux, macOS and Windows (without WSL or MingW), GCC, Clang and MSVC, or allow loading the project into an IDE like Xcode or Visual Studio though? That's why meta-build-systems like cmake were created, not to be a better GNU Make.

There is something fundamentally wrong with Windows or Visual Studio that it requires ugly solutions.

Re: Show HN: I built a Cargo-like build tool for C/C++

#38
post #36

If you think cmake isn't very good, the solution isn't to add more layers of crap around cmake, but to replace it. Cmake itself exists because a lot of humans haven't bothered to read the gnu make manual, and added more cruft to manage this. Please don't add to this problem. It's a disease

As much of a dog as cmake is, "just use make!" does not solve many of the problems that cmake makes a go at. It's like saying go write assembler instead of C because C has so many footguns.

Re: Show HN: I built a Cargo-like build tool for C/C++

#39
post #10

The installation instructions being a `curl | sh` writing to the user's bashrc does not inspire confidence.

I don’t love this approach either (what a security nightmare…) - but it is easy to do for users and developers alike. Having to juggle a bunch of apt-like repositories for different distros is a huge time sink and adds a bunch of build complexity. Brew is annoying with its formulae vs tap vs cask vs cellar - and the associated ruby scripting… And then there’s windows - ugh.

I wish there was a dead simple installer TUI that had a common API specification so that you could host your installer spec on your.domain.com/install.json - point this TUI at it and it would understand the fine grained permissions required, handle required binary signature validation, manifest/sbom validation, give the user freedom to customize where/how things were installed, etc.

Re: Show HN: I built a Cargo-like build tool for C/C++

#40
post #20

Uses CMAKE, Sorry not for me. Call me old but i prefere good old make or batch. Maybe it's because i can understand those tools. Debugging CMAKE build problems made me hate it. Also i code for embedded CPU and most of the time CMAKE is just overkill and does not play well the compiler/binutils provided. The Platform independency is just not happening in those environments.

> most of the time CMAKE is just overkill and does not play well the compiler/binutils provided

You need to define a CMake toolchain[1] and pass it to CMake with --toolchain /path/to/file in the command-line, or in a preset file with the key `toolchainFile` in a CMake preset. I've compiled for QNX and ARM32 boards with CMake, no issues, but this needs to be done.

[1]: https://cmake.org/cmake/help/latest/manual/cmake-toolchains....

Post reply on HN