Simulink crashes with implemeted S-function with protobuf and zeroMQ libraries
11 views (last 30 days)
Show older comments
Hello,
I have a problem with implemetation of communication s-function including protobuf and zeroMQ through legacy_code s function creation. After loading the block cointaining the S-function the whole Matlab crashes. The same happens when I create the function again in one opened Matlab session. It looks like the protobuf library doesn't allow to be loaded multiple times.
I have tried to implement some walkarounds using mexLock() function but I can not use it in root of the function and in init, start or output function it doesn't change the behavior.
Does anyone have any experience with such behavior?
Thank you for any advice
1 Comment
Bill Gruner
on 3 Aug 2022
Edited: Bill Gruner
on 3 Aug 2022
I've run into a similar issue, Lukas, and found out that MATLAB has its own, special version of protobuf3 with no documentation and no (useful) version info. This special version conflicts with the standard version we're running and MATLAB just errors out if we try to call one of the standard protobuf3 methods. It's possible the method doesn't even exist in their special version. The only workaround we've come up with so far is to comment out the line with protobuf3 on it in classpath.txt, e.g.:
.
.
.
$matlabroot/java/jarext/lucene-queries.jar
$matlabroot/java/jarext/lucene-core.jar
$matlabroot/java/jar/ja_JP/mw_java_help_ui_res.jar
# $matlabroot/java/jarext/protobuf3.jar
$matlabroot/java/jar/toolbox/compiler_mdwas.jar
$matlabroot/java/jar/path_api.jar
$matlabroot/java/jarext/lucene-highlighter.jar
.
.
.
and then restart MATLAB and load our standard version as part of a JAR-with-dependencies. You can find your classpath.txt by running:
which classpath.txt
It's a pretty terrible solution, especially if you're going to deploy your code to someone else's computer, but it seems to be all Mathworks has left us with. Good luck!
Answers (0)
See Also
Categories
Find more on Naming Conventions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!