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

Remove/replace outdated C++ constructs #217

Open
wperkins opened this issue Aug 20, 2024 · 2 comments · May be fixed by #221
Open

Remove/replace outdated C++ constructs #217

wperkins opened this issue Aug 20, 2024 · 2 comments · May be fixed by #221
Assignees
Labels

Comments

@wperkins
Copy link
Member

GridPACK C++ code is aging. Some C++ constructs that were acceptable when coding began have been deprecated and not supported by some newer compilers. I have trouble building GridPACK with CLang 16 and 18, which strictly follow C++17. Some things that need to change:

  • use of std::auto_ptr should be replaced with std::unique_ptr
  • use of std::unary_function and std::binary_function is not needed

In addition, it might be appropriate to migrate code away from Boost for those constructs that are now standard, e.g. shared_ptr.

@jainmilan
Copy link
Collaborator

@wperkins: The python wrapper is using std::optional which is available only in C++17 and above. The installation of python wrapper is by default using C++14 (though I am loading gcc/11.2.0 which support C++17) which throws error for std::optional related attributes and modules. To fix this, I had to specifically mention -DCMAKE_CXX_STANDARD=17 in the setup file.

cmake_args += ['-DCMAKE_CXX_STANDARD=17']

@wperkins
Copy link
Member Author

@wperkins: The python wrapper is using std::optional which is available only in C++17 and above. The installation of python wrapper is by default using C++14 (though I am loading gcc/11.2.0 which support C++17) which throws error for std::optional related attributes and modules. To fix this, I had to specifically mention -DCMAKE_CXX_STANDARD=17 in the setup file.

cmake_args += ['-DCMAKE_CXX_STANDARD=17']

@jainmilan, @bjpalmer: I cannot reproduce this on my personal system or deception. I do not see CMake inserting any C++ standard flags into the build. The Python interface builds fine for me without specifying the above flag.

Can you please provide the details of how you are building GridPACK and the Python interface: system, modules, cmake command, etc.? Also, show where the compiler standard options are showing up in CMakeCache.txt. Thanks.

@wperkins wperkins linked a pull request Dec 10, 2024 that will close this issue
@wperkins wperkins self-assigned this Dec 10, 2024
@wperkins wperkins added this to the GridPACK 3.5 Release milestone Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants