KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to write a matlab mex function which uses libhdf5; My Linux install provides libhdf5-1.8 shared libraries and headers. However, my version of Matlab, r2007b, provides a libhdf5.so from the 1.6 release. (Matlab .mat files bootstrap hdf5, evidently). When I compile the mex, it segfaults in Matlab. If I downgrade my version of libhdf5 to 1.6 (not a long-term option), the code compiles and runs fine. question: how do I solve this problem? how do I tell the mex compilation process to link against /usr/lib64/libhdf5.so.6 instead of /opt/matlab/bin/glnxa64/libhdf5.so.0 ? When I try to do this using -Wl,-rpath-link,/usr/lib64 in my compilation, I get errors like: /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libhdf5.so.0, needed by /opt/matlab/matlab75/bin/glnxa64/libmat.so, may conflict with libhdf5.so.6 /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status mex: link of 'hdf5_read_strings.mexa64' failed. make: *** [hdf5_read_strings.mexa64] Error 1 ack. the last resort would be to download a local copy of the hdf5-1.6.5 headers and be done with it, but this is not future proof (a Matlab version upgrade is in my future.). any ideas? EDIT: per Ramashalanka's excellent suggestions, I A) called mex -v to get the 3 gcc commands; the last is the linker command; B) called that linker command with a -v to get the collect command; C) called that collect2 -v -t and the rest of the flags. The relevant parts of my output: /usr/bin/ld: mode elf_x86_64 /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/crtbeginS.o hdf5_read_strings.o mexversion.o -lmx (/opt/matlab/matlab75/bin
Tags (comma-separated)
Save Edits
Cancel