[Qbs] How do I build using GCC with the "-march=native" option?

Christian Kandeler christian.kandeler at qt.io
Fri Dec 8 11:17:29 CET 2017


On Thu, 7 Dec 2017 22:38:56 +0100
Ola Røer Thorsen <ola at silentwings.no> wrote:

> Hi, I'm trying to build my code with the gcc "-march=native"-option
> (x86-64), or any other value there for that matter. Qbs won't let me do
> that using
> 
> cpp.cxxFlags: [ "-march=native" ]
> 
> saying
> 
> "warning: The following properties have invalid values:
> cpp.cxxFlags: '-target', '-triple', '-arch' and '-march' cannot appear in
> flags; set qbs.architecture instead"

I believe qbs is being overly strict here. There seem to be legitimate
use cases for -march not covered by dedicated properties. See also
https://bugreports.qt.io/browse/QBS-1018.

> qbs.architecture: "native"
> 
> gives
> 
> "warning: The following properties have invalid values:
> cpp.architecture: 'native' differs from the architecture produced by this
> compiler (x86_64)"
> 
> How do I fix this?

As a workaround, you can try the (undocumented) cpp.machineType property. It doesn't do anything when using clang, though.


Christian



More information about the Qbs mailing list