-
Notifications
You must be signed in to change notification settings - Fork 248
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
[CoSim] Changing CMAKE to C++17 in CoSIm External Lib #12209
Conversation
@matekelemen FYI |
Hey, not against but would like to know the errors Perhaps there is a better fix |
I never tried compiling parts of the same program with different standards, but I wouldn't be surprised if it were dangerous. One of the errors I remember when we tried compiling on the cluster is that std:filesystem namespace was (obviously) not found. P.S.: here Line 17 in 08507c7
|
I agree that this has to be improved, I wonder why I did it like this in the first place. And how it was working on otter systems. I need to think a bit |
|
not sure I follow. Different programs can use different compilers, standards, even languages ...? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since I manually removed the filesystem bcs Kratos is C++17, I think it is also ok to hack it like this. I will keep it in mind, maybe I come across a smarter/automatic solution
Sure, but as always it's a bit difficult with C++. I'm by no means an expert at this, but as far as I know you must keep a few things in mind when you want to mix standards/compilers/etc: First that comes to mind is never to pass standard classes through API boundaries, because the binary layout may be different across programs if compiled with different compilers. For example
#include <vector>
void dependency(std::vector<int>& arg);
void dependency(std::Vector<int>& arg)
{
// do some stuff with arg
}
#include "dependency.hpp"
#include <vector>
int main()
{
dependency(std::vector<int> {});
} if Another problem is which headers to include. These are just some things that come to mind, and Line 25 in 1166a00
Lines 24 to 28 in 1166a00
P.S.: the same issues are still valid with the same compiler but different standards. Some standards might retain binary compatibility, but they will almost certainly have different headers. |
Thanks for the explanation, that makes sense I think trilinos, metis etc have a C API, guess for this reason For me still unclear is how it works e.g. in the CI bit not ok your machines Kratos sets c++17 as standard, do you have a clue why it is not applied go CoSimIO? It is a subdir, so it should IMO. Maybe it is the order of compilation? @roigcarlo perhaps you have an idea? |
I'm also surprised about that
Because The problem is what happens when someone wants to compile |
I will investigate, but as you said, if the CoSim sets the flat to 11, and it get added after the Kratos one, it will use 11 regardless of what Kratos says. |
@roigcarlo any updates? I think this should be fixed upstream, and then ported to kratos. Any objections? Should I do it? |
No so far sorry :/ but I would merge the PR if that solves the issue. |
📝 Description
During compilation on HPC we found that cosim appliction can be compiled only with c++11, which caused errors in our compilation. Changing cmake file to use c++17 helped.