mardi 24 août 2010

SQLite with ICU on MacOSX for 32 and 64 bits (universal lib)


As I compiled Qt for 32 and 64 bits for being able to have the flash plugin working in the QtWebkit.
I will do it until Adobe will release a 64 bits version of its player ... Adobe, please do it asap.

but Qt is relying on sqlite then I had to compile sqlite in 32 and 64 bits.
Still no issue (yet).

The thing is that I want now to have sqlite with the ICU support (for REGEXP, the most important)
and now it become hard because ICU does not support the universal compilation 32 and 64 bits.
(it is 32 or 64 bits)

so how to do then ?

héhéhé, I have now a solution, that works so far, but it is a manual process to get there.
I heard about a tool named "lipo" that can merge 2 libraries into one for to create an universal library.

So now we have to create 2 folders with the ICU sources,
so I propose:
icu64 and icu32

for icu64, in the folder source, type the command
>./runConfigureICU MacOSX --with-library-bits=64

for icu32, in the folder source, type the command
>./runConfigureICU MacOSX --with-library-bits=32

then you have now the libraries for 32 and 64 bits in

now I created a small script file to output the universal libraries into a folder lib_32_64
lipo icu64/source/lib/libicudata.44.1.dylib icu32/source/lib/libicudata.44.1.dylib -create -output lib_32_64/libicudata.44.1.dylib
lipo icu64/source/lib/libicui18n.44.1.dylib icu32/source/lib/libicui18n.44.1.dylib -create -output lib_32_64/libicui18n.44.1.dylib
lipo icu64/source/lib/libicuio.44.1.dylib icu32/source/lib/libicuio.44.1.dylib -create -output lib_32_64/libicuio.44.1.dylib
lipo icu64/source/lib/libicule.44.1.dylib icu32/source/lib/libicule.44.1.dylib -create -output lib_32_64/libicule.44.1.dylib
lipo icu64/source/lib/libiculx.44.1.dylib icu32/source/lib/libiculx.44.1.dylib -create -output lib_32_64/libiculx.44.1.dylib
lipo icu64/source/lib/libicutu.44.1.dylib icu32/source/lib/libicutu.44.1.dylib -create -output lib_32_64/libicutu.44.1.dylib
lipo icu64/source/lib/libicuuc.44.1.dylib icu32/source/lib/libicuuc.44.1.dylib -create -output lib_32_64/libicuuc.44.1.dylib

then I copied back the libraries in lib_32_64 in the icu64/source/lib folder
>cp lib_32_64/* icu64/source/lib

then I go into the icu64/source and run the make install command
>cd icu64/source
>sudo make install

then you can compile SQLite with the ICU support :-)
>./configure CFLAGS="-arch i686 -arch x86_64 -DSQLITE_ENABLE_ICU `icu-config --cppflags`" LDFLAGS="-arch i686 -arch x86_64 `icu-config --ldflags`" --disable-dependency-tracking
>sudo make install

don't forget to install readline and to compile it with the following command before to compile SQLite:
> CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64' ./configure
>sudo make install

and you have now SQLite, readline and ICU with universal 32 and 64 bits libraries!

happy coding!

write to you soon,

lundi 23 août 2010

sqlite configure 32 bits and 64 bits on mac os x

I am running MacOSX in 64 bits.
However for some reasons, I need sometimes to compile some programs in 32 bits (depending on 32 bits libraries)

so I need sqlite in 32 and 64 bits, and I configure it with the following command line:
> CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64' ./configure --disable-dependency-tracking

Write to you soon,

mercredi 11 août 2010

QWebElement is great!

I recently used the Qt API to access the DOM of a web page through QtWebkit. I just hesitated to use it or to use the JQuery (via evaluateJS)

Probably the JS solution would be more extensible (plugins etc), however the additional work to export the data would be also largely more than expected... and one question also came about it. What if the page (that I want to grab information) already has JQuery (different version, when the evaluate happens etc)?

so I went ahead with the QWebElement object... and it is really powerful, easy to use and the CSS 3 syntax is a must. Purely great :-)

QWebElementCollection allTitles = document.findAll("*.title");
foreach( QWebElement e, allTitles ) {

a good link to read about it is from the Qt Labs

jeudi 5 août 2010

ubuntu 10.04 running on vmware fusion 3.1 mac os x

I just installed ubuntu 10.04 on vmware.
I compared it with the fedora but I found ubuntu largely better than fedora, I just find it really great.
I have a mac for now and I am not ready to change but if I had a PC then I will change to ubuntu without any hesitation.

running linux on a vmware has several advantages :-)
when I don't know the results, when I am trying to do something that could damage the system, hop la I do a snapshot :-D really great.

I am very surprised about ubuntu, I didn't think it was so great. it seems to behave a bit the same as macosx. please continue your excellent work.

write to you soon.