# "fconstexpr-steps" compiler flag

**URL:** <https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748>\
**Category:** Code\
**Created:** [October 28, 2022, 3:40am UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748 "2022-10-28T03:40:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Margulus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@Margulus](https://discourse.cmake.org/u/Margulus)\
**Post date:** [October 28, 2022, 3:40am UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/1 "2022-10-28T03:40:09Z")

</div>

So I have a single cuda file with a c++ dependency (e.g. #include \<ecc/curves/grumpkin/grumpkin.hpp\>). Nvcc is compiling the cuda file with a dependency that relies on the compiler flag “ **fconstexpr-steps=100000000”** being set. This flag is recognized by CCX, but not by NVCC (so the file won’t compile).

To get around this, I use the “string(APPEND CMAKE\_CUDA\_FLAGS " -Xcompiler -fconstexpr-depth=100000000”)" inside the cmake file. This way, the nvcc compiles host code with your c++ compiler, passing in -Xcompiler “-fconstexpr-steps=1000000000” will forward that argument to the c++ compiler being used.

For some reason, it’s still failing. I’m using clang as my default toolchain/compiler, and still get the error message below. I can’t figure out what the problem is. Any help would be a godsend, and I appreicate your time!

 ![Screen Shot 2022-10-27 at 11.34.45 PM](https://discourse.cmake.org/uploads/default/original/2X/6/6edc4e67ccfcbc84fc6f0dada4a5f19e04d17bce.png)

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [October 28, 2022, 12:36pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/2 "2022-10-28T12:36:28Z")

</div>

That looks like `gcc`, not `clang`, from the error line and `gcc` does not support a flag with that name.

---

<div class="post-metadata">

**Author:** ![Margulus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@Margulus](https://discourse.cmake.org/u/Margulus)\
**Post date:** [October 28, 2022, 12:56pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/3 "2022-10-28T12:56:20Z")

</div>

> [@ben.boeckel](#):
>
> gcc

Right, I thought that was the source of the issue. But I set up the cmake file to use clang as my default toolchain/compiler, and it’s indicating that clang is being used during compilation. I’m not sure how to change this. If you have any insight, that would be extremely helpful! @ben.boeckel

 ![Screen Shot 2022-10-28 at 8.53.46 AM](https://discourse.cmake.org/uploads/default/original/2X/8/82d9a9191fc94d959ab9d25a965b838531362514.png)

---

<div class="post-metadata">

**Author:** ![Margulus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@Margulus](https://discourse.cmake.org/u/Margulus)\
**Post date:** [October 28, 2022, 1:10pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/4 "2022-10-28T13:10:52Z")

</div>

![Screen Shot 2022-10-28 at 9.10.31 AM](https://discourse.cmake.org/uploads/default/original/2X/7/78271e38942e747d04a877befdadce62e0b0e961.png)

@ben.boeckel

---

<div class="post-metadata">

**Author:** ![Margulus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@Margulus](https://discourse.cmake.org/u/Margulus)\
**Post date:** [October 28, 2022, 1:18pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/5 "2022-10-28T13:18:34Z")

</div>

I’m also setting this flag on the GPU, but it’s not recognizing it. Seems very odd. What do you think?

 ![Screen Shot 2022-10-28 at 9.18.00 AM](https://discourse.cmake.org/uploads/default/original/2X/4/48e9cd6449597e8e64b1ddd4bc0139d3cf2baf0a.png)

---

<div class="post-metadata">

**Author:** ![Margulus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@Margulus](https://discourse.cmake.org/u/Margulus)\
**Post date:** [October 28, 2022, 1:28pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/6 "2022-10-28T13:28:57Z")

</div>

![Screen Shot 2022-10-28 at 9.28.06 AM](https://discourse.cmake.org/uploads/default/original/2X/0/0d476fcdfd0d21936698c7afbd407743714bedc4.png)

This was a test inside the cmake file, as you can see. And it outputs “/usr/bin/clang++” and “Clang”

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [October 28, 2022, 2:45pm UTC](https://discourse.cmake.org/t/fconstexpr-steps-compiler-flag/6748/7 "2022-10-28T14:45:23Z")

</div>

It seems like CUDA thinks it should use `gcc` as the backing compiler. How to configure that is beyond my CUDA knowledge though.
