2011/12/20

想要實現並測試touch 所以把qt 跟tslib都裝上
不過 .......問題來了..編qt 不加 example 跟 demos 都沒問題
但加上去就連結錯誤..
以下是經過....


問題; 編譯qt自帶的example 出現連結錯誤

步驟;

/qt/qt-everywhere-opensource-src-4.7.3/examples/touch/fingerpaint# qmake
/qt/qt-everywhere-opensource-src-4.7.3/examples/touch/fingerpaint# make

arm-2009q1/bin/arm-none-linux-gnueabi-g++ -lts -Wl,-O1 -Wl,-rpath,/opt/qticp_tslib/lib -Wl,-rpath,/opt/qticp_tslib/lib -o fingerpaint .obj/release-shared-emb-arm/main.o .obj/release-shared-emb-arm/mainwindow.o .obj/release-shared-emb-arm/scribblearea.o .obj/release-shared-emb-arm/moc_mainwindow.o .obj/release-shared-emb-arm/moc_scribblearea.o    -L/opt/t slib/lib -L/qt/qt-everywhere-opensour ce-src-4.7.3/lib -lQtGui -L/opt/tslib/lib -L/qt/qt-everywhere-opensource-src-4.7.3/lib -lQtCore -lpthread
/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: warning: libz.so.1, needed by /qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so, not found (try using -rpath or -rpath-link)
/opt/qticp_tslib/lib/libQtNetwork.so.4: undefined reference to `accept4@GLIBC_2.10'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `crc32'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `inflateInit2_'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `inflate'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtCore.so: undefined reference to `compress2'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `pipe2@GLIBC_2.9'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `deflateReset'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `deflateInit2_'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `inflateInit_'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `deflateInit_'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtCore.so: undefined reference to `inotify_init1@GLIBC_2.9'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `inflateReset'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `deflate'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtCore.so: undefined reference to `uncompress'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `deflateEnd'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `compress'
/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtGui.so: undefined reference to `inflateEnd'
collect2: ld returned 1 exit status
make: *** [fingerpaint] Error 1


出現上述錯誤

網路上查找相關解答
1.有人說 沒清乾淨
make confclean

殘念....1....

2.沒裝zlib
sudo apt-get zlib1g zlib1g-dev
 
殘念....12....

3.組態錯誤
 First I noticed ./configure -help states -system-zlib as the default
configuration option (*). Though when I ran

./configure
It states:
zlib support ........ yes

I guess this means -qt-zlib is the default (not like stated in -help) since

./configure -system-zlib
states that:
zlib support ........ system


Also the website given in -system-zlib option is outdated

I tried ./configure with both these options
    -qt-zlib ........... Use the zlib bundled with Qt.
 *  -system-zlib ....... Use zlib from the operating system.
                        See http://www.info-zip.org/pub/infozip/zlib

殘念....3....

4.加上 -lz

最後這各 我在 qmake.conf 裡面加上 -lz 就編過了 ..
如果你有加 tslib 也是在這裡加上 -lts

/qt/qt-everywhere-opensource-src-4.7.3/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf


QMAKE_CC                = arm-none-linux-gnueabi-gcc
QMAKE_CXX               = arm-none-linux-gnueabi-g++
QMAKE_LINK              = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++
==>
QMAKE_CC                = arm-none-linux-gnueabi-gcc -lts
QMAKE_CXX               = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK              = arm-none-linux-gnueabi-g++ -lts -lz
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -lts -lz



另外 正常編譯qt
可以不用把example 一起編進去
configure 時 加上 -nomake examples 跟 -nomake demos 就可以

如下;
    ./configure -prefix $QTE_PATH \
            -embedded arm \
            -xplatform qws/linux-arm-gnueabi-g++ \
            -little-endian \
            -no-mouse-pc \
            -no-mouse-linuxtp \
            -no-mouse-linuxinput \
            -no-mouse-qvfb \
            -no-mouse-qnx \
            -qt-kbd-linuxinput \
            -no-kbd-tty \
            -no-kbd-qvfb \
            -no-kbd-qnx \
            -opensource \
            -no-qt3support \
            -no-javascript-jit \
            -no-webkit \
            -release \
            -DQT_QWS_CLIENTBLIT  \
            -DQT_NO_QWS_CURSOR \
            -reduce-relocations \
            -no-scripttools \
            -fast \
            -continue \
            -confirm-license \
            -nomake demos \
            -nomake examples \
            -nomake docs \
            -qt-mouse-tslib -L /opt/tslib/lib -I /opt/tslib/include
            
            
若你想要單獨的example就在example目錄下面自己編就可以
路徑僅供參考 請依照實際環境設定


/qt/qt-everywhere-opensource-src-4.7.3/examples/touch/fingerpaint# qmake
/qt/qt-everywhere-opensource-src-4.7.3/examples/touch/fingerpaint# make
/usr/local/arm-2009q3/bin/arm-none-linux-gnueabi-g++ -lts -lz -Wl,-O1 -Wl,-rpath,/opt/qticp_tslib/lib -Wl,-rpath,/opt/qticp_tslib/lib -o fingerpaint .obj/release-shared-emb-arm/main.o .obj/release-shared-emb-arm/mainwindow.o .obj/release-shared-emb-arm/scribblearea.o .obj/release-shared-emb-arm/moc_mainwindow.o .obj/release-shared-emb-arm/moc_scribblearea.o    -L/opt/tslib/lib -L/qt/qt-everywhere-opensource-src-4.7.3/lib -lQtGui -L/opt/tslib/lib -L/qt/qt-everywhere-opensource-src-4.7.3/lib -lQtNetwork -lQtCore -lpthread
/qt/qt-everywhere-opensource-src-4.7.3/examples/touch/fingerpaint# ls
fingerpaint      main.cpp        mainwindow.h  scribblearea.cpp
fingerpaint.pro  mainwindow.cpp  Makefile      scribblearea.h
/qt/qt-everywhere-opensource-src-4.7.3/examples/touch/fingerpaint#

對了 部分example 與 demo 裡面的程式 可能沒touch 功能..要注意一下囉


//-----------------------------------------------------------------
設定範例

export TSLIB_ROOT=/tslib
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CALIBFILE=$TSLIB_ROOT/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export QWS_MOUSE_PROTO=Tslib:/dev/input/event1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib:/opt/qt/lib

#$TSLIB_ROOT/bin/ts_calibrate
#$TSLIB_ROOT/bin/ts_test
./dials/dials -qws &

全站熱搜

立你斯 發表在 痞客邦 留言(0) 人氣()