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

constexpr called in a constant expression compilation error #806

Closed
shtsai-zz opened this issue Dec 14, 2023 · 3 comments
Closed

constexpr called in a constant expression compilation error #806

shtsai-zz opened this issue Dec 14, 2023 · 3 comments
Assignees

Comments

@shtsai-zz
Copy link

Dear all,

I used git clone to obtain the source code for hemelb and tried to compile it on a 64-bit Rocky 8 Linux system using GCC 11.3.0. The compilation uses zlib 1.2.12, ParMETIS 4.0.3, TinyXML 2.6.2, Boost 1.79.0, and CMake 3.24.3 installed on the system.

Basically, the steps followed were:

git clone https://github.com/hemelb-codes/hemelb.git
cd hemelb
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/src/st/HemeLB/install ../
make

The compilation is running into errors like this:

[ 75%] Performing build step for 'hemelb'
[  1%] Building CXX object reporting/CMakeFiles/hemelb_reporting.dir/BuildInfo.cc.o
[  1%] Building CXX object reporting/CMakeFiles/hemelb_reporting.dir/Reporter.cc.o
[  2%] Building CXX object reporting/CMakeFiles/hemelb_reporting.dir/Timers.cc.o
[  3%] Building CXX object reporting/CMakeFiles/hemelb_reporting.dir/Dict.cc.o
[  3%] Built target hemelb_reporting
[  3%] Building CXX object configuration/CMakeFiles/hemelb_configuration.dir/CommandLine.cc.o
[  4%] Building CXX object configuration/CMakeFiles/hemelb_configuration.dir/SimConfig.cc.o
[  5%] Building CXX object configuration/CMakeFiles/hemelb_configuration.dir/SimBuilder.cc.o
In file included from /usr/local/src/st/HemeLB/20231211/hemelb/Code/extraction/LocalPropertyOutput.h:11,
                 from /usr/local/src/st/HemeLB/20231211/hemelb/Code/extraction/PropertyWriter.h:9,
                 from /usr/local/src/st/HemeLB/20231211/hemelb/Code/extraction/PropertyActor.h:9,
                 from /usr/local/src/st/HemeLB/20231211/hemelb/Code/configuration/SimBuilder.h:11,
                 from /usr/local/src/st/HemeLB/20231211/hemelb/Code/configuration/SimBuilder.cc:6:
/usr/local/src/st/HemeLB/20231211/hemelb/Code/lb/Lattices.h: In function ‘constexpr auto hemelb::lb::detail::get_default_lattice()’:
/usr/local/src/st/HemeLB/20231211/hemelb/Code/lb/Lattices.h:19:31: error: ‘constexpr auto hemelb::operator==(const hemelb::ct_string<M>&, const char*) [with long unsigned int N = 5]’ called in a constant expression
   19 |             if constexpr (LAT == "D3Q15") {
      |                           ~~~~^~~~~~~~~~

The same error happens when I tried the compilation using GCC 11.2.0, GCC 8.3.0 and Intel compilers v. 2021.4.0.

What compiler version and compilation options are recommended for building hemelb?

Any thoughts why this error occurs and how to get it resolved?

Thank you very much in advance.

@rupertnash rupertnash self-assigned this Dec 15, 2023
@rupertnash
Copy link
Member

HemeLB needs a C++20 compiler.

The particular feature you're missing is constexpr support for std::basic_string in libstdc++. GCC 12 is the minimum version.

Several people have hit this now. I will investigate if there is a relatively easy fix.

@shtsai-zz
Copy link
Author

Good to know, thanks! I was able to compile hemelb successfully using GCC 12.2.0. Thank you so much!

@rupertnash
Copy link
Member

Just merged #807 which should make everything work back to GCC 11. Not going to try and support anything older than that.

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