Skip to content

Cannot specify compiler on command line #16125

Description

@CendioOssman

Describe the bug
Meson doesn't have a way to override which compiler is used when meson setup is invoked. Unlike $CFLAGS, which has the c_args option, there is no option for $CC. Although meson looks at $CC, that isn't given the highest priority. It breaks in a cross compile where another compiler is specified in the machine configuration.

What's missing is something equivalent to specifying CC=foo as an argument in Autotools.

We need this to override the compiler in automation scripts with a wrapper. Creating temporary configuration files for Meson is just messy there, so we need something that can be dynamically evaluated in just the script.

To Reproduce
meson -D c_compiler=foobar

Expected behavior
The specified compiler overrides any other source that meson has used for the compiler.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    Cross
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Custom Linux
  • what Python version are you using e.g. 3.8.0
    3.9.20
  • what meson --version
    1.7.0
  • what ninja --version if it's a Ninja build
    1.12.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions