df

IT/LINUX/EMBEDDED 2007. 11. 16. 23:40
//zmodem 전송을 위해 설치
# apt-get install lrzsz (06.08.09 13:26)

# apt-get install build-essential

# wget ftp://ftp.trolltech.com/qt/source/qt-embedded-2.3.7.tar.gz
# wget ftp://ftp.trolltech.com/qt/source/qt-x11-2.3.2.tar.gz
# wget ftp://ftp.trolltech.com/qtopia/source/qtopia-free-1.7.0.tar.gz
# wget ftp://ftp.trolltech.com/freebies/tmake/tmake-1.11.tar.gz
=========================================================

sudo apt-get install gcc-3.3

그 후에 gcc-4.1을 실행하느냐 gcc-3.3을 실행하느냐를 결정하기 위해서는 아마 /usr/bin/ 디렉터리의 gcc, g++, cpp 등의 파일의 링크를 조절해주시면 될 것입니다.

=========================================================

QT/X11를 설치하다 보면 아래와 같이 qxml.h에서 에러가 발생하는 경우가 있습니다. 저 같은 경우 qt-x11-2.3.2를 설치하다 경험했습니다.

xml/qxml.h:214: warning: 'class QXmlReader' has virtual functions but non-virtual destructor
xml/qxml.h:402: warning: 'class QXmlContentHandler' has virtual functions but non-virtual destructor
xml/qxml.h:419: warning: 'class QXmlErrorHandler' has virtual functions but non-virtual destructor
xml/qxml.h:428: warning: 'class QXmlDTDHandler' has virtual functions but non-virtual destructor
xml/qxml.h:436: warning: 'class QXmlEntityResolver' has virtual functions but non-virtual destructor
xml/qxml.h:443: warning: 'class QXmlLexicalHandler' has virtual functions but non-virtual destructor
xml/qxml.h:456: warning: 'class QXmlDeclHandler' has virtual functions but non-virtual destructor
xml/qxml.cpp:1518: warning: unused parameter 'ret'
/qt/qtx-2/include/qvaluestack.h: In member function 'T QValueStack<T>::pop() [with T = QMap<QString, QString>]':
xml/qxml.cpp:513: instantiated from here
/qt/qtx-2/include/qvaluestack.h:57: error: cannot convert 'QValueListIterator<QMap<QString, QString> >' to 'const char*' for argument '1' to 'int remove(const char*)'
/qt/qtx-2/include/qvaluestack.h: In member function 'T QValueStack<T>::pop() [with T = QString]':
xml/qxml.cpp:2502: instantiated from here
/qt/qtx-2/include/qvaluestack.h:57: error: cannot convert 'QValueListIterator<QString>' to 'const char*' for argument '1' to 'int remove(const char*)'
make[2]: *** [xml/qxml.o] 오류 1
make[2]: Leaving directory `/qt/qtx-2/src'
make[1]: *** [sub-src] 오류 2
make[1]: Leaving directory `/qt/qtx-2'
make: *** [init] 오류 2

이 에러가 발생하는 이유는 qt 버전은 낮고 q++ 버전이 높기 때문인데, q++이 버전업하면서 문법체크가 엄격해 졌기 때문이라고 합니다. 이럴 때에는 qt-x11-2.3.2의 파일 중에 아래의 내용을 수정한 후 다시 설치하면 해결됩니다.

]# vi src/tools/qvaluestack.h

class Q_EXPORT QValueStack : public QValueList
{
public:
QValueStack() {}
~QValueStack() {}
void push( const T& d ) { append(d); }
T pop()
{
T elem( this->last() );
if ( !this->isEmpty() )
this->remove( this->fromLast() ); // this-> 를 추가합니다.
return elem;
}
T& top() { return this->last(); }
const T& top() const { return this->last(); }
};



=========================================================

QTopia 설치 중 에러


