Hi! On 2/24/00, I posted here to try to get help with a math library problem I was having with Matlab 5.3 on SuSE 6.1. I also posted arounf the same time to a Matlab news group and was answered by a Mathworks employee, who helped me find a workaround. I can now compile and use my Matlab MEX files on my SuSE 6.1 box! In case anyone else has this problem, I thought I'd post my notes here. Steve ***** How to Make C/C++ MEX files for Matlab 5.3 Work in SuSE Linux 6.1 C S Miller, Greg Wolodkin 3-15-00 Problem: MATLAB works properly under SuSE 6.1, but MEX-files written in C that apparently compile without error cause segmentation faults at run time. Reason: MATLAB was developed for the Red Hat 4.2 development environment, meaning that it uses old libc math libraries: version 5, as opposed to version 6, which comes with newer distributions like SuSE 6.1. This problem is similar to that experienced by users of Red Hat 5.2 and later. The Mathworks address the Red Hat 5.2 problem at their web site: http://www.mathworks.com/support/solutions/v5/11129.shtml We will refer to this page as "Solution 11129" or simply "11129" when necessary. The basic idea behind Solution 11129 is correct, but it does not work for SuSE because rpm (the Red Hat Package Manager) does not install the packages mentioned by 11129 and mirrored by Mathworks: it fails to see that some necessary packages are installed when, in fact, they are. All references to the implementation of this solution are to C S Miller's installation of the libraries on his own SuSE Linux 6.1 machine. Solution: We will implement Mathworks Solution 11129 by getting rpm out of the way. 1. Read 11129 carefully, first. Remember that we WILL install the rpm packages it mentions, but NOT with rpm. 2. Get the rpm packages mentioned in 11129, step 1. 3. If you are worried about overwriting /etc/nsswitch.conf: cp /etc/nsswitch.conf /etc/nsswitch.orig 4. Create the following link. ln -s /usr/i486-linux-libc5 /usr/i486-linuxlibc5 5. Find out which packages are contained in each rpm package with the following command: rpm2cpio foo.rpm | cpio -t (e.g. foo.rpm = libc-devel-5.4.38-3.i386.rpm) Check that you do not have files that might be written over by installing these packages. In my case, I found the following conflicts: package* files: gcc-libc5-c++ NONE gcc-libc5 NONE libc5 etc/nsswitch.conf usr/i486-linuxlibc5/lib/libm.so.5.0.9 libc5-devel usr/i486-linuxlibc5/include <empty directory> usr/i486-linuxlibc5/lib/libc.so -> libc.so.5.4.46 usr/i486-linuxlibc5/lib/libm.so -> libm.so.5.0.9 libg++-libc5 N/A libg++-libc5-devel N/A (* rpm -qip foo.rpm will give package names for rpm packages as well as other information.) In my case, none of these packages posed any kind of problem. Also, in my case piping rpm2cpio through cpio (step 6) left previously installed files untouched. If you are concerned about overwriting, make backups. Also, if you find binaries that might be overwritten, you can determine which package they belong to beforehand with the command: rpm -qf pathname/foo Then you will know what to reinstall if you have problems. Note that I did not install the last two packages in the above list. 6. Place each package into its appropriate install directory and run the following command to install: rpm2cpio foo.rpm | cpio -d -i Install directories are as follows: package directory gcc-libc5-c++ / gcc-libc5 /usr libc5 / libc5-devel / libg++-libc5 /usr libg++-libc5-devel /usr 7. Check that you are running a version of ld.so of version 1.9.6 or later by: ls /lib/ld.so* If not, download the latest version from ftp://ftp.ods.com/pub/linux and install it, if necessary. (Mine was 1.9.9, so I have no tips for that.) 8. Do the post-installation fix-ups outlined in step 1 of 11129. In my case, I had to use the full path name of the compiler for the "hello world" program (i.e., /usr/bin/i486-linuxlibc5-gcc). 9. Perform step 2 of 11129. I went ahead and used the full path name of the "new" gcc compiler here as well. 10. Compile and test your MEX files! You're done. Disclaimers: (1) While I believe that it should be possible to run Matlab under any recent Linux distribution, I make no claims about this solution working for anything other than Matlab 5.3 on SuSE 6.1. (2) Someone who knows rpm much better than I may figure out a way to use rpm rather than cpio to implement 11129. If you are such a person and you succeed in using rpm, I'd like to hear from you. --== Sent via Deja.com http://www.deja.com/ ==-- Share what you know. Learn what you don't. -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/