Perhaps when the HDF binaries are built they should be built somewhere like /Library/Frameworks/ or /Users/Shared/Library to avoid this type of runtime problem. For the end developer who is going to distribute an OS X Application with HDF5 support it is typical to embed the hdf5 library into the .app bundle then run "install_name_tool" to change that path to the proper @executable_path/../lib or something like that.
___________________________________________________________ Mike Jackson www.bluequartz.net Principal Software Engineer [email protected] BlueQuartz Software Dayton, Ohio On Mar 22, 2011, at 10:12 AM, Ian Hinder wrote: > Hi, > > The hdf5-1.8.6-macosx64-shared binary available at > > http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz > > contains hard-coded paths to a particular user's directory, presumably the > developer who built the binary. This means that when you try to run an > executable which is linked against this installation on your own machine, you > get an error message. A workaround is to use the statically linked version > which doesn't suffer from this problem. > > Steps to reproduce: > > wget > http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz > > tar xfz hdf5-1.8.6-macosx64-shared.tar.gz > > cat >testhdf5.c > #include "hdf5.h" > > int main() > { > H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); > return 0; > } > ^D > > gcc -o testhdf5 -Ihdf5-1.8.6-macosx64-shared/include -lhdf5 -lsz -lz > -Lhdf5-1.8.6-macosx64-shared/lib testhdf5.c > > MacBook:hdf5bin ian$ ./testhdf5 > dyld: Library not loaded: > /Users/epourmal/Working/_tmp_shared/hdf5/lib/libhdf5.6.dylib > Referenced from: /Users/ian/Projects/misc/hdf5bin/./testhdf5 > Reason: image not found > Trace/BPT trap > > MacBook:hdf5bin ian$ grep "/Users" hdf5-1.8.6-macosx64-shared/lib/lib*.la > hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:dependency_libs=' > -L/Users/epourmal/Working/lib/ZLIB-U/lib > -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm' > hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib' > hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:dependency_libs=' > -L/Users/epourmal/Working/lib/ZLIB-U/lib > -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm' > hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib' > hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:dependency_libs=' > -L/Users/epourmal/Working/lib/ZLIB-U/lib > -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm' > hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib' > hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:dependency_libs=' > -L/Users/epourmal/Working/lib/ZLIB-U/lib > -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm' > hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib' > > Also, the h5cc script in the bin directory seems to use this user's home > directory as a default location where it will look for HDF5, which probably > isn't correct. > > -- > Ian Hinder > [email protected] > > > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org _______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