In file included from kernel/qt.h:32,
from allmoc.cpp:16:
/qt/qte/include/qstring.h: In member function `uchar& QChar::cell()':
/qt/qte/include/qstring.h:166: error: cannot bind packed field `((QChar*)this)->QChar::cl' to `uchar&'
/qt/qte/include/qstring.h: In member function `uchar& QChar::row()':
/qt/qte/include/qstring.h:167: error: cannot bind packed field `((QChar*)this)->QChar::rw' to `uchar&'
In file included from kernel/qt.h:62,
from allmoc.cpp:16:
/qt/qte/include/qsortedlist.h: In destructor `QSortedList<type>::~QSortedList()':
/qt/qte/include/qsortedlist.h:51: error: there are no arguments to `clear' that depend on a template parameter, so a declaration of `clear' must be available
/qt/qte/include/qsortedlist.h:51: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
make[1]: *** [allmoc.o] 오류 1
make[1]: Leaving directory `/qt/qte/src'
make: *** [sub-src] 오류 2

웹 검색을 해 보니, 에러가 발생한 이유가 재밌습니다. gcc 컴파일러 버전이 2.9.x 버전에서는 이상 없는데, 3.4.x 버전부터 표준 문법을 더 잘 지키다 보니(?) 발생하는 문제라고 합니다. 예로, base::fuc() 을 this->fun()으로 바꾸면 된다는데, 이건 뭐 알아도 감당이 되어야 말이죠.

이런 이유로 최신 버전의 QTopia를 설치해 보기로 했습니다만 며칠 동안 정말 고생을 많이 했습니다. 지금은 겨우 성공했습니다만 그동안에 만났던 수많은 오류 중에 저를 무척이나 괴롭혔던, 그래서 기억에 남는 오류와 해결 방법을 정리해 보았습니다.

오류 1

QT는 QT/X11, QT/Embedded, QTopia로 나뉩니다. QT/X11과 QT/Embedded를 설치 완료하고 이제 QTopia만 설치하면 되는데, 이런 에러가 발생하더군요.

/usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/sys-include/linux/videodev2.h:436: error: parse error before '*' token /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/sys-include/linux/videodev2.h:438: error: parse error before '*' token /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/sys-include/linux/videodev2.h:439: error: parse error before '}' token /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/sys-include/linux/videodev2.h:810: error: field `win' has incomplete type In file included from mvc.c:37: /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/include/videodev.h:225: error: parse error before '*' token /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/include/videodev.h:226: error: conflicting types for 'clipcount' /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/sys-include/linux/videodev2.h:437: error: previous declaration of 'clipcount' was here /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/include/videodev.h:232: error: parse error before '}' token

정말 난감해서 어떻게 처리할지 몰랐는데, (주)FALINUX의 유영창이사님께서 컴파일러가 만들어진 시점의 커널 소스와 QT 프로그램이 만들어질 때의 커널 소스의 차이로 발생하는 문제라며, 436: error: parse error before '*' token 에서 말을 해 주듯이 '*' token 앞에 있는 키워드에 대해 컴파일러가 알 수 있도록 소스를 수정하라는 도움 말씀을 주셨습니다.

문제의 행에 '*"의 앞은 __user 라는 문장이 있었고, 이 문장을 검색해 보니 compiler.h 에 있네요. 해서 videoodev.h 헤더 파일을 사용하는 모든 파일에 대해 compiler.h 를 추가해 줌으로써 문제를 해결할 수 있었습니다.

   설치 중 에러를 막기 위해 qtopia 소스를 수정합니다.

]# vi ./src/3rdparty/libraries/libavformat/grab.c

<linux/videodev.h> 전에 <linux/compiler.h>를 삽입합니다.

#include <linux/compiler.h>
#include <linux/videodev.h>

]# vi ./src/applications/camera/videocaptureview.cpp

역시 <linux/videodev.h> 전에 <linux/compiler.h>를 삽입합니다.

#include <linux/compiler.h>
#include <linux/videodev.h>
저는 정말이지 QTopia의 소스까지 수정하게 될 줄은 생각지도 못했습니다. 그저 받는 대로 설치하는 것인 줄로만 알았는데 이번에 이런 생각을 고칠 수 있었습니다.

오류 2

오류 1을 잡고 다시 QTopia를 설치하는데 역시 또 에러가 나더군요.

cd games/fifteen && make -f Makefile
make[4]: Entering directory `/qt/qpe-arm/src/games/fifteen'
make[5]: Entering directory `/qt/qpe-arm/src/games/fifteen'
arm-linux-g++? -o fifteen .obj/release-shared/fifteen.o .obj/release-shared/main.o .obj/release-shared/moc_fifteen.o?? -L/usr/local/arm/2.95.3/arm-linux/include/uuid/ -ljpeg -lqtopia2 -lqtopia -lqpe -L/qt/qpe-arm/lib -L/root/qt/qte-2.3.10//lib -lqte
/usr/local/arm/2.95.3/arm-linux/bin/ld: warning: libuuid.so.1, needed by /qt/qpe-arm/lib/libqpe.so, not found (try using -rpath or -rpath-link)
/qt/qpe-arm/lib/libqtopia.so: undefined reference to `uuid_generate'
collect2: ld returned 1 exit status
make[5]: *** [fifteen] 오류 1
make[5]: Leaving directory `/qt/qpe-arm/src/games/fifteen'
make[4]: *** [all] 오류 2
make[4]: Leaving directory `/qt/qpe-arm/src/games/fifteen'
make[3]: *** [sub-games-fifteen] 오류 2
make[3]: Leaving directory `/qt/qpe-arm/src'
make[2]: *** [sub-src-components_pro] 오류 2
make[2]: Leaving directory `/qt/qpe-arm/src'
make[1]: *** [all] 오류 2
make[1]: Leaving directory `/qt/qpe-arm/src'
make: *** [all] 오류 2


관련 함수가 e2fsprogs이고, 제가 설치한 버전이 1.40.2 버전이라 혹시 최신 버전이라서 그런가 하고 다시 가장 많이 눈에 띄는 1.36 버전으로 바꾸어 설치해 보았습니다. 그러나 역시 똑같은 오류만 발생할 뿐이었습니다.

그 렇다면, tmake때문일까 하는 생각에 tmake 1.11로 다시 처음부터 다시 설치해 보았습니다. 역시 같은 오류가 발생. 믿는 것이라고는 웹 검색이라 찾아보니 이 문제로 고생하시는 분들이 많더군요. 모두 질문을 올렸습니다만 답변이 담긴 글은 딱 하나였습니다. 멈추지마라 블로그:: Qtopia 설치 글로, 이분이 해결한 방법은,
]# ln -s libuuid.so libuuid.so.1
이 었습니다. 그러나 저는 libuuid.so.1 이 이미 정상적으로 생성되어 있었습니다. 그래서 또다시 e2fsprogs를 다시 설치해 보았으나 역시 헛고생을 했고, 거의 포기할 생각마저 하게 되었는데, 예전에 Windows-XP를 원격 데스크탑으로 연결하고 파이어버드라는 데이터베이스 서버를 설치했던 기억이 생각이 났습니다.

원격 데스크탑에서 설치하면 제대로 설치가 안 되었던 것이죠. 물론 같은 계정으로 설치했음에도 설치는 되도 실행이 제대로 되지 않아 고생했었거든요.

솔직히 말씀드리면 오류 2 때문에 설치를 반복하는 순간에도 이 생각이 계속 머릿 속을 멤돌았습니다. 그러나 리눅스에서 설마하는 생각에 그냥 넘겼던 것이죠.

시스템 터미널다시 한 번 힘을 내서 텔넷이 아닌 시스템에서 직접 터미널을 이용하여 설치했습니다.
그리고 아무 문제없이 설치할 수 있었습니다. ㅡㅡ;
혹 제가 리눅스를 Virtual PC 2007을 사용하기 때문인지 모르겠습니다. 또한 같은 종류의 가상 PC 프로그램인 VmWare에서도 똑 같은 문제가 있는지 모르겠습니다만 텔넷에서 설치하다가 오류가 발생하면 /usr/arm-linux/lib의 내용을 보려고 ls -al하면 아래와 같이 에러가 나더군요.

[root@jwCentOS lib]# ls -al ls: error while loading shared libraries: librt.so.1: ELF file OS ABI invalid

혹 QTopia 설치 중에 uuid_generate 오류를 만나시거나 기타 이상하게 설치가 안 되시면 텔넷이 아닌 시스템에서 직적 터미널을 이용하여 설치해 보십시오.

Posted by 블루아레나