我想为Android平台编译this project。在TelnetWidgetTest.pro中打开Qt creator文件之后,我只是下载并选择了所有Android工具包。现在,如果我选择(Android for x86 GCC4.9 Qt 5.5.0),则项目可以成功编译,但是当我选择(armeabi-v7a GCC 4.9 Qt 5.5.0的Android)时,出现以下错误:

mingw32-make: *** No rule to make target '..\..\..\..\AppData\Roaming\IDM\android-ndk-r10d\sources\cxx-stl\gnu-libstdc++\4.9\include\profile\impl\profiler_hashtable_size.h', needed by 'build\mainwindowimpl.obj'.  Stop.
17:43:33: The process "C:\Qt\Qt5.5.1\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project TelnetWidgetTest (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.5.0))
When executing step "Make"

如果我选择(套件:armeabi的Android(GCC 4.9,Qt 5.5.0)),它还会返回以下错误:
    mingw32-make: *** No rule to make target '..\..\..\..\AppData\Roaming\IDM\android-ndk-r10d\sources\cxx-stl\gnu-libstdc++\4.9\include\profile\impl\profiler_map_to_unordered_map.h', needed by 'build\mainwindowimpl.obj'.  Stop.
17:42:38: The process "C:\Qt\Qt5.5.1\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project TelnetWidgetTest (kit: Android for armeabi (GCC 4.9, Qt 5.5.0))
When executing step "Make"

该程序可以编译并在Windows桌面上成功运行。
  • 当make告诉**No rule to make target**是什么意思?我检查了提到的文件夹中的文件是否存在,并且android NDK的路径正确。那么真正的问题是什么?
  • 另一个问题是,什么是profiler_map_to_unordered_map.h,为什么我的一个目标文件(mainwindowimpl.obj)需要它。
  • 最佳答案

    就在昨天,我遇到了类似的问题。经过相当痛苦的调查后,我发现罪魁祸首是路径长度!

    如果我创建一个项目:

    `c:\x\12345678901234567890123456789012345.pro`
    

    这将创建构建目录
    `c:\build-12345678901234567890123456789012345-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Debug`
    

    (109个字元)和Android SDK在
    `c:\Users\miroslav.kropacek\AppData\Local\Android\sdk`
    

    它在Makefile中创建路径,例如:
    `..\Users\miroslav.kropacek\AppData\Local\Android\sdk\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include\profile\impl\profiler_map_to_unordered_map.h`
    

    (150个字符)

    一种(较不舒适的)解决方案是重命名项目文件,在我的示例中,将其从12345678901234567890123456789012345缩短为1234567890123456789012345678901234一个字符就足以使其进行编译。

    另一个解决方案是在Qt创建者的对话框中手动注意构建目录的规范,并在其中输入不太麻烦的内容(例如简单的“release”和“debug”目录),但是您必须记住每次从头开始提取源代码时都要这样做。

    另一个解决方案是将Android SDK复制到C:\Android\sdk中,从而导致Makefile中的以下路径:
    `..\Android\sdk\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include\profile\impl\profiler_map_to_unordered_map.h`
    

    (112个字符)并可以正常运行。

    在不查看源代码的情况下,我只能推测罪魁祸首是mingw的make,它创建了一个缓冲区260 characters很长,因此当解析相对路径时,它的长度为:
    `c:\build-12345678901234567890123456789012345-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Debug\..\Users\miroslav.kropacek\AppData\Local\Android\sdk\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include\profile\impl\profiler_map_to_unordered_map.h`
    

    恰好是260个字符,而\0恰好是臭名昭著的Windows限制以外的一个字符。

    07-28 01:04
    查看更多