【问题标题】:Mingw32 at win7x64:Qt 5.3.0 x86 compilation: wrong path fed to uic.exeMingw32 at win7x64:Qt 5.3.0 x86 编译:输入 uic.exe 的路径错误
【发布时间】:2014-04-25 07:50:31
【问题描述】:

我正在尝试编译从 Qt git 中提取的当前“稳定”版本。问题是当它尝试使用 uic(UI 编译器)时,我的路径变量会以某种方式被破坏,并且找不到路径上的 icu 库,但是如果我将库放在与 uic 相同的目录中,它可以工作,但这并不是真正的解决方案。

我的路径变量:

%CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;%systemroot%\System32\WindowsPowerShell\v1.0\;I:\miktex\miktex\bin;E:\Program Files\doxygen\bin;E:\Python27;E:\icu\lib;E:\strawberry\c\bin;E:\strawberry\perl\site\bin;E:\strawberry\perl\bin;E:\Program Files (x86)\Git\bin;

mingw32-make 的相关输出是

mingw32-make[3]: Entering directory 'e:/qt5/qtbase/src/widgets'
mingw32-make -f Makefile.Debug all
mingw32-make[4]: Entering directory 'e:/qt5/qtbase/src/widgets'
PATH=e:/qt5/qtbase/lib${PATH:+:$PATH} e:/qt5/qtbase/bin/uic.exe dialogs/qfiledialog.ui -o .uic/ui_qfiledialog.h
Makefile.Debug:2443: recipe for target '.uic/ui_qfiledialog.h' failed
mingw32-make[4]: Leaving directory 'e:/qt5/qtbase/src/widgets'
Makefile:38: recipe for target 'debug-all' failed
mingw32-make[3]: Leaving directory 'e:/qt5/qtbase/src/widgets'
Makefile:437: recipe for target 'sub-widgets-make_first' failed
mingw32-make[2]: Leaving directory 'e:/qt5/qtbase/src'
Makefile:41: recipe for target 'sub-src-make_first' failed
mingw32-make[1]: Leaving directory 'e:/qt5/qtbase'
Makefile:64: recipe for target 'module-qtbase-make_first' failed

关于PATH=e:/qt5/qtbase/lib${PATH:+:$PATH} 的部分在我看来非常可疑,遗憾的是我对makefile 和这种特殊语法知之甚少。

【问题讨论】:

  • 是的,这条线看起来很奇怪。你从哪里得到你的 MinGW 副本?我只是使用 Qt 本身附带的副本(我相信来自sourceforge.net/projects/mingwbuilds/files/host-windows/…)运行它,然后我得到了这些:mingw32-make[4]: Entering directory 'C:/Qt/git/5.x.y/qtbase/src/widgets' (set PATH=C:\Qt\git\5.x.y\qtbase\lib;%PATH:)=^)%) & C:\Qt\git\5.x.y\qtbase\bin\uic.exe dialogs\qfiledialog.ui -o .uic\ui_qfiledialog.h。另外,我使用的是 Windows 命令提示符,而不是 MSYS。
  • 这个问题有什么解决办法吗?

标签: c++ qt makefile mingw qmake


【解决方案1】:

我遇到了基本相同的问题 - uic.exe 的调用会静默失败,构建配方也会失败。原来 make 被我路径中的空格弄糊涂了。转到系统控制面板在系统路径的开头和结尾添加双引号,如果它们不存在,似乎可以解决问题。我的用户路径是空的(只有一对引号),但如果还没有的话,可能还需要在其周围添加引号。

之前我也解决了这个问题,方法是转到系统控制面板获取默认路径,去掉带有空格的条目,然后在 PowerShell 中运行以下命令:

PS C:\Qt\build\5.4.1> $env:Path="C:\Perl64\site\bin;C:\Perl64\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev2\mingw32\bin"
PS C:\Qt\build\5.4.1> mingw32-make -j

然后构建正常进行。顺便说一句,第一行仅设置当前 PowerShell 会话的路径,与注册表中设置的路径无关。

【讨论】:

    【解决方案2】:

    我根本不是这方面的专家/权威,但我觉得这是因为您在 64 位 Windows 7 上安装了 32 位 MINGW。

    另一个问题 - 我在路径中没有看到 e:/qt5/qtbase/。

    如前所述,我可能大错特错。

    【讨论】:

    • 32 位 MinGW 在 64 位 Windows 上完美运行。 Qt 源目录不需要在 PATH 中。
    • 我有一个 mingw32 的官方发行版,是的,它不需要 qtbase 在路径上。可悲的是,我现在真的没有时间尝试挖掘问题。所以我找到了一个我需要的 mingw 版本的非官方版本。如果有人需要用于 32 位 Windows 的带有 mingw 的 Qt,请查看 sourceforge.net/projects/mingwbuilds/files/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多