c++ - Meson ERROR: Compiler cc cannot compile programs - Stack Overflow

I'm trying to build a fortran project, that depends on other CC++ and Fortran subprojects using m

I'm trying to build a fortran project, that depends on other C/C++ and Fortran subprojects using meson and ninja. After installing everything necessary, gfortran, build-essential, meson and ninja, and trying to run:

meson setup build --reconfigure -Db_coverage=true -Dc_args=-Og,-w

I get an error like:

subprojects/**/meson.build:30:9: ERROR: Compiler cc cannot compile programs.

I have checked that compiler cc exists, and is available with cc --version. I don't understand why this error happens. I've simplified the meson error down to running

meson.get_compiler('c')

Which errors out with a

meson.build:14:6: ERROR: Tried to access compiler for language "c", not specified for host machine.

Why does this happen?

I'm trying to build a fortran project, that depends on other C/C++ and Fortran subprojects using meson and ninja. After installing everything necessary, gfortran, build-essential, meson and ninja, and trying to run:

meson setup build --reconfigure -Db_coverage=true -Dc_args=-Og,-w

I get an error like:

subprojects/**/meson.build:30:9: ERROR: Compiler cc cannot compile programs.

I have checked that compiler cc exists, and is available with cc --version. I don't understand why this error happens. I've simplified the meson error down to running

meson.get_compiler('c')

Which errors out with a

meson.build:14:6: ERROR: Tried to access compiler for language "c", not specified for host machine.

Why does this happen?

Share Improve this question asked Mar 11 at 10:17 tornikeotornikeo 9678 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

In my case the issue was a wrong build command for meson. I.e:

meson setup build --reconfigure -Db_coverage=true -Dc_args=-Og,-w

Is wrong, and should instead be:

meson setup build --reconfigure -Db_coverage=true -Dc_args='-Og -w'

Adding quotes (') fixes this. Without quotes, meson passes the -w to a default C compiler incorrectly, which causes the compiler to return an exception. Meson then decides that the compiler doesn't work - and announces that the compiler for "c" is not specified for the host machine.

See more about this this meson discussion.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744801721a4594531.html

相关推荐

  • c++ - Meson ERROR: Compiler cc cannot compile programs - Stack Overflow

    I'm trying to build a fortran project, that depends on other CC++ and Fortran subprojects using m

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信