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

Gateway function is missing error using qpOASES and Matlab 2019a #9

Closed
Giulero opened this issue Apr 29, 2019 · 4 comments
Closed

Gateway function is missing error using qpOASES and Matlab 2019a #9

Giulero opened this issue Apr 29, 2019 · 4 comments

Comments

@Giulero
Copy link
Collaborator

Giulero commented Apr 29, 2019

I've encountered this problem calling qpOASES in Matlab2019a (Ubuntu 18.04).

The error message was:
Invalid MEX-file '~/robotology-superbuild/build/install/mex/qpOASES.mexa64': Gateway function is missing

@traversaro solved the problem commenting these lines:

set_target_properties(${${prefix}_NAME}
  PROPERTIES
    CXX_VISIBILITY_PRESET "hidden"
    C_VISIBILITY_PRESET "hidden"
    VISIBILITY_INLINES_HIDDEN "hidden"
)

in robotology-superbuild/external/qpOASES/cmake/FindMatlab.cmake

@traversaro
Copy link
Contributor

Sorry @Giulero , yesterday I was a bit in an hurry, and I could not give a nice explanation of the problem.

To understand the problem, you should first be familiar with the concept of "Symbol Visibility". A nice explanation of what "symbols" are is provided in https://github.com/green7ea/cpp-compilation#symbol-tables (but read all the document, otherwise it is difficult to get the big picture). This gist has some useful links about Symbol Visibility instead: https://gist.github.com/ax3l/ba17f4bb1edb5885a6bd01f58de4d542 .

To load a mexFunction contained in a library compiled from a C++ source code, Matlab needs to find some "symbols" in the library, so this symbols need to be visible. All other symbols of the library are made non visible to avoid symbol collisions, by the CMake code provided in FindMatlab.cmake. Unfortunately the amount of symbols that need to be visible change from Matlab version to Matlab version, so this means that the FindMatlab.cmake needs to be update to work with the latest Matlab version. This is the reason why we "vendor" the FindMatlab.cmake file instead of using the one from CMake, so we can quickly update it if necessary. The workaround that I did on your machine and that you mention in your comment was basically to make all the symbols in the mex library visible, hopefully including the symbols that Matlab needed.

Related issues:

@Giulero Are you able to correctly compile/run WB-Toolbox blocks without the need of custom modifications? What OS are you using?

@prashanthr05 Did you experienced the same problem?

@prashanthr05
Copy link

@traversaro Yes, I experienced the same problem. Thanks for the heads up.

@Giulero
Copy link
Collaborator Author

Giulero commented Apr 30, 2019

Thanks a lot @traversaro. I got slightly the intuition behind.

Now everything I've tested works. I'm using Ubuntu 18.04.

@traversaro
Copy link
Contributor

Fixed by #11 .

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

3 participants