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

[Moco] Failed to compile and my solution #3008

Closed
sjtulzh opened this issue Jun 5, 2021 · 4 comments
Closed

[Moco] Failed to compile and my solution #3008

sjtulzh opened this issue Jun 5, 2021 · 4 comments

Comments

@sjtulzh
Copy link

sjtulzh commented Jun 5, 2021

When I use gcc-5.4 & g++-5.4 & cmake-3.20 to build opensim-core from source on Ubuntu 16.04, some errors occur. First, I prebuild the dependencies successfully. But errors occur when compile opensim-core.
The error is that:
image
At first I think it is the problem of gcc and g++ version, I change to 4.9 as the guideline suggests, but it doesn't work. I look for the source code and find this:
image
m_implicit_component_refs is defined as:
image
m_implicit_component_refs is a vector and its elements are std::pair.
So I modify the code like that:
image
I use a tmp_pair variant to pass the value.
Besides this file, MocoFrameDistanceConstraint.cpp has a similar problem in line 72
I am not sure using "emplace" directly without "make_pair" to get a std::pair is correct or not on other platform or environment. But I can solve the compile errors after modifying the code like above.
If other people face the similar errors, you can try this solution.

@nickbianco
Copy link
Member

Hi @sjtulzh, thanks for raising this issue. I wonder if you could wrap the inputs to the emplace_back call with brackets to get it to work for your build process:

m_implicit_component_refs.emplace_back({"implicitderiv_" + stateName, &component});

But creating the intermediate variable seems fine and should work across platforms and environments. If you'd like, you could create a PR to implement this change and I could review it. Otherwise, I'll leave this issue up until one of us makes the change internally.

@yaujunking
Copy link

Hi, I have the same problem just like yours, but besides, I encounter other more problems, too.
I have post it in forums.
https://simtk.org/plugins/phpBB/viewtopicPhpbb.php?f=91&t=13652&p=39194&start=0&view=
If you are interested in it, please check the forums for details. Thanks!

@yaujunking
Copy link

Hi @sjtulzh, thanks for raising this issue. I wonder if you could wrap the inputs to the emplace_back call with brackets to get it to work for your build process:

m_implicit_component_refs.emplace_back({"implicitderiv_" + stateName, &component});

But creating the intermediate variable seems fine and should work across platforms and environments. If you'd like, you could create a PR to implement this change and I could review it. Otherwise, I'll leave this issue up until one of us makes the change internally.

hi I have tried this solution, But it did not work.

@nickbianco
Copy link
Member

Hi @yaujunking, I responded to you on the forum.

@jenhicks jenhicks closed this as completed Oct 8, 2021
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

4 participants