- Cache a copy of results of getenv
- setenv as you described
- Call the system command
- Restore the environment variable to the value you cached.
Overriding DYLD library... any problems?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Does anyone know if I will break anything important in Matlab (R2013a on Mac OS X 10.8.4) if I override the DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH environmental variables?
I'm encountering some issues attempting to access netcdf functions via direct system calls. For example
>> system('ncgen -o test.nc test.cdl')
dyld: Library not loaded: /opt/local/lib/libnetcdf.7.dylib
Referenced from: /opt/local/bin/ncdump
Reason: Incompatible library version: ncdump requires version 10.0.0 or later, but libnetcdf.7.dylib provides version 9.0.0
ncdump test.nc: Trace/breakpoint trap
ans =
133
Running the same ncgen command from a terminal prompt works fine. Looking at the environmental variables both within and without Matlab, it looks like Matlab is explicitly setting the DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH variables:
>> getenv('DYLD_FRAMEWORK_PATH')
ans =
/Applications/MATLAB_R2013a.app/sys/os/maci64:/Applications/MATLAB_R2013a.app/bin/maci64/../../Contents/MacOS:/Applications/MATLAB_R2013a.app/bin/maci64:/Applications/MATLAB_R2013a.app/extern/lib/maci64:/Applications/MATLAB_R2013a.app/runtime/maci64
to reference a version that conflicts with my installed version of the netcdf libraries. I can fix my problem if I just reset these two variables, i.e. setenv('DYLD_LIBRARYPATH',''), allowing the system call to find the correct version of the dyld libraries. But I'm curious if I'm going to end up breaking anything important by doing so.
0 comentarios
Respuestas (1)
Ken Atwell
el 10 de Ag. de 2013
Editada: Ken Atwell
el 10 de Ag. de 2013
I imagine things will be just fine if you:
Maybe wrap all of that up in a little help function.
0 comentarios
Ver también
Categorías
Más información sobre NetCDF en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!