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

Error when compiling: expression must have a constant value #1240

Closed
DamynChipman opened this issue Aug 27, 2024 · 2 comments · Fixed by #1242
Closed

Error when compiling: expression must have a constant value #1240

DamynChipman opened this issue Aug 27, 2024 · 2 comments · Fixed by #1242
Labels
priority: medium Should be solved within half a year

Comments

@DamynChipman
Copy link

Bug report

Describe the bug

When compiling, I get the following same error in three locations:

"src/t8_cmesh/t8_cmesh_examples.cxx", line 3142: error: expression must have a constant value
    constexpr double _CBRT = std::cbrt (1.0);
                             ^

"src/t8_cmesh/t8_cmesh_examples.cxx", line 3223: error: expression must have a constant value
    constexpr double _CBRT = std::cbrt (1.0);
                             ^

"src/t8_cmesh/t8_cmesh_examples.cxx", line 3517: error: expression must have a constant value
    constexpr double _CBRT = std::cbrt(1.0);
                             ^

I've tried this with the Autotools and CMake build systems on both my laptop and a Linux cluster with the same bugs. I've also tried using different C/C++ standards to no avail.

I had t8code compiled and running a few weeks ago as part of a JOSS review (openjournals/joss-reviews#6887). Perhaps this is from recent changes?

To Reproduce

I followed the installation instructions from the Wiki exactly except for system specific pieces.

Expected behavior

Code compiles to completion.

Log files

CMakeCache.txt

For some reason, there is no CMakeFiles/CMakeError.log or CMakeFiles/CMakeOutput.log. Here is the output of the make step:

>>> make
[  0%] Built target iniparser
[  1%] Built target libb64
[  5%] Built target sc
[  6%] Built target sc_function
[  6%] Built target sc_logging
[  6%] Built target sc_test_shmem
[  6%] Built target sc_options
[  7%] Built target sc_pthread
[  7%] Built target sc_test_allgather
[  7%] Built target sc_test_arrays
[  8%] Built target sc_test_keyvalue
[  8%] Built target sc_test_notify
[  9%] Built target sc_test_reduce
[  9%] Built target sc_test_search
[  9%] Built target sc_test_sortb
[  9%] Built target sc_test_version
[  9%] Built target sc_test_node_comm
[  9%] Built target sc_test_helpers
[ 10%] Built target sc_test_sort
[ 11%] Built target sc_test_builtin
[ 11%] Built target sc_test_io_sink
[ 13%] Built target p6est
[ 16%] Built target p8est
[ 20%] Built target p4est
[ 20%] Built target test_comm
[ 20%] Built target test_hash
[ 20%] Built target test_order
[ 20%] Built target test_complete_subtree
[ 20%] Built target test_conn_transformation2
[ 21%] Built target test_brick2
[ 21%] Built target test_join2
[ 21%] Built target test_conn_reduce2
[ 21%] Built target test_balance2
[ 21%] Built target test_partition_corr2
[ 21%] Built target test_coarsen2
[ 21%] Built target test_balance_type2
[ 22%] Built target test_lnodes2
[ 22%] Built target test_plex2
[ 23%] Built target test_connrefine2
[ 23%] Built target test_search2
[ 23%] Built target test_subcomm2
[ 23%] Built target test_replace2
[ 23%] Built target test_ghost2
[ 23%] Built target test_iterate2
[ 24%] Built target test_nodes2
[ 25%] Built target test_partition2
[ 26%] Built target test_quadrants2
[ 26%] Built target test_valid2
[ 27%] Built target test_conn_complete2
[ 28%] Built target test_wrap2
[ 28%] Built target test_load2
[ 28%] Built target test_loadsave2
[ 29%] Built target test_balance_seeds2
[ 30%] Built target test_all6
[ 30%] Built target test_conn_transformation3
[ 30%] Built target test_brick3
[ 30%] Built target test_join3
[ 31%] Built target test_conn_reduce3
[ 31%] Built target test_mesh_corners3
[ 31%] Built target test_balance3
[ 32%] Built target test_partition_corr3
[ 33%] Built target test_coarsen3
[ 33%] Built target test_balance_type3
[ 33%] Built target test_lnodes3
[ 33%] Built target test_plex3
[ 33%] Built target test_connrefine3
[ 34%] Built target test_subcomm3
[ 35%] Built target test_replace3
[ 36%] Built target test_ghost3
[ 37%] Built target test_iterate3
[ 37%] Built target test_nodes3
[ 37%] Built target test_partition3
[ 37%] Built target test_quadrants3
[ 37%] Built target test_valid3
[ 37%] Built target test_conn_complete3
[ 37%] Built target test_wrap3
[ 38%] Built target test_load3
[ 38%] Built target points2
[ 39%] Built target points3
[ 39%] Built target generate_points2
[ 40%] Built target generate_points3
[ 40%] Built target particles2
[ 41%] Built target particles3
[ 41%] Built target bricks2
[ 41%] Built target bricks3
[ 41%] Built target timings2
[ 42%] Built target timings3
[ 42%] Built target loadconn2
[ 42%] Built target loadconn3
[ 42%] Built target tsearch3
[ 42%] Built target balance_seeds2
[ 43%] Built target balance_seeds3
[ 44%] Built target balance_corner2
[ 44%] Built target balance_corner3
[ 45%] Built target mesh2
[ 45%] Built target mesh3
[ 46%] Built target simple2
[ 46%] Built target simple3
[ 46%] Built target periodicity3
[ 47%] Built target count_quadrants2
[ 47%] Built target count_quadrants3
[ 47%] Built target read_conn2
[ 47%] Built target read_conn3
[ 47%] Built target write_conn2
[ 48%] Built target write_conn3
[ 49%] Built target read_tetgen
[ 49%] Built target spheres2
[ 50%] Built target spheres3
[ 50%] Built target p4est_step1
[ 51%] Built target p8est_step1
[ 51%] Built target p4est_step2
[ 51%] Built target p8est_step2
[ 52%] Built target p4est_step3
[ 52%] Built target p8est_step3
[ 52%] Built target p4est_step4
[ 53%] Built target p8est_step4
[ 53%] Built target p4est_step5
[ 53%] Built target p8est_step5
[ 53%] Building CXX object src/CMakeFiles/T8.dir/t8_cmesh/t8_cmesh_examples.cxx.o
/Users/damynchipman/packages/t8code/src/t8_cmesh/t8_cmesh_examples.cxx:3142:20: error: constexpr variable '_CBRT' must be initialized by a constant expression
  constexpr double _CBRT = std::cbrt (1.0);
                   ^       ~~~~~~~~~~~~~~~
/Users/damynchipman/packages/t8code/src/t8_cmesh/t8_cmesh_examples.cxx:3142:28: note: non-constexpr function 'cbrt' cannot be used in a constant expression
  constexpr double _CBRT = std::cbrt (1.0);
                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/math.h:422:15: note: declared here
extern double cbrt(double);
              ^
/Users/damynchipman/packages/t8code/src/t8_cmesh/t8_cmesh_examples.cxx:3223:20: error: constexpr variable '_CBRT' must be initialized by a constant expression
  constexpr double _CBRT = std::cbrt (1.0);
                   ^       ~~~~~~~~~~~~~~~
/Users/damynchipman/packages/t8code/src/t8_cmesh/t8_cmesh_examples.cxx:3223:28: note: non-constexpr function 'cbrt' cannot be used in a constant expression
  constexpr double _CBRT = std::cbrt (1.0);
                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/math.h:422:15: note: declared here
extern double cbrt(double);
              ^
/Users/damynchipman/packages/t8code/src/t8_cmesh/t8_cmesh_examples.cxx:3517:20: error: constexpr variable '_CBRT' must be initialized by a constant expression
  constexpr double _CBRT = std::cbrt(1.0);
                   ^       ~~~~~~~~~~~~~~
/Users/damynchipman/packages/t8code/src/t8_cmesh/t8_cmesh_examples.cxx:3517:28: note: non-constexpr function 'cbrt' cannot be used in a constant expression
  constexpr double _CBRT = std::cbrt(1.0);
                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/math.h:422:15: note: declared here
extern double cbrt(double);
              ^
3 errors generated.
make[2]: *** [src/CMakeFiles/T8.dir/t8_cmesh/t8_cmesh_examples.cxx.o] Error 1
make[1]: *** [src/CMakeFiles/T8.dir/all] Error 2
make: *** [all] Error 2

Environment (please complete the following information):

  • OS: MacOS
  • Compiler: OpenMPI
  • Compiler version:
>>> mpicc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Estimated priority

"Priority: medium" Should be solved within half a year

@Davknapp
Copy link
Collaborator

Thanks for submitting this Issue! We will have a look at it and report back to you as soon as we have updates.

@Davknapp Davknapp added the priority: medium Should be solved within half a year label Aug 28, 2024
@jmark
Copy link
Collaborator

jmark commented Sep 3, 2024

A fix is in the pipeline. Thank you for raising this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Should be solved within half a year
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants