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

Combining default_options : ['cpp_std=c++2a', 'cuda_std=c++17'] breaks nvcc #8523

Closed
drewrobson opened this issue Mar 11, 2021 · 2 comments
Closed

Comments

@drewrobson
Copy link

I'm trying to compile a project where the host code (.cpp) uses c++20, but the device code (.cu) uses c++17, since that is the latest version currently supported by nvcc.

Describe the bug
In meson.build, I tried this:

project('C++ std', 'cpp', 'cuda', version : '1.0.0', default_options : ['cpp_std=c++2a', 'cuda_std=c++17'])

but nvcc fails because it was called with --std=c++17 -std=c++2a:

meson compile -v
ninja: Entering directory `.'
[1/2] nvcc -Xcompiler=-Wall -Xcompiler=-Winvalid-pch -Xcompiler=-Wnon-virtual-dtor --std=c++17 -std=c++2a -g -G -g -I.. -I. -Iprog.p -Iprog.p -o prog.p/main.cu.o -c ../main.cu
FAILED: prog.p/main.cu.o 
nvcc -Xcompiler=-Wall -Xcompiler=-Winvalid-pch -Xcompiler=-Wnon-virtual-dtor --std=c++17 -std=c++2a -g -G -g -I.. -I. -Iprog.p -Iprog.p -o prog.p/main.cu.o -c ../main.cu
nvcc fatal   : Value 'c++2a' is not defined for option 'std'
ninja: build stopped: subcommand failed.

To Reproduce
Start with cuda example 6 std, but use this:
project('C++ std', 'cpp', 'cuda', version : '1.0.0', default_options : ['cpp_std=c++2a', 'cuda_std=c++17'])

Expected behavior
I expected that gcc would be invoked with c++2a and nvcc would be invoked with c++17.

If I manually remove the spurious -std=c++2a then nvcc succeeds.

system parameters
This is a native build on 5.4.101-1-MANJARO with Meson 0.57.1.

@obilaniu
Copy link
Contributor

@drewrobson Can you have a try at my solution? It solves it on my end (except with c++17 and 14; I don't have c++2a)

obilaniu added a commit to obilaniu/meson that referenced this issue Mar 13, 2021
obilaniu added a commit to obilaniu/meson that referenced this issue Mar 13, 2021
obilaniu added a commit to obilaniu/meson that referenced this issue Mar 13, 2021
@drewrobson
Copy link
Author

Yep, that solves it on my end as well, with c++2a and c++17. Thank you for fixing this so quickly!

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

Successfully merging a pull request may close this issue.

3 participants