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

MEX-file Error #5

Open
nmehlman opened this issue Aug 12, 2021 · 1 comment
Open

MEX-file Error #5

nmehlman opened this issue Aug 12, 2021 · 1 comment

Comments

@nmehlman
Copy link

I get a MEX error (shown below) when trying to use the RunMCRoom() function. Any idea what might be the cause?

Screen Shot 2021-08-12 at 3 22 37 PM

@under-funk
Copy link

Today I discovered that Matlab versions above 2016b have problems resolving @loader_path and requires a slight modification on how to resolve dynamic library paths.

I am on macOS so the commands for linux is different (ldd instad of otool for example) but it seems that if you change the @loader_paths in the following command using the install_name_tool like indicated below (just for @loader_path ones) so that you get the second result with otool it seems to work in newer versions of Matlab.

I am just writing this down so that it might help some others since I was keeping two copies of Matlab until now to keep MCRoomSim running.

In the terminal in MCRoomSim folder:

otool MCRoomSim.mexmaci64 -L

MCRoomSim.mexmaci64:
@loader_path/libut.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libmx.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libmex.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libmat.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 832.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

install_name_tool -change @loader_path/libut.dylib @rpath/libut.dylib MCRoomSim.mexmaci64
install_name_tool -change @loader_path/libmx.dylib @rpath/libmx.dylib MCRoomSim.mexmaci64
install_name_tool -change @loader_path/libmat.dylib @rpath/libmat.dylib MCRoomSim.mexmaci64
install_name_tool -change @loader_path/libmex.dylib @rpath/libmex.dylib MCRoomSim.mexmaci64

otool MCRoomSim.mexmaci64 -L

MCRoomSim.mexmaci64:
@rpath/libut.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libmx.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libmex.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libmat.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 832.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

Hope this helps,

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