Monday, July 16, 2012

Getting 32-bit stuff to work on Ubuntu 64-bit

So, I bought into the hype and install Ubuntu 64-bit on my laptop, ostensibly to run super awesome PCL. Well, turns out not all things are meant to work out. MATLAB student version, for example. It was intentionally designed only for 32-bit machines. While it installs fine, some functionality, like compiling mex files, sadly does not work. So, some lovely hacking was required to get it working on my machine.


Get a simple mex file and try to compile it.  You’ll probably get this error.

/usr/bin/ld: cannot find -lmx


The way to get around that is to run the following command in MATLAB just before you try to compile a mex file

setenv('MATLAB_ARCH', 'glnx86')   (IN MATLAB)


That gets you a little further but you’ll next be hit by

/usr/bin/ld: cannot find -lstdc++


To fix this you need to find your mexopts.sh file and change the line

CLIBS="$CLIBS -lstdc++"


to

CLIBS="$CLIBS -L/home/paul/matlab/R2009a-student/sys/os/glnx86 -lstdc++"


obviously, you’ll need to change /home/paul/matlab to wherever you actually installed MATLAB.

Your next step is to do the following in a bash prompt

ln -s /home/paul/matlab/R2009a-student/sys/os/glnx86/libstdc++.so.6 \
/home/paul/matlab/R2009a-student/sys/os/glnx86/libstdc++.so


again – substituting wherever you installed MATLAB for /home/paul/matlab

Paul was running Ubuntu 9.04 and he got the following error at some point (I can’t remember where)

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory


which was fixed by

sudo apt-get install libc6-dev-i386


That’s pretty much it. You should now be able to compile mex files.


Source: http://www.walkingrandomly.com/?p=1959



Also, my nice Canon printer / all-in-one. Finding Linux drivers in the first place was quite the headache, but making them work on a 64-bit machine? Well, thankfully someone had done that one already.


For each package do the following:
    1. dpkg -x [package].deb common
    2. dpkg --control [package].deb
    3. nano DEBIAN/control
    4. remove the whole "Dependency:" line
    5. cp -a DEBIAN/ common/
    6. dpkb -b common [package].deb
    7. dpkg --force-all -i [package].deb
    8. rm -rf common DEBIAN

The install.sh script should work properly now.

    sudo chown root:root /usr/lib/cups/filter/pstocanonij
    sudo chown root:root /usr/lib/cups/backend/cnijnet




Source: http://dukuntu.blogspot.com/2011/10/mp560-and-1110-64-bit.html

Thanks guys!

No comments:

Post a Comment