Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meson docs treat "cpp" as the C++ compiler instead of the C preprocessor #13560

Open
lessismordaunt opened this issue Aug 19, 2024 · 4 comments

Comments

@lessismordaunt
Copy link

Describe the bug

The binary cpp is the C preprocessor, not the C++ compiler. My build scripts use cpp to preprocess linker scripts and use find_program('cpp'). When following the docs at https://mesonbuild.com/Machine-files.html, you are guided to set cpp to the C++ compiler e.g. G++. This is wrong and results in my build failing as now find_program returns the C++ compiler, which is obviously incorrect.

To Reproduce

Set cpp in a cross file as instructed in the link above. Now find_program for cpp incorrectly picks up the C++ compiler.

Expected behavior

The C preprocessor is picked up.
I believe this may be just a documentation issue - or there may be more ominous/deeper problems at play here!

@eli-schwartz
Copy link
Member

This is an unfortunate side effect of the fact that the language name used by meson is 'cpp' instead of 'cxx'.

It's annoyed me before but I'm not sure exactly what to do about it.

Worth noting: meson's compiler object has a preprocess method which you can use to get at the preprocessor and produce an output. You can try using that instead.

@eli-schwartz
Copy link
Member

@lessismordaunt
Copy link
Author

Somewhat ironically, that preprocess method allows for explicit (not file based) target ordering requirements via depends which is exactly what we've been discussing over at #8123...

@lessismordaunt
Copy link
Author

And perhaps further, the dependencies and depends combo on that method is uh... something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants