基于mipsel编译Qt4.6.2版本(有具体参数和编译时遇到的问题)

Posted 朝闻道

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于mipsel编译Qt4.6.2版本(有具体参数和编译时遇到的问题)相关的知识,希望对你有一定的参考价值。

1.使用的configure配置为:
./configure -embedded mips -little-endian -xplatform qws/linux-mips-g++ -prefix /opt/qte462-mips -release -opensource -confirm-license -webkit -qt-zlib -qt-libpng -qt-libjpeg -qt-gif -I$QTDIR/include/libz -L$QTDIR/lib -no-qt3support -make libs -nomake examples -nomake demos -no-multimedia -no-phonon -no-phonon-backend -no-accessibility -no-script -no-scripttools -qconfig ranger

之前使用的:
./configure -embedded mips -little-endian -xplatform qws/linux-mips-g++ -prefix /opt/qte450-mips -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-gif -I$QTDIR/include/libz -L$QTDIR/lib -no-qt3support -no-phonon -no-phonon-backend -no-accessibility -no-scripttools -qconfig ranger

针对4.5.0版本

./configure -embedded mips -little-endian -xplatform qws/linux-mips-g++ -prefix /opt/qte450-mips -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-gif -I$QTDIR/include/libz -L$QTDIR/lib -no-qt3support -nomake examples -nomake demos -no-webkit -no-phonon -no-phonon-backend -no-accessibility -no-scripttools -qconfig ranger

./configure -embedded arm -little-endian -xplatform qws/linux-arm-g++ -prefix /opt/qte450-3560e -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-gif  -no-qt3support -nomake examples -nomake demos -no-webkit -no-phonon -no-phonon-backend -no-accessibility -no-scripttools -qconfig ranger

2.在编译qtgui部分时遇到,但并不是每次都会遇到,在第一次编译时就不存在
mipsel-linux-g++ -c -include .pch/release-shared-emb-mips/QtGui -pipe -mips32 -fno-exceptions -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DPNG_NO_ASSEMBLER_CODE -DQT_NO_FONTCONFIG -DFT2_BUILD_LIBRARY -DFT_CONFIG_OPTION_SYSTEM_ZLIB -DQT_NO_OPENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_GTK -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -Ihttp://www.cnblogs.com/mkspecs/qws/linux-mips-g++ -I. -Ihttp://www.cnblogs.com/include/QtCore -Ihttp://www.cnblogs.com/include/QtNetwork -Ihttp://www.cnblogs.com/include -Ihttp://www.cnblogs.com/include/QtGui -I.rcc/release-shared-emb-mips -I../3rdparty/libpng -I../3rdparty/zlib -I../3rdparty/zlib -I../3rdparty/freetype/builds/unix -I../3rdparty/freetype/src -I../3rdparty/freetype/include -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-shared-emb-mips -I.uic/release-shared-emb-mips -o .obj/release-shared-emb-mips/qpnghandler.o image/qpnghandler.cpp
In file included from ../3rdparty/libpng/png.h:501,
                 from image/qpnghandler.cpp:53:
../3rdparty/libpng/pngconf.h:338: error: expected constructor, destructor, or type conversion before \'.\' token
../3rdparty/libpng/pngconf.h:339: error: \'__dont__\' does not name a type
make[1]: *** [.obj/release-shared-emb-mips/qpnghandler.o] 错误 1
make[1]:正在离开目录 `/home/yuchao/qte-4.6.2/src/gui\'

网上提示:
http://forum.soft32.com/linux/conflict-ftstdlib-freetype-library-pngconf-ftopict439998.html
| /* If you encounter a compiler error here, see the explanation 
| * near the end of INSTALL. 
| */ 
Do anyone of you have a idea how to work around such problem? I read the 
INSTALL file. There are two suggestion: 
1. comment out following two lines: 
| __png.h__ already includes setjmp.h; 
| __dont__ include it again.; 
2. use cexcept interface but I don\'t understand that. 
我且将这两行注释掉。

3.编译QTScript的过程中
mipsel-linux-g++ -Wl,-rpath-link,/home/yuchao/qte-4.6.2/lib -fno-exceptions -Wl,--no-undefined -Wl,-O1 -Wl,-rpath,/opt/qte462-mips/lib -Wl,-rpath,/opt/qte462-mips/lib -shared -Wl,-soname,libQtScript.so.4 -o libQtScript.so.4.6.2 obj/release/pcre_compile.o obj/release/pcre_exec.o obj/release/pcre_tables.o obj/release/pcre_ucp_searchfuncs.o obj/release/pcre_xclass.o obj/release/Assertions.o obj/release/ByteArray.o obj/release/HashTable.o obj/release/MainThread.o obj/release/RandomNumber.o obj/release/RefCountedLeakCounter.o obj/release/TypeTraits.o obj/release/CollatorDefault.o obj/release/CollatorICU.o obj/release/UTF8.o obj/release/JSBase.o obj/release/JSCallbackConstructor.o obj/release/JSCallbackFunction.o obj/release/JSCallbackObject.o obj/release/JSClassRef.o obj/release/JSContextRef.o obj/release/JSObjectRef.o obj/release/JSStringRef.o obj/release/JSValueRef.o obj/release/OpaqueJSString.o obj/release/InitializeThreading.o obj/release/JSGlobalData.o obj/release/JSGlobalObject.o obj/release/JSStaticScopeObject.o obj/release/JSVariableObject.o obj/release/JSActivation.o obj/release/JSNotAnObject.o obj/release/JSONObject.o obj/release/LiteralParser.o obj/release/MarkStack.o obj/release/TimeoutChecker.o obj/release/CodeBlock.o obj/release/StructureStubInfo.o obj/release/JumpTable.o obj/release/ARMAssembler.o obj/release/MacroAssemblerARM.o obj/release/JIT.o obj/release/JITCall.o obj/release/JITArithmetic.o obj/release/JITOpcodes.o obj/release/JITPropertyAccess.o obj/release/ExecutableAllocator.o obj/release/JITStubs.o obj/release/BytecodeGenerator.o obj/release/ExceptionHelpers.o obj/release/JSPropertyNameIterator.o obj/release/Interpreter.o obj/release/Opcode.o obj/release/SamplingTool.o obj/release/RegexCompiler.o obj/release/RegexInterpreter.o obj/release/RegexJIT.o obj/release/RegisterFile.o obj/release/ExecutableAllocatorPosix.o obj/release/MarkStackPosix.o obj/release/TCSystemAlloc.o obj/release/ArgList.o obj/release/Arguments.o obj/release/ArrayConstructor.o obj/release/ArrayPrototype.o obj/release/BooleanConstructor.o obj/release/BooleanObject.o obj/release/BooleanPrototype.o obj/release/CallData.o obj/release/Collector.o obj/release/CommonIdentifiers.o obj/release/ConstructData.o obj/release/CurrentTime.o obj/release/DateConstructor.o obj/release/DateConversion.o obj/release/DateInstance.o obj/release/DatePrototype.o obj/release/Debugger.o obj/release/DebuggerCallFrame.o obj/release/DebuggerActivation.o obj/release/dtoa.o obj/release/Error.o obj/release/ErrorConstructor.o obj/release/ErrorInstance.o obj/release/ErrorPrototype.o obj/release/CallFrame.o obj/release/Executable.o obj/release/FunctionConstructor.o obj/release/FunctionPrototype.o obj/release/GetterSetter.o obj/release/GlobalEvalFunction.o obj/release/Identifier.o obj/release/InternalFunction.o obj/release/Completion.o obj/release/JSArray.o obj/release/JSAPIValueWrapper.o obj/release/JSByteArray.o obj/release/JSCell.o obj/release/JSFunction.o obj/release/JSGlobalObjectFunctions.o obj/release/JSImmediate.o obj/release/JSLock.o obj/release/JSNumberCell.o obj/release/JSObject.o obj/release/JSString.o obj/release/JSValue.o obj/release/JSWrapperObject.o obj/release/Lexer.o obj/release/Lookup.o obj/release/MathObject.o obj/release/NativeErrorConstructor.o obj/release/NativeErrorPrototype.o obj/release/Nodes.o obj/release/NumberConstructor.o obj/release/NumberObject.o obj/release/NumberPrototype.o obj/release/ObjectConstructor.o obj/release/ObjectPrototype.o obj/release/Operations.o obj/release/Parser.o obj/release/ParserArena.o obj/release/PropertyDescriptor.o obj/release/PropertyNameArray.o obj/release/PropertySlot.o obj/release/PrototypeFunction.o obj/release/RegExp.o obj/release/RegExpConstructor.o obj/release/RegExpObject.o obj/release/RegExpPrototype.o obj/release/ScopeChain.o obj/release/SmallStrings.o obj/release/StringConstructor.o obj/release/StringObject.o obj/release/StringPrototype.o obj/release/Structure.o obj/release/StructureChain.o obj/release/UString.o obj/release/HeavyProfile.o obj/release/Profile.o obj/release/ProfileGenerator.o obj/release/ProfileNode.o obj/release/Profiler.o obj/release/TreeProfile.o obj/release/DateMath.o obj/release/FastMalloc.o obj/release/Threading.o obj/release/MainThreadQt.o obj/release/ThreadingQt.o obj/release/Grammar.o obj/release/qscriptclass.o obj/release/qscriptclasspropertyiterator.o obj/release/qscriptcontext.o obj/release/qscriptcontextinfo.o obj/release/qscriptengine.o obj/release/qscriptengineagent.o obj/release/qscriptextensionplugin.o obj/release/qscriptprogram.o obj/release/qscriptstring.o obj/release/qscriptvalue.o obj/release/qscriptvalueiterator.o obj/release/qscriptable.o obj/release/qscriptfunction.o obj/release/qscriptobject.o obj/release/qscriptclassobject.o obj/release/qscriptvariant.o obj/release/qscriptqobject.o obj/release/qscriptglobalobject.o obj/release/qscriptactivationobject.o obj/release/qscriptdeclarativeobject.o obj/release/qscriptdeclarativeclass.o obj/release/qscriptast.o obj/release/qscriptastvisitor.o obj/release/qscriptgrammar.o obj/release/qscriptsyntaxchecker.o obj/release/qscriptlexer.o obj/release/qscriptdate.o obj/release/moc_qscriptextensionplugin.o   -L/home/yuchao/qte-4.6.2/lib -lQtCore -L/home/yuchao/qte-4.6.2/lib -lpthread  
obj/release/JSValue.o: In function `QTJSC::toUInt32SlowCase(double, bool&)\':
JSValue.cpp:(.text+0x114): undefined reference to `trunc\'
obj/release/JSValue.o: In function `QTJSC::toInt32SlowCase(double, bool&)\':
JSValue.cpp:(.text+0x244): undefined reference to `trunc\'
obj/release/JSValue.o: In function `QTJSC::JSValue::toInteger(QTJSC::ExecState*) const\':
JSValue.cpp:(.text+0x374): undefined reference to `trunc\'
obj/release/JSValue.o: In function `QTJSC::JSValue::toIntegerPreserveNaN(QTJSC::ExecState*) const\':
JSValue.cpp:(.text+0x3ec): undefined reference to `trunc\'
obj/release/DateMath.o: In function `QTWTF::timeClip(double)\':
DateMath.cpp:(.text+0x30c): undefined reference to `trunc\'
collect2: ld returned 1 exit status
make: *** [http://www.cnblogs.com/lib/libQtScript.so.4.6.2] 错误 1

在QTScript中引用的是src/3dparty/javascriptcore的文件,故将相应目录*/JavaScriptCore/wtf/MathExtras.h中将trunc定义打开后trunc问题ok
4.webkit库链接:
并且可以看到它只需要链接的qt库为: -L/home/yuchao/qte-4.6.2/lib -lQtGui -L/home/yuchao/qte-4.6.2/lib -lQtNetwork -lQtCore

rm -f libQtWebKit.so.4.6.2 libQtWebKit.so libQtWebKit.so.4 libQtWebKit.so.4.6
mips-linux-g++ -Wl,-rpath-link,/home/yuchao/qte-4.6.2/lib -fno-exceptions -Wl,--no-undefined -Wl,--gc-sections -Wl,-O1 -Wl,-rpath,/opt/qte462-mips/lib -Wl,-rpath,/opt/qte462-mips/lib -shared -Wl,-soname,libQtWebKit.so.4 -o libQtWebKit.so.4.6.2 obj/release/pcre_compile.o obj/release/pcre_exec.o obj/release/pcre_tables.o obj/release/pcre_ucp_searchfuncs.o obj/release/pcre_xclass.o obj/release/Assertions.o obj/release/ByteArray.o obj/release/HashTable.o obj/release/MainThread.o obj/release/RandomNumber.o obj/release/RefCountedLeakCounter.o obj/release/TypeTraits.o obj/release/CollatorDefault.o obj/release/CollatorICU.o obj/release/UTF8.o obj/release/JSBase.o obj/release/JSCallbackConstructor.o obj/release/JSCallbackFunction.o obj/release/JSCallbackObject.o obj/release/JSClassRef.o obj/release/JSContext
..................... 
..................... 
j/release/JSSVGTransform.o obj/release/JSSVGTransformList.o obj/release/JSSVGTRefElement.o obj/release/JSSVGTSpanElement.o obj/release/JSSVGUnitTypes.o obj/release/JSSVGUseElement.o obj/release/JSSVGViewElement.o obj/release/JSWebSocket.o obj/release/JSAbstractWorker.o obj/release/JSDedicatedWorkerContext.o obj/release/JSSharedWorker.o obj/release/JSSharedWorkerContext.o obj/release/JSWorker.o obj/release/JSWorkerContext.o obj/release/JSWorkerLocation.o obj/release/JSDOMParser.o obj/release/JSXMLHttpRequest.o obj/release/JSXMLHttpRequestException.o obj/release/JSXMLHttpRequestProgressEvent.o obj/release/JSXMLHttpRequestUpload.o obj/release/JSXMLSerializer.o obj/release/JSXPathNSResolver.o obj/release/JSXPathException.o obj/release/JSXPathExpression.o obj/release/JSXPathResult.o obj/release/JSXPathEvaluator.o obj/release/JSXSLTProcessor.o obj/release/CSSGrammar.o obj/release/htmlNames.o obj/release/HTMLElementFactory.o obj/release/JSHTMLElementWrapperFactory.o obj/release/XMLNames.o obj/release/UserAgentStyleSheetsData.o obj/release/XPathGrammar.o obj/release/moc_qwebplugindatabase_p.o obj/release/moc_DnsPrefetchHelper.o obj/release/moc_qwebframe.o obj/release/moc_qwebhistoryinterface.o obj/release/moc_qwebpluginfactory.o obj/release/moc_qwebinspector.o obj/release/qrc_WebCore.o obj/release/qrc_WebKit.o   -L/home/yuchao/qte-4.6.2/lib -lQtGui -L/home/yuchao/qte-4.6.2/lib -lQtNetwork -lQtCore -lpthread  
obj/release/Collector.o: In function `JSC::Heap::markCurrentThreadConservativelyInternal(JSC::MarkStack&)\':
Collector.cpp:(.text._ZN3JSC4Heap39markCurrentThreadConservativelyInternalERNS_9MarkStackE+0x74): undefined reference to `__libc_stack_end\'
obj/release/JSValue.o: In function `JSC::toUInt32SlowCase(double, bool&)\':
JSValue.cpp:(.text._ZN3JSC16toUInt32SlowCaseEdRb+0xf8): undefined reference to `trunc\'
obj/release/JSValue.o: In function `JSC::toInt32SlowCase(double, bool&)\':
JSValue.cpp:(.text._ZN3JSC15toInt32SlowCaseEdRb+0xc0): undefined reference to `trunc\'
obj/release/JSValue.o: In function `JSC::JSValue::toInteger(JSC::ExecState*) const\':
JSValue.cpp:(.text._ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE+0xc0): undefined reference to `trunc\'
obj/release/JSValue.o: In function `JSC::JSValue::toIntegerPreserveNaN(JSC::ExecState*) const\':
JSValue.cpp:(.text._ZNK3JSC7JSValue20toIntegerPreserveNaNEPNS_9ExecStateE+0x3c): undefined reference to `trunc\'
obj/release/DateMath.o: In function `WTF::timeClip(double)\':
DateMath.cpp:(.text._ZN3WTF8timeClipEd+0x5c): undefined reference to `trunc\'
obj/release/qt_runtime.o:qt_runtime.cpp:(.text._ZN3JSC8Bindings22convertQVariantToValueEPNS_9ExecStateEN3WTF10PassRefPtrINS0_10RootObjectEEERK8QVariant+0x4d0): more undefined references to `trunc\' follow
collect2: ld returned 1 exit status
make[1]: *** [http://www.cnblogs.com/http://www.cnblogs.com/lib/libQtWebKit.so.4.6.2] 错误 1
make[1]:正在离开目录 `/home/yuchao/qte-4.6.2/src/3rdparty/webkit/WebCore\'
make: *** [sub-webkit-make_default-ordered] 错误 2

(1)在src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h中将trunc定义打开后
     trunc问题ok
(2)undefined reference to `__libc_stack_end
  在Collector.cpp将UCLIBC_USE_PROC_SELF_MAPS定义关闭
  但在4.5版本中是否遇到这个问题,还是修改了其他宏如__UCLIBC__:
#ifdef __UCLIBC__ 
// versions of uClibc 0.9.28 and below do not have // pthread_getattr_np or pthread_attr_getstack. 
#if __UCLIBC_MAJOR__ == 0 && \\ 
    (__UCLIBC_MINOR__ < 9 || \\ 
     (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 30))
#define UCLIBC_USE_PROC_SELF_MAPS 1
#include <stdio_ext.h> 
extern int *__libc_stack_end;
#endif
#endif

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

网上参考:QtEmbedded在MIPS平台编译的一个常见错误
http://www.cuteqt.com/blog/?p=911
此外见http://www.qtcn.org/bbs/read.php?tid=26709&page=2

本站所有文章由本站和原作者保留一切权力,仅在保留本版权信息、原文链接、原文作者的情况下允许转载,转载请勿删改原文内容, 并不得用于商业用途。 谢谢合作。 
原文链接:QtEmbedded在MIPS平台编译的一个常见错误

错误输出为
libQtWebKit.so: undefined reference to `trunc’
libQtWebKit.so: undefined reference to `lroundf’
libQtWebKit.so: undefined reference to `roundf’
libQtWebKit.so: undefined reference to `lround’

这些函数是定义在Linux下的数学库里的,也就是libm.so或者libm.a。但是有些toolchina在做基本库的时候,并没有把这些函数包括进去,你在Linux Shell命令行下,可以用
$ nm libm.so | grep trunc
或者
$ strings libm.so |grep trunc
查看是否定义了对应的函数。

最直观的解决方法就是重新编译一个带有trunc/roundf这些函数的数学库。也可以造福其它引用libm库的应用或应用框架。

如果你只是编译Qt的话,还有一个解决方法,就是自己去实现这些函数。因为Windows版的数学库就是不带这些函数的,所以Qt的代码里已经自带了这些函数的实现代码。我以QtEmbedded-4.5.2为例,看代码
src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h

105 #if COMPILER(MSVC) || COMPILER(RVCT)
106
107 inline long lround(double num) { return static_cast<long>(num > 0 ? num + 0.5 : ceil(num - 0.5)); }
108 inline long lroundf(float num) { return static_cast<long>(num > 0 ? num + 0.5f : ceilf(num - 0.5f)); }
109 inline double round(double num) { return num > 0 ? floor(num + 0.5) : ceil(num - 0.5); }
110 inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); }
111 inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
112
113 #endif
上面看到的这段代码只在MSVC的情况下可以编译,我们自然可以自己的宏去控制它是否编译了,这个宏可以在qmake.conf里的QMAKE_CXXFLAGS或者QMAKE_CFLAGS环境变量中添加
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

4.直接使用新的webkit库时遇到问题:
swapp: can\'t resolve symbol \'_ZN9QHashData14detach_helper2EPFvPNS_4NodeEPvEPFvS1_Eii\' in lib \'/mnt/lib/libQtWebKit.so.4\'
显然webkit的新版本没有将原有修改合并进来

 

http://www.cnblogs.com/yc_sunniwell/archive/2010/06/08/1753704.html

以上是关于基于mipsel编译Qt4.6.2版本(有具体参数和编译时遇到的问题)的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 msvc 2019 编译 QT 4 dll?

mipsel上移植花生壳域名服务

qt 4.6.2 与visual studio 2005 集成(编译方法,以及中间遇到的问题)

mipsel汇编指令学习

Qt 4.6.2 - QPropertyAnimation 不起作用

QtCreator 1.3、Qt 4.6.2 和 cmake 在 windows 上的构建问题