Wednesday, 19 November 2008

Failing snapshots in XCode

Did it ever happened to you that the XCode "File > Make Snaphot" fails miserably with a Cannot-change-permissions-somewhere-down-over-/tmp/XY!$%^ ?

Well if so check the permissions of your project file, they must be writable by the owner only. To fix the problem launch a terminal, go in the project folder and use the
chmod -Rv g-w,o-w *
command. Of course double check you really are in the project folder and you really don't need those writing permissions in place.

Wednesday, 5 November 2008

Importing the OmniGroup Frameworks into your Subversion repository

This is a quick reference based on the Vendor Branches of the "Version Control with Subversion" book.

So you want to use the wonderful code that the Omni Group gives you for free. Good, just follow the following instructions.

Create a vendor branch in your repository:
then download the frameworks distribution from the Omni Group site, unpack it in the, say, tmp folder of your home. It will have a structure like:
Now use the program to import the distribution to the repository. -t 2008-09-09 \ \
current \
You will have the code loaded to the current and 2008-09-09 directories.
The next time you import a new version of the frameworks, do the same steps as above. According to the Subversion Book everything will be all right ;)

Thursday, 3 July 2008

Creating an universal static OpenCV library with iPhone support

This post has been updated here. Sorry I have no time to upgrade the iPhone part, I hope someone will share this knowledge ;)

We will create a minimal static universal OpenCV 1.0.0 library with 4 architectures: Intel, PowerPC, x86_64 and Arm for the iPhone. I've been testing it on Leopard and Snow Leopard but it should work on any Mac OS X version.

First checkout or untar the OpenCV sources in the opencv-1.0.0 directory. Then, on the same level (not inside) create a build directory with 4 subdirectories: ppc, i386, x86_64 and arm. (Download the code from Sourceforge)

Then set the global configure settings:
$ export CONFFLAGS="--without-imageio --without-python --without-swig --disable-apps --disable-dependency-tracking --without-carbon --without-quicktime --enable-shared=no --without-gtk"
in the ppc dir:
$ ../../opencv-1.0.0/configure ${CONFFLAGS} --target=ppc-apple-darwin9
$ make CXXFLAGS="-arch ppc"
in the i386 dir:
$ ../../opencv-1.0.0/configure ${CONFFLAGS} --target=i386-apple-darwin9
$ make CXXFLAGS="-arch i386"
in the x86_64 dir:
$ ../../opencv-1.0.0/configure ${CONFFLAGS} --target=x86_64-apple-darwin9
$ make CXXFLAGS="-arch x86_64"

in the arm dir:
$ ../../opencv-1.0.0/configure ${CONFFLAGS} --host =arm-apple-darwin9 CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.2.1 CXXFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk" CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
$ make
the last one is tough, so let's see the variables one by one:
CXXFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk"
Ok. Now for the universal static libs:
$ lipo -create i386/cv/src/.libs/libcv.a x86_64/cv/src/.libs/libcv.a ppc/cv/src/.libs/libcv.a armv6/cv/src/.libs/libcv.a -output libcv.a
$ lipo -create i386/cxcore/src/.libs/libcxcore.a x86_64/cxcore/src/.libs/libcxcore.a ppc/cxcore/src/.libs/libcxcore.a armv6/cxcore/src/.libs/libcxcore.a -output libcxcore.a
$ lipo -create i386/cvaux/src/.libs/libcvaux.a x86_64/cvaux/src/.libs/libcvaux.a ppc/cvaux/src/.libs/libcvaux.a armv6/cvaux/src/.libs/libcvaux.a -output libcvaux.a
$ lipo -create i386/ml/src/.libs/libml.a x86_64/ml/src/.libs/libml.a ppc/ml/src/.libs/libml.a armv6/ml/src/.libs/libml.a -output libml.a
$ lipo -create i386/otherlibs/highgui/.libs/libhighgui.a x86_64/otherlibs/highgui/.libs/libhighgui.a ppc/otherlibs/highgui/.libs/libhighgui.a armv6/otherlibs/highgui/.libs/libhighgui.a -output libhighgui.a

That's all. Oh, try
$ make -j 2

Tuesday, 24 June 2008


Try pkgutil!

Tuesday, 5 February 2008

How to uninstall Mac Os X packages (.pkg)

Mac OS X keeps track of applications installed via the .pkg native installer in the /Library/Receipts folder.

.pkgs appear as files in the Finder but in reality are bundles. Apple nicely conceals information on installed files in the .bom ("bill-of-materials") proprietary binary files. But also ships a lsbom command that reads them (and a mkbom to create them).

So, supposing you want to uninstall a .pkg-distributed file (say... cmake) you have to:

1) check that it ships only files and simbolic links
lsbom | less

2) list the files you are going to delete (checking there is no system file!)
lsbom -f -l -s | less

3) delete them by hand or with the following command as administrator
lsbom -f -l -s -pf | (cd /; xargs -n 1 rm)

Er, you know in advance that if something goes wrong with the command above you wipe out your entire system, don't you?

Thanks to ths Macworld post