Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Sunday, September 27, 2009

FFTW issues in Matlab on Mac

For the project I'm currently working on (dVA on sphere), I'm using the Yawtb toolbox, with the S2Kit interface (see previous post) . This interface is faster when it uses FFTW3.
I followed the build instructions for S2Kit, using Macports's FFTW. S2Kit built and tested ok from command line. Testing the integration in Yawtb, I encountered a linker error:

>> yademo s2fst
% Sample(s) of code for S2FST
%
%
>> [phi,theta] = sphgrid(46,46); %%
>> mat = exp(-tan(theta/2).^2) .* ( phi == phi(1,10)); %%
>> fmat = s2fst(mat); %%
??? Invalid MEX-file '/IM2sandbox/yawtb/interfaces/s2kit/s2fst.mexmaci':
dlopen(/IM2sandbox/yawtb/interfaces/s2kit/s2fst.mexmaci, 1): Library not loaded: /opt/local/lib/libfftw3.3.dylib
Referenced from: /IM2sandbox/yawtb/interfaces/s2kit/s2fst.mexmaci
Reason: Incompatible library version: s2fst.mexmaci requires version 6.0.0 or later, but libfftw3.dylib provides version
5.0.0.

Error in ==> yademo at 77
eval(subcode(3:end));

Some googling after (see comments here), I learned that this comes from a version mismatch between Matlab's FFTW and the newer Macports version.

Contrary to Geoffrey, I decided to update the lib in Matlab (quite similarly to the suggestion here). Note: a backup is recommended. In my case, the fix implied copying libfftw3.dylib and libfftw3.dylib from /opt/local/lib to /Applications/MATLAB_R2008b.app/bin/maci/ .

And now, the yademo s2fst example works great :-)
Note that I did not check whether this fix breaks other FFTW related code. YMMV.


Saturday, June 13, 2009

Cross compilation and string issues

Trying to keep the program I am currently working on up-to-date both on my WinXP box and on a Mac, I run into some cross-compilation pitfalls. While the project builds without warnings in vs2005, it seems that gcc on Mac has a lot to complain about.

First of all some deprecated headers apparently used by the macports VTK I'm using:
In file included from /usr/include/c++/4.0.0/backward/strstream:51,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkIOStream.h:112,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkSystemIncludes.h:40,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkIndent.h:24,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkObjectBase.h:43,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkObject.h:41,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkAlgorithm.h:32,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkPolyDataAlgorithm.h:37,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkCubeSource.h:24,
from CamVtkView.h:14,
/usr/include/c++/4.0.0/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the
header for the header for C++ includes, or instead of
the deprecated header . To disable this warning use
-Wno-deprecated.

But other warnings allowed me to spot some bug of my own producing:
CamFrame.cpp:927: warning: cannot pass objects of non-POD type 'class
wxString' through '...'; call will abort at runtime
the line was :

curImg.sprintf("%s%04u.vtk", _vtkRecPrefix, m_nFrmRead);

while what I intended to do was:

curImg.Printf(wxT("%s%04u.vtk"), _vtkRecPrefix, m_nFrmRead);

And I found a link which summarizes well wxString usage:
http://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString

Thursday, June 4, 2009

Mercurial on Mac - UTF-8 locale problems

The Eigen project recently switched to Mercurial. After installing the Macports version of mercurial, it wouldn't work apparently due to locale problems. The solution from this blog post worked for me :

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8


Thanks Lothar. It's really good when the first hit from a google search is spot on. Now I should get back to my own code and build problems.

Wednesday, June 3, 2009

New install on MBP

Since I inherited an orphan MacBookPro in our lab, I decided to use it to test my cross platform builds. But this is not so straightforward. Prior to testing, I need to put some software / libraries on it.
So far :

Todo:
  • Enthought Python
  • code-blocks
  • many more that I forget
Edit:
found a similar blog posting with nice list of apps: http://blog.hyperjeff.net/?p=148. I'll have to take a look at the python distros used here.