在chroot环境中安装Qt 4.8.0
make[1]: Entering directory `/root/qt-everywhere-opensource-src-4.8.0/src/corelib'
g++ -c -pipe -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O2 -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DELF_INTERPRETER=\"/lib/ld-linux.so.2\" -DQLIBRARYINFO_EPOCROOT -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared -Iglobal -I../../tools/shared -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared -o .obj/release-shared/qabstractanimation.o animation/qabstractanimation.cpp
In file included from ../../include/QtCore/qobject.h:1,
from animation/qabstractanimation.h:45,
from animation/qabstractanimation.cpp:145:
../../src/corelib/kernel/qobject.h: In function `T qFindChild(const QObject*,
const QString&)':
../../src/corelib/kernel/qobject.h:356: error: syntax error before `>' token
../../src/corelib/kernel/qobject.h: In function `QList<T> qFindChildren(const
QObject*, const QString&)':
../../src/corelib/kernel/qobject.h:361: error: syntax error before `>' token
../../src/corelib/kernel/qobject.h: In function `QList<T> qFindChildren(const
QObject*, const QRegExp&)':
../../src/corelib/kernel/qobject.h:368: error: syntax error before `>' token
make[1]: *** [.obj/release-shared/qabstractanimation.o] Error 1
make[1]: Leaving directory `/root/qt-everywhere-opensource-src-4.8.0/src/corelib'
make: *** [sub-corelib-make_default-ordered] Error 2
354 template<typename T> 355 inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString()) 356 { return o->findChild<T>(name); } 357 358 template<typename T> 359 inline QT_DEPRECATED QList<T> qFindChildren(const QObject *o, const QString &name = QString()) 360 { 361 return o->findChildren<T>(name); 362 } 363 364 #ifndef QT_NO_REGEXP 365 template<typename T> 366 inline QT_DEPRECATED QList<T> qFindChildren(const QObject *o, const QRegExp &re) 367 { 368 return o->findChildren<T>(re); 369 }
make又报错:
没有 linux/futex.h 头文件
从系统/usr/include/linux/futex.h 目录拷贝到chroot目录对应位置,继续make。
.obj/release-shared/qthread_unix.o(.text+0x50): In function `set_thread_data(QThreadData*)': : undefined reference to `___tls_get_addr' .obj/release-shared/qthread_unix.o(.text+0x62b): In function `QThreadData::current()': : undefined reference to `___tls_get_addr' .obj/release-shared/qthread_unix.o(.text+0x71b): In function `QThreadData::current()': : undefined reference to `___tls_get_addr' collect2: ld returned 1 exit status make[1]: *** [../../lib/libQtCore.so.4.8.0] Error 1 make[1]: Leaving directory `/root/qt-everywhere-opensource-src-4.8.0/src/corelib' make: *** [sub-corelib-make_default-ordered] Error 2
On 10 Jan 2007 07:46:16 -0800, Ian Lance Taylor <[email protected]> wrote:"marco turchi" <[email protected]> writes:
> Dear All, > I'm a new user of this mailing list. > I've this problem. > I had an old gcc version on my laptop so I downloaded the 4.1 and I > installed it using the following commands: > > configure --enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c,c++ > make bootstrap > make install > everything worked, but now when I have to install some software and > when I run the configure file of this software, I obtain the following > error during the configure phase: > configure:2348: checking for C++ compiler default output file name > configure:2375: g++ conftest.cpp >&5 > /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libstdc++.so: > undefined reference to `___tls_get_addr' > collect2: ld returned 1 exit status
You are compiling a program which uses __thread. This requires support from the compiler, the linker, and the C library. It looks like you need to upgrade your C library.
Or perhaps you can simply configure the program you want to use to not use __thread (also known as TLS).
引自:http://gcc.gnu.org/ml/gcc-help/2007-01/msg00093.html
g++ 版本如下:
[root@linux qt-everywhere-opensource-src-4.8.0]# g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
make报如下错误:
make[2]: Entering directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/JavaScriptCore' g++ -c -pipe -Wall -Wextra -Wreturn-type -fno-strict-aliasing -Wcast-align -Wchar-subscripts -Wformat-security -Wreturn-type -Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-switch-enum -Wundef -Wmissing-noreturn -Winit-self -Werror -O3 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -D_REENTRANT -DNDEBUG -DBUILDING_QT__=1 -DNDEBUG -DQT_ASCII_CAST_WARNINGS -DBUILDING_JavaScriptCore -DBUILDING_WTF -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_SHARED -I../../../../../mkspecs/linux-g++ -I. -I../../../../../include/QtCore -I../../../../../include -I. -I../../Source -I../ThirdParty -Iassembler -Ibytecode -Ibytecompiler -Iheap -Idfg -Idebugger -Iinterpreter -Ijit -Iparser -Iprofiler -Iruntime -Iwtf -Iwtf/gobject -I/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/JavaScriptCore/wtf/symbian -Iwtf/unicode -Iyarr -IAPI -IForwardingHeaders -Igenerated -I../../Source -I../../include -I/include/QtWebKit -I/include -I.moc/release-static -o .obj/release-static/Assertions.o wtf/Assertions.cpp cc1plus: warnings being treated as errors wtf/Assertions.cpp:31: warning: ignoring #pragma GCC diagnostic make[2]: *** [.obj/release-static/Assertions.o] Error 1 make[2]: Leaving directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/JavaScriptCore' make[1]: *** [sub-JavaScriptCore-JavaScriptCore-pro-make_default-ordered] Error 2 make[1]: Leaving directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source' make: *** [sub-webkit-make_default-ordered] Error 2
可以看到编译选项中有-Werror,这是要求g++在编译时把警告当error来处理,在 wtf/Assertions.cpp:31处又使用了#pragma GCC diagnostic ignored “-W……”预编译选项,而这个选项将给出一个警告,也就被当成错误了。于是我把JavaScriptCore目录里的Makefile.Webkit里的“-Werror”选项去掉了。编译时这个地方通过了。
make[1]: Entering directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source' cd JavaScriptCore/ && make -f Makefile.WebKit make[2]: Entering directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/JavaScriptCore' g++ -c -pipe -Wall -Wextra -Wreturn-type -fno-strict-aliasing -Wcast-align -Wchar-subscripts -Wformat-security -Wreturn-type -Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-switch-enum -Wundef -Wmissing-noreturn -Winit-self -O3 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -D_REENTRANT -DNDEBUG -DBUILDING_QT__=1 -DNDEBUG -DQT_ASCII_CAST_WARNINGS -DBUILDING_JavaScriptCore -DBUILDING_WTF -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_SHARED -I../../../../../mkspecs/linux-g++ -I. -I../../../../../include/QtCore -I../../../../../include -I. -I../../Source -I../ThirdParty -Iassembler -Ibytecode -Ibytecompiler -Iheap -Idfg -Idebugger -Iinterpreter -Ijit -Iparser -Iprofiler -Iruntime -Iwtf -Iwtf/gobject -I/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/JavaScriptCore/wtf/symbian -Iwtf/unicode -Iyarr -IAPI -IForwardingHeaders -Igenerated -I../../Source -I../../include -I/include/QtWebKit -I/include -I.moc/release-static -o .obj/release-static/JSParser.o parser/JSParser.cpp parser/JSParser.cpp:184: error: ‘enum JSC::JSParser::SourceElementsMode’ is private parser/JSParser.cpp:687: error: within this context parser/JSParser.cpp:227: error: ‘enum JSC::JSParser::FunctionRequirements’ is private parser/JSParser.cpp:1304: error: within this context make[2]: *** [.obj/release-static/JSParser.o] Error 1 make[2]: Leaving directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/JavaScriptCore' make[1]: *** [sub-JavaScriptCore-JavaScriptCore-pro-make_default-ordered] Error 2 make[1]: Leaving directory `/root/qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source' make: *** [sub-webkit-make_default-ordered] Error 2
把两个enum类型定义为public即可。
只好修改3rdparty/webkit/Source/WebCore/platform/text/SegmentedString.h文件里的以下两个函数:
LookAheadResult lookAhead(const String& string) { return eqt(string,SegmentedString::equalsLiterally);} LookAheadResult lookAheadIgnoringCase(const String& string) { return eqt(string,SegmentedString::equalsIgnoringCase);}