QT-SDK4.7.0安装手记
gcc 版本 4.1.2 20080704 (Red Hat 4.1.2-48) arm-linux-gcc version 4.2.2
1. 下载QT-SDK4.7.0安装包,qt-sdk-linux-x86-opensource-2010.05.1.bin (qt.nokia.com), 2. 安装
chmod u+x qt-sdk-linux-x86-opensource-2010.05.1.bin ./qt-sdk-linux-x86-opensource-2010.05.1.bin 按提示下一步即可。 错误:
安装时可能会提示/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found。 执行strings /usr/lib/libstdc++.so.6 | grep GLIBC 返回结果没有GLIBCXX_3.4.9
GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBC_2.0 GLIBC_2.3 GLIBC_2.4 GLIBC_2.3.4 GLIBC_2.1 GLIBC_2.1.3 GLIBC_2.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
/usr/lib/libstdc++.so.6 -> /usr/lib/libstdc++.so.6.0.8,其实这里需要使用libstdc++.so.6.0.10 从网上下载这个文件
(http://dlwt.csdn.net/fd.php?i=815416703469305&s=cff48e537c8492c8419afb6325bbf829),然后把/usr/lib/libstdc++.so.6 -> /usr/lib/libstdc++.so.6.0.8软链接删除,重新做
ln -s /usr/lib/libstdc++.so.6.10 /usr/lib/libstdc++.so.6 重新安装,就可以顺利通过。
3. 下载qt-everywhere-opensource-src-4.7.0.tar.gz
(http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.0.tar.gz)。 解压
tar zxvf qt-everywhere-opensource-src-4.7.0.tar.gz
把解压后的文件再复制两份(一共三份),分别取名为qt-4.7.0-pc; qt-4.7.0-x86; qt-4.7.0-arm;然后开始分别编译: 4. 编译qt-4.7.0-pc, cd qt-4.7.0-pc
./configure make
编译时间很长,大概用了4个多小时,没出现错误。
make install 安装即可。安装路径在/usr/local/Trolltech/Qt-4.7.0。 在安装qt-4.7.0-arm前先安装tslib-1.4 5.安装tslib-1.4 ./autogen.sh
echo \为了防止出现undefined reference to `rpl_malloc' 错误
CONFIG_SITE=arm-linux.autogen \\
./configure CC=arm-linux-gcc CXX=arm-linux-g++ \\ --prefix=/usr/local/tslib-1.4 --host=arm-linux \\ ac_cv_func_mallo_0_nonnull=yes
make
make install
安装路径在/usr/local/tslib-1.4/。
6.安装qt-4.7.0-arm
./configure -prefix /usr/local/Trolltech/Qt-4.7.0-arm \\ -opensource \\ -confirm-license \\ -release -shared \\ -embedded arm \\
-xplatform qws/linux-arm-g++ \\ -depths 16,18,24 \\ -fast \\
-optimized-qmake \\
-pch \\
-qt-sql-sqlite \\ -qt-libjpeg \\ -qt-zlib \\ -qt-libpng \\ -qt-freetype \\
-little-endian -host-little-endian \\ -no-qt3support \\
-no-libtiff -no-libmng \\ -no-opengl \\
-no-mmx -no-sse -no-sse2 \\ -no-3dnow \\ -no-openssl \\ -no-webkit \\ -no-qvfb \\ -no-phonon \\ -no-nis \\ -no-opengl \\ -no-cups \\ -no-glib \\
-no-xcursor -no-xfixes -no-xrandr -no-xrender \\ -no-separate-debug-info \\
-nomake examples -nomake docs -nomake demos -nomake tools \\ -qt-mouse-tslib \\
-I/usr/local/tslib-1.4/include -L/usr/local/tslib-1.4/lib
以下是在网上找到的配置选项说明:
-prefix /usr/local/Trolltech/Qt-4.7.0-arm \\ 编译到指定目录 -no-qt3support \\ 不支持qt3
-qt-zlib \\ 用zlib捆绑qt,在qt中使用zlib
-qt-libtiff \\ -qt-libpng \\ -qt-libmng \\ -qt-libjpeg \\ --------------
-make libs \\ Add part to the list of parts to be built at make time. libs -nomake examples \\ 不编译例子程序和文档 -nomake demos \\ -nomake docs \\ --------------
-no-nis \\ 不编译nis -no-cups \\ -no-iconv \\
--------------
-xplatform qws/linux-arm-g++ \\ 目标平台
-embedded arm \\ -little-endian \\
--------------------------
-qt-freetype \\ Use the libfreetype bundled(捆绑) with Qt -depths 8,16,24,32 \\ 逗号分隔列表到像素点深度。
Comma-separated list of supported bit-per-pixel depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
-qt-gfx-linuxfb \\ Enable a graphics
Possible values for
-no-gfx-transformed \\ Disable graphics
Possible values for
-no-gfx-multiscreen \\ --------------------------
-qt-kbd-tty \\ Enable a keyboard
--------------------------
-qt-mouse-pc \\ Enable a mouse
Possible values for
gmake
出现错误:
-L/usr/local/tslib-1.4/lib -L/home/work/qt/qt-4.7.0-arm/lib -lQtNetwork
-L/usr/local/tslib-1.4/lib -L/home/work/qt/qt-4.7.0-arm/lib -lQtCore -lpthread -lts /usr/local/tslib-1.4/lib/libts.a(ts_load_module.o): In function `__ts_load_module':
ts_load_module.c:(.text+0x80): undefined reference to `dlopen' ts_load_module.c:(.text+0x90): undefined reference to `dlsym' ts_load_module.c:(.text+0xf0): undefined reference to `dlclose' ts_load_module.c:(.text+0x120): undefined reference to `dlclose' collect2: ld returned 1 exit status
gmake[1]: *** [../../lib/libQtGui.so.4.7.0] 错误 1
gmake[1]: Leaving directory `/home/work/qt/qt-4.7.0-arm/src/gui' gmake: *** [sub-gui-make_default-ordered] 错误 2
修改./src/gui/Makefile ...
LIBS = $(SUBLIBS) -L/usr/local/tslib-1.4/lib -L/home/work/qt/qt-4.7.0-arm/lib -lQtNetwork
-L/usr/local/tslib-1.4/lib -L/home/work/qt/qt-4.7.0-arm/lib -lQtCore -lpthread -lts ...
在末尾添加库libdl库,这个库用于动态连接库的操作: ...
LIBS = $(SUBLIBS) -L/usr/local/tslib-1.4/lib -L/home/work/qt/qt-4.7.0-arm/lib -lQtNetwork
-L/usr/local/tslib-1.4/lib -L/home/work/qt/qt-4.7.0-arm/lib -lQtCore -lpthread -lts -ldl
再gmake编译通过,编译时间同样很长,耐心等待把。
gmake install
安装路径在/usr/local/Trolltech/Qt-4.7.0-arm。
至此qt的安装基本完成,可以编译一个界面试试了,关于qt的使用建议阅读qt自带的help文档,里面介绍的很详细,实例代码也很多!