mardi 24 août 2010

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

Hello,

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
>make

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

then you have now the libraries for 32 and 64 bits in
icu32/source/lib
icu64/source/lib

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
>make
>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
>make
>sudo make install

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

happy coding!

write to you soon,
Sylvain

Aucun commentaire:

Enregistrer un commentaire