So, I love my Macbook, and she loves me. We have our ups and downs, but for the most part our relationship has been strong. Recently though we had a fight. it started out simply enough. I was asking her to do more, trying to be more experimental. We brought things like sse, fast math, and unrolling into the bedroom and compiled new versions of our libraries.
It started out well enough. We'd compile some code using the new libraries, test out the new waters. Over time our performance as a couple soared. She was working faster and I thought all was well and good. Then things took a turn for the worse. We brought another player into the mix. Her name is Matlab.
We started compiling for Matlab,
mex CC="gcc" CFLAGS="\$CFLAGS -msse -msse2 -msse3 -ffast-math -ftree-vectorize" LDFLAGS="\$LDFLAGS -msse2 -msse3 -ffast-math -ftree-vectorize" -I/usr/local/include -L/usr/local/lib -lsundials_cvode -lsundials_nvecserial -v -o kry_new.mexmaci64 mex_main.c
compiling and linking worked great. But then the trouble started:
kry_new(param,init,0:60:240,abstol,rtol,1)
??? Invalid MEX-file
'/Users/Andrew/Documents/MATLAB/het_optim/kry_new.mexmaci64':
dlopen(/Users/Andrew/Documents/MATLAB/het_optim/kry_new.mexmaci64, 1):
Library not loaded: /usr/local/lib/libsundials_cvode.1.dylib
Referenced from: /Users/Andrew/Documents/MATLAB/het_optim/kry_new.mexmaci64
Reason: Incompatible library version: kry_new.mexmaci64 requires version
2.0.0 or later, but libsundials_cvode.1.dylib provides version 1.0.0.
Matlab felt that our experiments had gone to far. That they were totally different versions of the libraries. I don't know where she got this idea. I did some investigating:
$ otool -L kry_new.mexmaci64
kry_new.mexmaci64:
/usr/local/lib/libsundials_cvode.1.dylib (compatibility version 2.0.0, current version 2.0.0)
@loader_path/libsundials_nvecserial.0.0.2.dylib (compatibility version 0.0.0, current version 0.0.2)
@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.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
The problem was in libsundials_cvode. There was no version 2, there never was. To make matters worse, my Macbook took Matlab's side. I tried uninstalling, striping out all references to the new things, even deleted our make files and tried to start again. I tried to rebuild our libraries the old way. But they wouldn't let go of the elusive version 2. I didn't know how to give them what they wanted. I just wasn't man enough to meet their expectations of me.
The only thing I could guess was that at some point, version 2 made sense, but that I backed away from it somehow. I guess the link I had presented stayed in their minds even when I went back to the way it was. I guess I forgot the first rule of that birds and the bees talk given by my sys admin, "Every time you symbolink a dynamic library you give part of yourself away that you never get back."
In desperation to keep both my Macbook and Matlab in my life, I told a lie that I'm not proud of:
sudo mv libsundials_cvode.1.0.0.dylib libsundials_cvode.2.0.0.dylib
I didn't think it would work, but it did. They compile my code now and they appear happy enough. But I have the lingering feeling that I'm just faking it, and that my lie will come back to bite me.
So, since Dan Savage just ignores me, I turn to you stackoverflow for relationship advice. I need to somehow tell my Macbook that, no, version 1.0.0 is enough for us. How can I get her to listen to me and fix the compatibility issues in my relationship without my horrible lie?