从源代码构建 Qt,qmake 是由其脚本使用无效参数调用的吗?

Buv*_*inJ 5 qt qmake

我正在尝试设置 boot2qt 构建环境。它是针对 iMX53 的——并不是说在回答我的问题时它真的很重要......

因此,作为该过程的一部分,我运行了名为“build_qt.sh”的脚本。这会调用带有大量参数的嵌套配置脚本。反过来,该脚本从源代码构建 qmake,然后尝试使用新的 qmake 构建 qt 的其余部分(从它看起来像什么?)。

经过长时间的战斗,我成功地创建了 qmake 二进制文件,但是脚本结束时调用它并将所有参数传递给配置脚本。Qmake 然后失败,因为这些参数中的大多数都不是有效的 qmake 选项!

以下是 build_qt.sh 的摘录:

CONFIGURE_ARGS="${CONFIGURE_ARGS} \
                -commercial -confirm-license -release \
                -device ${DEVICE} \
        -device-option CROSS_COMPILE=${WORKDIR}/tmp/sysroots/x86_64-linux/usr/bin/${COMPILER} \
                -sysroot ${WORKDIR}/toolchain/sysroots/${SYSROOT} \
                -no-xcb -separate-debug-info -silent -nomake examples -nomake tests -tslib -no-pch -v"

...

./configure ${CONFIGURE_ARGS}
Run Code Online (Sandbox Code Playgroud)

在配置脚本的末尾,它执行以下操作:

"$outpath/bin/qmake" "$relpathMangled" -- "$@"
Run Code Online (Sandbox Code Playgroud)

请注意$@. 那就是所有这些配置参数结束的地方,这把它炸了。具体来说,它抱怨它得到的第一个参数不是用于 qmake 的。

这是它尝试执行的实际语句:

/home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/bin/qmake /home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/qt5-src -- -commercial -confirm-license -release -device linux-imx53qsb-hf-g++ -device-option CROSS_COMPILE=/home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/tmp/sysroots/x86_64-linux/usr/bin/armv7ahf-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi- -sysroot /home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/toolchain/sysroots/armv7ahf-vfp-neon-poky-linux-gnueabi -no-xcb -separate-debug-info -silent -nomake examples -nomake tests -tslib -no-pch -v
Run Code Online (Sandbox Code Playgroud)

这是结果:

ERROR: Unknown command line option '-commercial'.
Run Code Online (Sandbox Code Playgroud)

这是实际的 qmake 二进制帮助输出,它定义了预期的语法:

Usage: ./bin/qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
  -project       Put qmake into project file generation mode
                 In this mode qmake interprets files as files to
                 be built,
                 defaults to *; *; *; *.ts; *.xlf; *.qrc
                 Note: The created .pro file probably will 
                 need to be edited. For example add the QT variable to 
                 specify what modules are required.
  -makefile      Put qmake into makefile generation mode (default)
                 In this mode qmake interprets files as project files to
                 be processed, if skipped qmake will try to find a project
                 file in your current working directory

Warnings Options:
  -Wnone         Turn off all warnings; specific ones may be re-enabled by
                 later -W options
  -Wall          Turn on all warnings
  -Wparser       Turn on parser warnings
  -Wlogic        Turn on logic warnings (on by default)
  -Wdeprecated   Turn on deprecation warnings (on by default)

Options:
   * You can place any variable assignment in options and it will be *
   * processed as if it was in [files]. These assignments will be    *
   * processed before [files] by default.                            *
  -o file        Write output to file
  -d             Increase debug level
  -t templ       Overrides TEMPLATE as templ
  -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
  -help          This help
  -v             Version information
  -early         All subsequent variable assignments will be
                 parsed right before default_pre.prf
  -before        All subsequent variable assignments will be
                 parsed right before [files] (the default)
  -after         All subsequent variable assignments will be
                 parsed after [files]
  -late          All subsequent variable assignments will be
                 parsed right after default_post.prf
  -norecursive   Don't do a recursive search
  -recursive     Do a recursive search
  -set <prop> <value> Set persistent property
  -unset <prop>  Unset persistent property
  -query <prop>  Query persistent property. Show all if <prop> is empty.
  -qtconf file   Use file instead of looking for qt.conf
  -cache file    Use file as cache           [makefile mode only]
  -spec spec     Use spec as QMAKESPEC       [makefile mode only]
  -nocache       Don't use a cache file      [makefile mode only]
  -nodepend      Don't generate dependencies [makefile mode only]
  -nomoc         Don't generate moc targets  [makefile mode only]
  -nopwd         Don't look for files in pwd [project mode only]
Run Code Online (Sandbox Code Playgroud)

请注意,父build_qt.sh脚本在此之后运行 Make。此外,qmake“默认模式”-makefilePut qmake into makefile generation mode (default). 所以,我很确定这个无法执行的命令应该是在写一个 makefile(本质上这是另一个里面的“配置脚本”)。

有谁知道这个命令应该在这里是什么?

有人可以build_qt.sh为我运行一个类似的实例并发布他们的功能脚本在这里运行什么命令吗?这可能对解决这个问题大有帮助。

Buv*_*inJ 1

原来父build_qt.sh脚本和configure脚本来自不同版本的Qt。他们不兼容!旧版本的 Qt 没有这个麻烦的行:

"$outpath/bin/qmake" "$relpathMangled" -- "$@"
Run Code Online (Sandbox Code Playgroud)

相反,它们看起来像这样:

"$outpath/bin/qmake" "$relpathMangled"
Run Code Online (Sandbox Code Playgroud)

这更有意义!我不知道为什么当前的配置文件有那么有趣,但目前对我来说并不重要。