我正在从源代码编译Qt 5.3,我得到错误,特别是这个:
error: ‘QV4::Property::Property(const QV4::Property&)’ is private
我的配置选项是:
./configure -no-compile-examples -no-opengl -no-openssl -no-fontconfig
这是gmake的结果:
make[3]: Entering directory `/home/niko/qt-everywhere-opensource-src-5.3.1/qtdeclarative/src/qml'
g++ -c -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_INTEGER_EVENT_COORDINATES -DQT_BUILD_QML_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DWTF_EXPORT_PRIVATE= -DJS_EXPORT_PRIVATE= -DWTFReportAssertionFailure=qmlWTFReportAssertionFailure -DWTFReportBacktrace=qmlWTFReportBacktrace -DWTFInvokeCrashHook=qmlWTFInvokeCrashHook -DENABLE_LLINT=0 -DENABLE_DFG_JIT=0 -DENABLE_DFG_JIT_UTILITY_METHODS=1 -DENABLE_JIT_CONSTANT_BLINDING=0 -DBUILDING_QT__ -DWTF_USE_UDIS86=0 -DNDEBUG -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/niko/qt-everywhere-opensource-src-5.3.1/qtbase/mkspecs/linux-g++ -I. -I../../include -I../../include/QtQml -I../../include/QtQml/5.3.1 -I../../include/QtQml/5.3.1/QtQml -Icompiler -I. -I../3rdparty/masm/jit -I../3rdparty/masm/assembler -I../3rdparty/masm/runtime -I../3rdparty/masm/wtf -I../3rdparty/masm/stubs -I../3rdparty/masm/stubs/wtf -I../3rdparty/masm -I../3rdparty/masm/disassembler -I../3rdparty/masm/disassembler/udis86 -Ijit -I. -Ijsruntime -I. -I../3rdparty/double-conversion -Idebugger -Ianimations -I/home/niko/qt-everywhere-opensource-src-5.3.1/qtbase/include -I/home/niko/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtNetwork -I/home/niko/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtCore/5.3.1 -I/home/niko/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtCore/5.3.1/QtCore -I/home/niko/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtCore -I.moc -o .obj/qqmllistaccessor.o util/qqmllistaccessor.cpp
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4managed_p.h: In constructor ‘QV4::ManagedRef::ManagedRef(const QV4::Scoped<QV4::Managed>&)’:
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4managed_p.h:364: warning: lowering visibility of ‘QV4::Value* QV4::extractValuePointer(const QV4::Scoped<T>&) [with T = QV4::Managed]’ to match its type
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4string_p.h: In function ‘QV4::ReturnedValue QV4::value_convert(QV4::ExecutionEngine*, const QV4::Value&) [with T = QV4::String]’:
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4string_p.h:189: warning: lowering visibility of ‘QV4::ReturnedValue QV4::value_convert(QV4::ExecutionEngine*, const QV4::Value&) [with T = QV4::String]’ to match its type
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4managed_p.h: In constructor ‘QV4::StringRef::StringRef(const QV4::Scoped<QV4::String>&)’:../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4managed_p.h:364: warning: lowering visibility of ‘QV4::Value* QV4::extractValuePointer(const QV4::Scoped<T>&) [with T = QV4::String]’ to match its type
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4property_p.h: In member function ‘void QV4::Object::insertMember(QV4::StringRef, QV4::ValueRef, QV4::PropertyAttributes)’:
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4property_p.h:101: error: ‘QV4::Property::Property(const QV4::Property&)’ is private
../../include/QtQml/5.3.1/QtQml/private/../../../../../src/qml/jsruntime/qv4object_p.h:171: error: within this context
make[3]: *** [.obj/qqmllistaccessor.o] Error 1
make[3]: Leaving directory `/home/niko/qt-everywhere-opensource-src-5.3.1/qtdeclarative/src/qml'
make[2]: *** [sub-qml-make_first-ordered] Error 2
make[2]: Leaving directory `/home/niko/qt-everywhere-opensource-src-5.3.1/qtdeclarative/src'
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory `/home/niko/qt-everywhere-opensource-src-5.3.1/qtdeclarative'
make: *** [module-qtdeclarative-make_first] Error 2
-bash-3.2$
我如何修复它?我的系统信息是:
$ g++ -v
Using built-in specs.
Target: x86_64-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,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)
$ rpm -qa|grep relea
redhat-release-5Server-5.9.0.2
redhat-release-notes-5Server-46
$ uname -a
Linux mapserver03 2.6.18-348.el5 #1 SMP Wed Nov 28 21:22:00 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
$
$ pwd
/home/niko/qt-everywhere-opensource-src-5.3.1
$
很可能你的gcc太旧了。您可以通过安装更新的gcc来修复它(例如从源代码,在您的$HOME前缀中)。
这是一个已知的问题,并且已经在Qt bug跟踪器上报告了:
试图使用私有构造函数导致的编译错误
这取决于问题的根本原因,可能会或可能不会在上游修复。
也就是说,用gcc 4.1.2(!)构建Qt 5.3是一个勇敢的行为。无论这个问题如何,我建议更新它。
Edit:这似乎是在开发版本中修复的,所以你可能可以将修复后移植到你发布的tarball中,然后再试一次。或者,您可以尝试最新的开发版本。
https://codereview.qt-project.org//c/84760/