我一直在尝试为PowerPC编译Qt X11交叉编程一段时间并且遇到各种问题。
根据我的Qt支持提供的信息,所有人需要做的是:
mkspec/
中的现有目录我使用了linux-g ++并对其进行了修改。运行以下configure命令:
./configure -arch <your arch> -xplatform <your mkspec> -prefix <where you want Qt installed> <other options>
配置完成后,运行make
,然后make install
。您将在-prefix
选项中指定的目录中找到Qt。
有各种各样的问题。
答案 0 :(得分:1)
我的解决方案:
mkspecs/linux-g++
复制到mkspecs/linux-g++-<my arch>
mkspecs/linux-g++/qmake.conf
,如下例所示。 阅读示例文件中的注释以了解具体信息 qplatformdefs.h
,尽管你可能会修改你的架构make
和make install
moc
,uic
等,因此他们会相应地生成代码。/libs
从安装Qt的位置复制到目标lib
文件夹,或者将其放入其他文件夹并将LD_LIBRARY_PATH设置为包括Qt lib
文件夹。# # qmake configuration for linux-g++-ppc_74xx # MAKEFILE_GENERATOR = UNIX TEMPLATE = app CONFIG += qt warn_on release incremental link_prl QT += core gui QMAKE_INCREMENTAL_STYLE = sublib include(../common/g++.conf) include(../common/linux.conf) # # Modifications to g++.conf # # my_arch-g++ is the full executable path of your g++, make sure your PATH # contains the directory for your toolchain # QMAKE_CC = my_arch-g++ QMAKE_CXX = my_arch-g++ QMAKE_LINK = my_arch-g++ QMAKE_LINK_SHLIB = my_arch-g++ # # I had to provide includes and libraries for packages my toolchain does not # provide this is mostly X11 and glib stuff. You'll either have to # cross-compile it yourself or get it from your distribution # QMAKE_CFLAGS = -I/path/to/your/includes \ -L/path/to/your/libs QMAKE_CXXFLAGS = $$QMAKE_CFLAGS # # Modifications to linux.conf # # Same as g++ stuff above # QMAKE_AR = my_arch-ar cqs QMAKE_OBJCOPY = my_arch-objcopy QMAKE_STRIP = my_arch-strip # # I had all kinds of problems linking Qt source with X11 depending on how I # specified the include paths. My toolchain provided most X11 functionality # and I just had to add missing parts in the CXXFLAGS and CFLAGS, # but specifying exactly where to find X11 includes and libraries specific # to my toolchain fixed some of the issues I experienced # QMAKE_INCDIR_X11 = /path/to/your/toolchain/includes QMAKE_LIBDIR_X11 = /path/to/your/toolchain/libs load(qt_config)
<强>更新强>
此解决方案适用于“独立”编译。如果你需要为Angstrom,OpenEmbedded,Android,OpenWRT等构建Qt X11,你将不得不使用他们各自的构建系统进行正确的编译。例如,对于OpenEmbedded目标(即Angstrom),您必须编写BitBake配方。
由于需要支持旧系统,因此出现此问题。使用Embedded Qt不是一个选择。对于新项目,我强烈建议使用Embedded Qt。