Compilation with -march=native option
Hi
Do you recommend, or not, to use -march=native as compilation option?
Instead of simply -O2 -m64 on Linux
If you are building and running Virtuoso on the same machine then the answer is ~~yes~~ NO (see my reply below)
However if you are building on a different CPU architecture and/or OS distribution, then the resulting binary may not work on the target machine.
So, on the same machine you recommend it over -m64 for Linux (CFLAGS="-O2 -m64")?
As a result of your question, i have been testing some -march and -O combinations on my Ubuntu 24.04 Noble Numbat system, using the following C compilers:
$ gcc --version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ clang --version
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Several combinations of compiler, optimiser flags, and CPU flags (including -march=native), produced a binary that did not pass the virtuoso test-suite in one way or another.
I will likely post an article on our Community Server at some point, which will describe some combinations that do work properly in our eyes.
Therefore, unless the user knows exactly what they are doing, my recommendation would be to continue using CFLAGS="-O2 -m64 , as these are tried and tested flags that we know will work on all versions of compilers and glibc versions up to and including the latest gcc 15.1 release on Debian testing.
OK, while waiting for more tests, will keep CFLAGS="-O2 -m64"