转载时请注明出处和作者联系方式
文章出处:http://blog.csdn.net/jack0106
作者联系方式:冯牮 fengjian0106@yahoo.com.cn
一 配置编译tracker-0.9.8
我使用的版本是tracker-0.9.8,我的配置脚本是(安装在了/usr目录):
./configure --prefix=/usr --enable-taglib --enable-gcov --enable-unit-tests --enable-gstreamer-tagreadbin --enable-gdkpixbuf --enable-video-extractor=gstreamer --enable-gstreamer-helix --enable-gnome-keyring --enable-network-manager --enable-miner-evolution --enable-tracker-status-icon --enable-tracker-explorer --enable-tracker-search-bar --enable-tracker-search-tool --enable-tracker-preferences --enable-poppler --enable-libexif --enable-libiptcdata --enable-libgsf --enable-libgif --enable-libjpeg --enable-libtiff --enable-libvorbis --enable-libflac --enable-exempi --enable-playlist --enable-nautilus-extension --enable-maemo
此配置脚本的目的是让tracker尽量支持更多的特性,请根据各自的配置结果,安装依赖文件,然后重新配置,直到配置通过为止。
这样得到的配置结果如下:
Build Configuration:
Prefix: /usr
Source code location: .
Compiler: gcc
Compiler Warnings: no
Win32: no
Enable gtk doc (for documentation): no
Enable functional tests: yes
Enable unit tests: yes
Support for ioprio: yes
Support for HAL: no
Support for UPower: no
Support for file monitoring: libinotify
Support for accent stripping (unac): no
Support for Cyrillic languages (enca): no
Support for network status detection: yes
Unicode support library: glib
Applications:
Build with sqlite FTS support: yes
Build tracker-search-tool: yes
Build tracker-preferences: yes
Build tracker-status-icon: yes
Build tracker-explorer: yes
Build tracker-search-bar: yes
Metadata Extractors:
Support libstreamanalyzer: no (disabled)
Support PNG: yes
Support PDF: yes
Support GIF: yes (xmp: yes)
Support JPEG: yes (xmp: yes,exif: yes,iptc: yes)
Support TIFF: yes (xmp: yes,iptc: yes)
Support Vorbis (ogg/etc): yes
Support Flac: yes
Support MS & Open Office: yes
Support XML / HTML: yes
Support embedded / sidecar XMP: yes
Support video formats: yes (GStreamer) (tagreadbin: yes)
Support helix formats (RPM/RM/etc): yes
Support MP3 album art: yes (GdkPixbuf )
Support playlists (w/ Totem): yes
Data Miners:
RSS: no
Evolution: yes (/usr/lib/evolution/2.28/plugins)
KMail: yes
Flickr: no
Plugins:
Nautilus: (tagging widget) yes
Writeback:
Audio files using Taglib: no
XMP: yes
Frameworks:
Support Maemo yes
Warning:
You must make sure sqlite is compiled with --enable-threadsafe
二 libqttracker的配置编译
前提:我的PC上,tracker安装在了/usr目录,Qt-4.7安装在了/usr/local/Trolltech/Qt-4.7.0目录(ubuntu10.04,系统自带的qt,是4.6版本的)
1. 从git://gitorIoUs.org/maemo-af/libqttracker.git下载最新的qttracker代码。
2. 进入目录libqttracker,打开文件projects.pro,搜索其中的SUBDIRS字段,修改成如下形式:
#SUBDIRS = src tests
SUBDIRS = src
3. 我的Qt-4.7被安装在了/usr/local/Trolltech/Qt-4.7.0目录,我希望qttracker使用qt-4.7库,并且安装到/usr/local/Trolltech/Qt-Tracker目录,所以,执行如下命令:
QTDIR=/usr/local/Trolltech/Qt-4.7.0/ /usr/local/Trolltech/Qt-4.7.0/bin/qmake PREFIX=/usr/local/Trolltech/Qt-Tracker
4. 执行make。
make执行完后,进入lib目录,执行ldd libqttracker.so,如果结果类似于如下:
fengjian@fengjian-ubuntu:~/my-work/base-lib/tracker/libqttracker/lib$ ldd libqttracker.so
linux-gate.so.1 > (0x00729000)
libuuid.so.1 > /lib/libuuid.so.1 (0x0082d000)
libQtDBus.so.4 => /usr/local/Trolltech/Qt-4.7.0/lib/libQtDBus.so.4 (0x00ea6000)
libQtXml.so.4 => /usr/local/Trolltech/Qt-4.7.0/lib/libQtXml.so.4 (0x00110000)
libQtCore.so.4 => /usr/local/Trolltech/Qt-4.7.0/lib/libQtCore.so.4 (0x0027d000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x0021d000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00524000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00239000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00155000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00832000)
/lib/ld-linux.so.2 (0x00260000)
libz.so.1 => /lib/libz.so.1 (0x00e1a000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00fe4000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00174000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x0017a000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x0061a000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00183000)
libqttracker.so链接的qt库的路径是/usr/local/Trolltech/Qt-4.7.0/lib/libQtDBus.so.4,如果是这样的情况,则说明正确链接到qt-4.7版本了。
5. 执行make doc,可以生成文档。
6. 执行sudo make install。
执行此命令,会遇到这样的错误描述:make: [install_install_doc] 错误 1 (忽略)
可以忽略这个,然后检查一下/usr/local/Trolltech/Qt-Tracker目录,只要有qttracker的头文件和库就行了。
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
7. 在代码中使用libqttracker库。使用libqttracker源码路径里面的example目录来进行说明。
7.1
执行ls,可以看到example里面有3个子文件夹:
fengjian@fengjian-ubuntu :~/my-work/base-lib/tracker/code-example/examples$ ls
contacts email examples.pro queries
7.2
进入每个子目录,分别编辑每个子目录里面的工程文件,搜索其中的LIBS字段,修改成如下形式:
#LIBS = -lqttracker
INCLUDEPATH + /usr/local/Trolltech/Qt-Tracker/include
LIBS + -L/usr/local/Trolltech/Qt-Tracker/lib -lqttracker
QMAKE_LFLAGS += -Wl,-rpath,/usr/local/Trolltech/Qt-Tracker/lib
7.3
在example目录里执行QTDIR=/usr/local/Trolltech/Qt-4.7.0/ /usr/local/Trolltech/Qt-4.7.0/bin/qmake
然后执行make。
这样的话,在每个子目录里面,就可以看到编译出来的对应的可执行文件了。
原文链接:https://www.f2er.com/sqlite/202871.html