4/9/2026 at 5:46:39 PM
Feedback of someone who is used to manage large (>1500) software stack in C / C++ / Fortran / Python / Rust / etc:- (1) Provide a way to compile without internet access and specify the associated dependencies path manually. This is absolutely critical.
Most 'serious' multi-language package managers and integration systems are building in a sandbox without internet access for security reasons and reproducibility reasons.
If your build system does not allow to build offline and with manually specified dependencies, you will make life of integrators and package managers miserable and they will avoid your project.
(2) Never ever build in '-03 -march=native' by default. This is always a red flag and a sign of immaturity. People expect code to be portable and shippable.
Good default options should be CMake equivalent of "RelWithDebInfo" (meaning: -O2 -g -DNDEBUG ).
-O3 can be argued. -march=native is always always a mistake.
- (3) Allow your build tool to be built by an other build tool (e.g CMake).
Anybody caring about reproducibility will want to start from sources, not from a pre-compiled binary. This also matter for cross compilation.
- (4) Please offer a compatibility with pkg-config (https://en.wikipedia.org/wiki/Pkg-config) and if possible CPS (https://cps-org.github.io/cps/overview.html) for both consumption and generation.
They are what will allow interoperability between your system and other build systems.
- (5) last but not least: Consider seriously the cross-compilation use case.
It is common in the world of embedded systems to cross compile. Any build system that does not support cross-compilation will be de facto banned from the embedded domain.
by adev_
4/9/2026 at 10:26:19 PM
As someone who has also spent two decades wrangling C/C++ codebases, I wholeheartedly agree with every statement here.I have an even stronger sentiment regarding cross compilation though - In any build system, I think the distinction between “cross” and “non-cross” compilation is an anti-pattern.
Always design build systems assuming cross compilation. It hurts nothing if it just so happens that your host and target platform/architecture end up being the same, and saves you everything down the line if you need to also build binaries for something else.
by Teknoman117
4/9/2026 at 11:20:47 PM
> In any build system, I think the distinction between “cross” and “non-cross” compilation is an anti-pattern.This is one of the huge wins of Zig. Any Zig host compiler can produce output for any supported target. Cross compiling becomes straightforward.
by bsder
4/10/2026 at 7:23:33 AM
Agree with the feedback.Also the problem isn't creating a cargo like tool for C and C++, that is the easy part, the problem is getting more userbase than vcpkg or conan for it to matter for those communities.
by pjmlp
4/9/2026 at 8:41:11 PM
> Never ever build in '-03 -march=native' by default. This is always a red flag and a sign of immaturity.Perhaps you can see how there are some assumptions baked into that statement.
by CoastalCoder
4/9/2026 at 8:56:25 PM
What assumptions would that be?Shipping anything built with -march=native is a horrible idea. Even on homogeneous targets like one of the clouds, you never know if they'll e.g. switch CPU vendors.
The correct thing to do is use microarch levels (e.g. x86-64-v2) or build fully generic if the target architecture doesn't have MA levels.
by eqvinox
4/9/2026 at 10:16:23 PM
I build on the exact hardware I intend to deploy my software to and ship it to another machine with the same specs as the one it was built on.I am willing to hear arguments for other approaches.
by tempest_
4/9/2026 at 10:39:33 PM
Not the OP, but: -march says the compiler can assume that the features of that particular CPU architecture family, which is broken out by generation, can be relied upon. In the worst case the compiler could in theory generate code that does not run on older CPUs of the same family or from different vendors.-mtune says "generate code that is optimised for this architecture" but it doesn't trigger arch specific features.
Whether these are right or not depends on what you are doing. If you are building gentoo on your laptop you should absolutely -mtune=native and -march=native. That's the whole point: you get the most optimised code you can for your hardware.
If you are shipping code for a wide variety of architectures and crucially the method of shipping is binary form then you want to think more about what you might want to support. You could do either: if you're shipping standard software pick a reasonable baseline (check what your distribution uses in its cflags). If however you're shipping compute-intensive software perhaps you load a shared object per CPU family or build your engine in place for best performance. The Intel compiler quite famously optimised per family, included all the copies in the output and selected the worst one on AMD ;) (https://medium.com/codex/fixing-intel-compilers-unfair-cpu-d...)
by zahllos
4/9/2026 at 10:21:19 PM
I'm willing to hear arguments for your approach?it certainly has scale issues when you need to support larger deployments.
[P.S.: the way I understand the words, "shipping" means "passing it off to someone else, likely across org boundaries" whereas what you're doing I'd call "deploying"]
by eqvinox
4/10/2026 at 5:29:45 AM
So, do you see now the assumptions baked in your argument?> when you need to support larger deployments
> shipping
> passing it off to someone else
by teo_zero
4/10/2026 at 5:39:17 AM
Just popping in here because people seem to be surprised by> I build on the exact hardware I intend to deploy my software to and ship it to another machine with the same specs as the one it was built on.
This is exactly the use case in HPC. We always build -march=native and go to some trouble to enable all the appropriate vectorization flags (e.g., for PowerPC) that don't come along automatically with the -march=native setting.
Every HPC machine is a special snowflake, often with its own proprietary network stack, so you can forget about binaries being portable. Even on your own machine you'll be recompiling your binaries every time the machine goes down for a major maintenance.
by eslaught
4/10/2026 at 7:25:11 AM
So I get you don't do neither cloud, embedded, game consoles, mobile devices.Quite hard to build on the exact hardware for those scenarios.
by pjmlp
4/10/2026 at 1:50:42 AM
On every project I've worked on, the PC I've had has been much better than the minimum PC required. Just because I'm writing code that will run nicely enough on a slow PC, that doesn't mean I need to use that same slow PC to build it!And then, the binary that the end user receives will actually have been built on one of the CI systems. I bet they don't all have quite the same spec. And the above argument applies anyway.
by tom_
4/9/2026 at 11:06:41 PM
What?! seriously?!I’ve never heard of anyone doing that.
If you use a cloud provider and use a remote development environment (VSCode remote/Jetbrains Gateway) then you’re wrong: cloud providers swap out the CPUs without telling you and can sell newer CPUs at older prices if theres less demand for the newer CPUs; you can’t rely on that.
To take an old naming convention, even an E3-Xeon CPU is not equivalent to an E5 of the same generation. I’m willing to bet it mostly works but your claim “I build on the exact hardware I ship on” is much more strict.
The majority of people I know use either laptops or workstations with Xeon workstation or Threadripper CPUs— but when deployed it will be a Xeon scalable datacenter CPU or an Epyc.
Hell, I work in gamedev and we cross compile basically everything for consoles.
by dijit
4/9/2026 at 11:16:00 PM
… not everyone uses the cloud?Some people, gasp, run physical hardware, that they bought.
by ninkendo
4/10/2026 at 1:35:37 AM
We use physical hardware at work, but it's still not the way you build/deploy unless it's for a workstation/laptop type thing.If you're deploying the binary to more than one machine, you quickly run into issues where the CPUs are different and you would need to rebuild for each of them. This is feasible if you have a couple of machines that you generally upgrade together, but quickly falls apart at just slightly more than 2 machines.
by lkjdsklf
4/10/2026 at 5:20:32 AM
And all your deployed and dev machines run the same spec- same CPU entirely?And you use them for remote development?
I think this is highly unusual.
by dijit
4/10/2026 at 12:19:07 PM
Lots of organizations buy many of a single server spec. In fact that should be the default plan unless you have a good reason to buy heterogeneous hardware. With the way hardware depreciation works they tend to move to new server models “in bulk” as well, replacing entire clusters/etc at once. I’m not sure why this seems so foreign to folks…Nobody is saying dev machines are building code that ships to their servers though… quite the opposite, a dev machine builds software for local use… a server builds software for running on other servers. And yes, often build machines are the same spec as the production ones, because they were all bought together. It’s not really rare. (Well, not using the cloud in general is “rare” but, that’s what we’re discussing.)
by ninkendo
4/10/2026 at 7:26:29 AM
So you buy exact same generation of Intel and AMD chips to your developers than your servers and your cutomsers? And encode this requirement into your development process for the future?by izacus
4/9/2026 at 9:08:21 PM
The only time I used -march=native was for a university assignment which was built and evaluated on the same server, and it allowed juicing an extra bit of performance. Using it basically means locking the program to the current CPU only.However I'm not sure about -O3. I know it can make the binary larger, not sure about other downsides.
by PufPufPuf
4/9/2026 at 11:27:31 PM
> The only time I used -march=nativeIt is completely fine to use -march=native, just do not make it the default for someone building your project.
That should always be something to opt-in.
The main reason is that software are a composite of (many) components. It becomes quickly a pain in the ass of maintainability if any tiny library somewhere try to sneak in '-march=native' that will make the final binary randomly crash with an illegal instruction error if executed on any CPU that is not exactly the same than the host.
When you design a build system configuration, think for the others first (the users of your software), and yourself after.
by adev_
4/9/2026 at 9:53:19 PM
-O3 also makes build times longer (sometimes significantly), and occasionally the resulting program is actually slightly slower than -O2.IME -O3 should only be used if you have benchmarks that show -O3 actually produces a speedup for your specific codebase.
by hmry
4/10/2026 at 7:10:12 AM
This various a lot between compilers. Clang for example treats O3 perf regressions a bugs In many cases at least) and is a bit more reasonable with O3 on. GCC goes full mad max and you don't know what it's going to do.by fyrn_
4/10/2026 at 3:27:17 AM
If you have a lot of "data plane" code or other looping over data, you can see a big gain from -O3 because of more aggressive unrolling and vectorization (HPC people use -O3 quite a lot). CRUD-like applications and other things that are branchy and heavy on control flow will often see a mild performance regression from use of -O3 compared to -O2 because of more frequent frequency hits due to AVX instructions and larger binary size.by pclmulqdq
4/9/2026 at 9:07:18 PM
Not assumptions, experience.I fully concur with that whole post as someone who also maintained a C++ codebase used in production.
by izacus
4/9/2026 at 7:00:39 PM
> -march=native is always always a mistakeGentoo user: hold my beer.
by tgma
4/9/2026 at 7:12:57 PM
Gentoo binaries aren't shipped that wayby CarVac
4/9/2026 at 10:01:39 PM
Gentoo..... distributes binaries?by greenavocado
4/9/2026 at 10:04:30 PM
Yesby rascul
4/10/2026 at 2:33:05 AM
But not with march=native?The distirbuted binaries use two standard instruction sets for x86-64 and one for arm like “march=x86-64-v3”
https://wiki.gentoo.org/wiki/Gentoo_binhost/Available_packag...
by digitalPhonix
4/9/2026 at 7:09:45 PM
It's also an option on NixOS but I haven't managed to get it working unlike Gentoo.by jjmarr
4/9/2026 at 5:56:20 PM
>1500015000 what?
by moralestapia
4/9/2026 at 6:05:21 PM
1500 C/C++ individual software components.The 15000 was a typo on my side. Fixed.
by adev_
4/9/2026 at 6:24:17 PM
I see, thanks. I didn't mind the number it just wasn't clear what was it about.by moralestapia