Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Static TLS problem with Matlab #6

Open
jbriales opened this issue Dec 3, 2014 · 4 comments
Open

Static TLS problem with Matlab #6

jbriales opened this issue Dec 3, 2014 · 4 comments
Labels

Comments

@jbriales
Copy link

jbriales commented Dec 3, 2014

Hello again!
Pitifully regardless how useful this tool seemed to me I have encountered an almost unavoidable issue with Matlab. After preparing the mex library to use the classes defined in other libraries I'm working with (concretely the MRPT toolbox, http://www.mrpt.org/), I get the following error in Matlab during execution:
Error using MRPT.RealLRF_
Invalid MEX-file '/home/jesus/Code/Matlab/mexMRPT/+MRPT/RealLRF_.mexa64': dlopen: cannot load
any more object with static TLS

It seems as if the linked libraries of MRPT have too many dependencies, so that Matlab collapses. I think you have also worked out some similar wrapping and solutions for OpenCV, which is in some way similar to the MRPT toolbox I'm using. So, do you think there could be any workaround for this issue with static TLS in Matlab?

I highly thank you for your work and support!

@kyamagu
Copy link
Owner

kyamagu commented Dec 3, 2014

@jbriales
Copy link
Author

Solved! I just used static libraries instead of dynamic ones.

@sepidehhosseinzadeh
Copy link

@jesusbriales Hi! Could you tell us how did you do that? I am having the same problem. Thanks

@jbriales
Copy link
Author

Hi @sepidehhosseinzadeh, I suppose it highly depends on the particular project you are working with. If you are adding an external project as a dependency, it might help to have its libraries as static (e.g. using STATIC option for add_library in Cmake) in order to reduce the number of dynamic dependencies of the compiled MEX library.

Regretfully, it's been a while since I had to deal with this... To sum up I would say it need not to be straightforward to solve, depending on the particular libraries involved. If you give some more details about what you're working on maybe I could give additional advice.

@jbriales jbriales reopened this Apr 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants