Menu

matlab.link on Mac Book with El Capitan

2015-12-02
2016-06-08
  • Rasmus Pedersen

    Rasmus Pedersen - 2015-12-02

    Hi all,

    I have just updated my Mac Book Air to El Capitan and (as suspected) some stuff does not work anymore. My main problem is that the matlab.link functionality has stopped working. When I follow the guide (MATLAB and MYSQL patch for GridLAB-D Version 3.1) to linking MATLAB with GridLab-D on Mac, written by David P. Chassin, i get to the point where, when executing the following command:

    gridlabd -L glxmatlab
    

    I get this error:

    ERROR    [INIT] : core/module.c(410): module 'glxmatlab' load failed - dlopen(/usr/local/lib/gridlabd/glxmatlab.so, 1): Library not loaded: @rpath/libeng.dylib
      Referenced from: /usr/local/lib/gridlabd/glxmatlab.so
      Reason: image not found
    ERROR    [INIT] : Module glxmatlab load failed
    

    Before upgrading to El Capitan this was not a problem, as David stated in the guide, it was just a matter of exporting "matlab -e" to the DYLD_LIBRARY_PATH, by executing the following command:

    export `matlab -e | grep ^DYLD_LIBRARY_PATH`
    

    However, it seems like this command does not export anything to the DYLD_LIBRARY_PATH after the upgrade to El Capitan, instead i get the following output when executing the command:

    declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.BxuumH5zPh/Render"
    declare -x DISPLAY="/private/tmp/com.apple.launchd.tXdrRDEOH8/org.macosforge.xquartz:0"
    declare -x HOME="/Users/rasmus"
    declare -x LC_CTYPE="UTF-8"
    declare -x LOGNAME="rasmus"
    declare -x OLDPWD="/usr/local"
    declare -x PATH="/opt/local/bin:/opt/local/sbin:/Users/rasmus/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin"
    declare -x PWD="/usr/local/bin"
    declare -x SHELL="/bin/bash"
    declare -x SHLVL="1"
    declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.pLgTYf8qoi/Listeners"
    declare -x TERM="xterm-256color"
    declare -x TERM_PROGRAM="Apple_Terminal"
    declare -x TERM_PROGRAM_VERSION="361"
    declare -x TERM_SESSION_ID="4AD8C9A2-0D70-4400-BCA4-E2E437C31B2B"
    declare -x TMPDIR="/var/folders/lp/qdhdkyxn2wx_9wn_lnxp6jlr0000gn/T/"
    declare -x USER="rasmus"
    declare -x XPC_FLAGS="0x0"
    declare -x XPC_SERVICE_NAME="0"
    declare -x __CF_USER_TEXT_ENCODING="0x1F5:0x0:0x0"
    declare -x matlab
    

    Now if i try to echo the DYLD_LIBRARY_PATH i can see that it is empty. Note, that all of this worked before the upgrade to El Capitan. I have some suspesion that some of the problems are caused by the fact that Apple has locked the /usr/bin/ folder, so it is no longer possible to do alterations to this (not even when being sudo). Another thing might be that i am not completely sure what the command:

    export `matlab -e | grep ^DYLD_LIBRARY_PATH`
    

    is supposed to do. Is it the same as writing:

    export DYLD_LIBRARY_PATH = "matlab -e"
    

    or should it be done in another way?

    I have GridLAB-D 3.1.0-5096 (Hatwai) 64-bit MACOSX RELEASE, installed.

    Hope someone has solved this issue or at least have some ideas on what to do. Thank you all in advance.

    BR Rasmus

     

    Last edit: David P. Chassin 2016-06-01
    • David P. Chassin

      Hi Rasmus,

      I can only speculate because I haven't upgraded my systems yet. Here are my suggestions based on the following assumptions:

      1) If you installed from a download (DMG), then it's possible it won't work anymore. Try building GridLAB-D yourself from the source code.
      2) If you built GridLAB-D from the source code before you upgraded to El Capitan, try rebuilding it again.
      3) If you installed Matlab before the upgrade to El Capitan, try upgrading/reinstalling Matlab. I can't tell if you have the very latest Matlab version. If that doesn't work, you can also try setting DYLD_LIBRARY_PATH yourself based on where Matlab is installed. But if Matlab isn't reporting a path setting for the libraries, it's possible something's either wrong with Matlab or something isn't supported anymore.

      Finally, and this might be very important. El Capitan has a new feature called System Integrity Protection (SIP), which is enabled by default. I don't know much about it, but it's possible you may have to disable it to be able to set DYLD_LIBRARY_PATH. Try poking around help websites for Apple MACOSX for details.

      Until I upgrade, there's not much more I can suggest. If you figure it out, please let us know how you did it because I suspect you won't be the last to encounter this problem.

      Thanks,
      Dave

       
  • Rasmus Pedersen

    Rasmus Pedersen - 2015-12-07

    Hi David,

    Thank you for the swift reply. Admittedly, I hoped you also upgraded :-)

    1) I am building Gridlab-D my self. I am adding some functionality to the inverter module, so i can rule this out as being a problem.
    2) ...
    3) I will try this, i am running matlab 2014b so i am a couple of versions behind. I will try setting the DYLD_LIBRARY_PATH to where matlab is installed and not relying on the symbolic link. My main suspicion is on the upgrade to El Capitan (and as you mention SIP) and not on Matlab, but i will try to dig a bit more into it and see if i can solve it.

    I will let you know if i find a solutions. Once again thank you for the help.

    Best regards,
    Rasmus

     
  • Rasmus Pedersen

    Rasmus Pedersen - 2015-12-07

    Hi again,

    I solved the problem, and it was exactly as you said Dave. The problem is with the new System Integrity Protection (SIP) which comes with El Capitan. It is no longer possible to change the DYLD_LIBRARY_PATH. In order to make it work you need to do the following:

    1) Restart your mac
    2) Before it boots, hold down cmd-R to boot in recovery mode. When the apple icon is shown along with a progress bar you can release.
    3) From the utilities menu in the top, open a terminal
    4) In the terminal write: csrutil disable
    5) You should see a message that SIP has been disabled
    6) From the top apple menu select restart.
    7) Now everything works as before.
    8) SIP can be enabled again following the same steps and writing the following in the terminal: csrutil enable

    While this makes the matlab.link functionality work, i am not sure it is the best way to go in the future.

    Do anyone have a suggestion for how to make matlab.link work without using DYLD_LIBRARY_PATH? I can see that many people have problems in El Capitan with this issue.

    Thank you again Dave for the support.

    Best regards,
    Rasmus

     
  • David P. Chassin

    I was afraid of that. It sounds a lot like SElinux. I suggest filing a ticket on this and we will have to work on a more permanent solution that does not undermine new system security features.

     
  • BryanP

    BryanP - 2016-06-01

    This problem is not limited to matlab link, but rather prevents all installs under OSX 10.11 (El Capitan) with the latest stable release (3.2.0-5368) I have openned a new ticket (#966) considering the much larger implications for mac users.

     
  • David P. Chassin

    I just built the 3.2 patch 1 RC for OSX. I've attached it here. Would someone with an El Capitan system let me know if this works? Thanks.

     
    • BryanP

      BryanP - 2016-06-07

      @dchassin: Almost. With the default options it now shows a helpful warning that it might not be compatible for the current version of OSX. When I select "install anyway" it seems to spend a bit longer on the install and then again fails with the same error.

      However, the issue seems to be with some of the addtional features included in the install. When I use the "Customize" button and only select "Core" (ie uncheck Xerces, weather files, and developer) the installation succeeds!

      I am then also able to run some simple demo codes using just this core. So certainly on the right track.

       
  • David P. Chassin

    Interesting. Can you upload the validate.txt output when run on branch/3.2?

     

Log in to post a comment.