xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.81k stars 774 forks source link

vs2015编译报错缺少qt的ui_***Lib.h文件 #480

Closed jiagushuai closed 5 years ago

jiagushuai commented 5 years ago

Describe the bug

OpportunityLiu commented 5 years ago

QT还不支持转换成vs工程,可以关注 #472

Ref: #257 #174

jiagushuai commented 5 years ago

好的 那我暂时避开这个

OpportunityLiu commented 5 years ago

@jiagushuai 你可以试试

xmake update -s github:OpportunityLiu/xmake#vsproj

然后用

xmake project -k vsxmake2015 -m "debug,release"

生成工程文件

waruqi commented 5 years ago

https://github.com/xmake-io/xmake/pull/472 已经merge到dev了,可以更新到dev试下,应该可以正常构建和运行qt程序了

xmake update dev
xmake create -t quickapp_qt -l c++ test
cd test
xmake project -k vsxmake2017

Snip20190715_1

jiagushuai commented 5 years ago
OpportunityLiu commented 5 years ago

https://ci.appveyor.com/api/buildjobs/9po7pacx7h5dralg/artifacts/xmake-installer.exe 手动装一个吧

OpportunityLiu commented 5 years ago

@waruqi 看了下是这里的问题

图片

jiagushuai commented 5 years ago

@OpportunityLiu 手动安装之后生成项目报错 image

OpportunityLiu commented 5 years ago

链接发错了,改了一下,你按上面那个链接装

waruqi commented 5 years ago
  • 安装更新失败

D:\GitLab\sd-cpp\sdSocketKey_win_http>xmake update -v dev
update version: dev ..
  => downloading https://qcloud.coding.net/u/waruqi/p/xmake-releases/git/raw/master/xmake-dev.exe ..  curl      -SL -A Xmake/2.2.5 (Windows;) curl/7.55.1 https://qcloud.coding.net/u/waruqi/p/xmake-releases/git/raw/master/xmake-dev.exe -o C:\Users\dell\AppData\Local\Temp\.xmake\190716\xmakesrc\dev\xmake-dev.exe

这个是由于你这边之前是老版本,update走的是coding dev mirror,这个上面我刚也更新了,重新update一下,应该就可以下到了。

OpportunityLiu commented 5 years ago

是之前winos版本判断的bug导致xmake认为是xp以前的版本,没有用UAC

waruqi commented 5 years ago

@waruqi 看了下是这里的问题

图片

确定是dev版本?,为啥我这都变成这样了。。?

Snip20190716_2

OpportunityLiu commented 5 years ago

就是他的2.2.5的结果啊,update之前当然是这样的

waruqi commented 5 years ago

就是他的2.2.5的结果啊,update之前当然是这样的

2.2.5的结果就别管了,新版本不是修复了么。。话说 dump winos:version() 我觉得应该用 __tostring里面的结果 才是吧。。我想看版本,出来一个table = =

OpportunityLiu commented 5 years ago

2.2.5的结果就别管了,新版本不是修复了么

就是因为这个bug导致的xmake update dev失败啊 图片

dump现在是顶层会展开,非顶层且有__tostring就不展开了,你可以 {winos.version()}

jiagushuai commented 5 years ago
OpportunityLiu commented 5 years ago

vs2015就是之前的逻辑,vsxmake201x是这次新加的

加载失败有报错信息吗?

waruqi commented 5 years ago

2.2.5的结果就别管了,新版本不是修复了么

就是因为这个bug导致的xmake update dev失败啊

那这个没办法了,只能手动装下安装包了。或者执行下get.ps1的脚本安装

dump现在是顶层会展开,非顶层且有__tostring就不展开了,你可以 {winos.version()}

我觉得默认应该判断存在tostring就不展开,不存在tostring才展开(不管是否顶层)。。或者 带-D/--diagnosis的时候才强制展开,方便调试分析。。

不然我想快速查看版本,xmake l winos.version ,或者想在其他脚本中,wrap执行xmake l winos.version去快速获取版本,出来确实一堆table dump,不是期待的结果。。

jiagushuai commented 5 years ago

vsxmake2015生成正常,打开vs项目直接加载失败 没有什么报错信息 image

waruqi commented 5 years ago

命令行生成的时候create ok!后面跟着一些未编码的字符

这个是由于win上现在放开了emoji展示,我这边的终端也是不支持的。。@OpportunityLiu

OpportunityLiu commented 5 years ago

图片 我这里显示也有点问题。。。

@jiagushuai 图片 图片

你打开vs命令行,然后切到sln那级目录,运行msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true 看看输出

jiagushuai commented 5 years ago

具体报错如下

image

OpportunityLiu commented 5 years ago

改一下xmake.props https://github.com/xmake-io/xmake/pull/486/files#diff-6d338ad45fe3285fd799caaea866160a

jiagushuai commented 5 years ago

xmake.props是哪里的 我全局搜索了一下关键字没看到 image

OpportunityLiu commented 5 years ago

@jiagushuai 你报错信息里写了具体路径,是xmake安装目录里的

jiagushuai commented 5 years ago

我修改了NormalizeDirectoryNormalizePath image

OpportunityLiu commented 5 years ago

图片

那就用[System.IO.Path]::GetFullPath,还有注意末尾要加个 /

jiagushuai commented 5 years ago
OpportunityLiu commented 5 years ago

Xmake.Custom.props文件,把你需要附加的选项设上去

<XmakeConfigFlags>$(XmakeConfigFlags) --qt=D:\QtStatic\</XmakeConfigFlags>
jiagushuai commented 5 years ago

修改文件如下 image

添加--qt=D:\QtStatic\ 重新编译设置 没有设置成功 image

waruqi commented 5 years ago

再加个-c试试

OpportunityLiu commented 5 years ago

改错文件了,Custom是每项目的配置,你改的是模板。。这次是要改生成项目里的 Xmake.Custom.props

jiagushuai commented 5 years ago

修改执行报错 image 哪里加-c?@waruqi

jiagushuai commented 5 years ago
OpportunityLiu commented 5 years ago

msbuild输出截全点。。。从执行命令那里开始截

OpportunityLiu commented 5 years ago

别加-c,跟那个没关系

jiagushuai commented 5 years ago
D:\GitLab\test\vsxmake2015>msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true
Microsoft (R) 生成引擎版本 14.0.25420.1
版权所有(C) Microsoft Corporation。保留所有权利。

在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2019/7/16 15:05:33。
节点 1 上的项目“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(默认目标)。
ValidateSolutionConfiguration:
  正在生成解决方案配置“debug|x86”。
项目“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(1)正在节点 1 上生成“D:\GitLab\test\vsxmake2015\test\test.vcxproj”(2) (默认目标
)。
Show:

  MSBuild Properties:
      Xmake Props:
          XmakeTarget: test
          'XmakePlat|Mode|Arch': 'windows|debug|x86'
          XmakeBasename: test
          XmakeFilename:
          XmakeKind: binary
          XmakeCudaVersion:
          XmakeMfcKind:
          XmakeDefines: QT_QML_DEBUG;QT_DEPRECATED_WARNINGS;QT_QUICK_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NETWORK_LIB;QT_CORE_L
  IB;_WINDOWS
          XmakeLanguages: cxx11
      Xmake Path:
          XmakeProjectDir: D:\GitLab\test\
          XmakeScriptDir: D:\GitLab\test\
          XmakeBuilDir: D:\GitLab\test\build\
          XmakeConfigDir: D:\GitLab\test\.xmake\
          XmakeIncludeDir: D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\QtQuick;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\
  QtGui;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\QtQml;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\QtNetwork;D:\soft\Qt\
  Qt5.6.3\5.6.3\msvc2015\include\QtCore;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\mks
  pecs\win32-msvc
          XmakeLinkDir: D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\lib
      Xmake Flags:
          XmakeWarning: true
          XmakeVerbose: true
          XmakeDiagnosis: true
          XmakeCommonFlags:
          XmakeConfigFlags:  --qt=D:\QtStatic\
          XmakeBuildFlags:
          XmakeCleanFlags:
      Xmake Internal:
          _XmakeCommonFlags: -v -D -P .
          _XmakeConfigFlags: --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build"
          _XmakeBuildFlags: -w
          _XmakeCleanFlags:
          _XmakeExecutable: "D:\soft\xmake\xmake.exe"
          _XmakeEnv:
              pushd "D:\GitLab\test\"
              set XMAKE_CONFIGDIR=D:\GitLab\test\.xmake\
              set XMAKE_PROGRAM_DIR=D:\soft\xmake\

      Vs Props:
          'Configuration|Platform': 'debug|Win32'
          VisualStudioVersion: 14.0
          MSBuildProjectDirectory: D:\GitLab\test\vsxmake2015\test
          MSBuildProjectName: test
          OutDir: D:\GitLab\test\build\windows\x86\debug\
          IntDir: D:\GitLab\test\build\.vs\test\x86\debug\
          TargetName: test
          TargetExt: .exe
          PlatformToolset: v140
          CharacterSet: MultiByte
          UseOfMfc: false
          WindowsTargetPlatformVersion: 10.0.10240.0
          PreprocessorDefinitions: _MBCS;;QT_QML_DEBUG;QT_DEPRECATED_WARNINGS;QT_QUICK_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NET
  WORK_LIB;QT_CORE_LIB;_WINDOWS
          LanguageStandard: stdcpp11

_XmakeConfig:
  $xmake config -v -D -P . --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build" test
  configure
  {
      arch = x86
      ccache = true
      clean = true
      mode = debug
      qt_sdkver = 5.6.3
      host = windows
      plat = windows
      kind = static
      buildir = build
      vs = 2015
      ndk_stdcxx = true
      qt = D:\QtStatic\
  }
_XmakeBuild:
  $xmake build -v -D -P . -w test
  configure
  {
      arch = x86
      ccache = true
      clean = true
      mode = debug
      qt_sdkver = 5.6.3
      host = windows
      plat = windows
      kind = static
      buildir = build
      vs = 2015
      ndk_stdcxx = true
      qt = D:\QtStatic\
  }
  checking for the c++ compiler (cxx) ... cl.exe
  checking for the linker (ld) ... link.exe
  [100%]: linking.debug test.exe
  link.exe @C:\\Users\\dell\\AppData\\Local\\Temp\\.xmake\\190716\\_1F7E51A5DA361493CC73FFC79C0DCC72.args.txt
EXEC : error : D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:7
19: runv(link.exe @C:\Users\dell\AppData\Local\Temp\.xmake\190716\_1F7E51A5DA361493CC73FFC79C0DCC72.args.txt) failed(11
20)! [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
  stack traceback:
      [C]: in function 'error'
      [D:\soft\xmake/core/base/os.lua:719]: in function 'raise'
      [$(programdir)\core\sandbox\modules\os.lua:309]: in function 'runv'
      [$(programdir)\modules\core\tools\link.lua:115]:
      [C]: in function 'link'
      [$(programdir)\actions\build\kinds\binary.lua:90]: in function '_do_link_target'
      [$(programdir)\actions\build\kinds\binary.lua:113]:
      [$(programdir)\actions\build\kinds\binary.lua:134]: in function '_link_target'
      [$(programdir)\actions\build\kinds\binary.lua:161]: in function '_build_from_objects'
      [$(programdir)\actions\build\kinds\binary.lua:215]: in function 'build'
      [$(programdir)\actions\build\build.lua:40]: in function '_do_build_target'
      [$(programdir)\actions\build\build.lua:64]: in function 'script'
      [$(programdir)\actions\build\build.lua:140]: in function '_build_target'
      [$(programdir)\actions\build\build.lua:167]: in function '_build_target_and_deps'
      [$(programdir)\actions\build\build.lua:233]: in function 'build'
      [$(programdir)\actions\build\main.lua:59]:
      [C]: in function 'trycall'
      [$(programdir)\core\sandbox\modules\try.lua:121]: in function 'try'
      [$(programdir)\actions\build\main.lua:57]:
      [C]: in function 'load'
      [D:\soft\xmake/core/base/task.lua:506]: in function 'run'
      [D:\soft\xmake/core/main.lua:231]:

D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: 命令“ [D:\GitLab\test\vsxmake2015\test\t
est.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             pushd "D:\GitLab\test\" [D
:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_CONFIGDIR=D:\Git
Lab\test\.xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_PROGRAM_DIR=D:\s
oft\xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:          [D:\GitLab\test\vsxmake2015\t
est\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: "D:\soft\xmake\xmake.exe" build -v -D
-P . -w test”已退出,代码为 -1。 [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
已完成生成项目“D:\GitLab\test\vsxmake2015\test\test.vcxproj”(默认目标)的操作 - 失败。

已完成生成项目“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(默认目标)的操作 - 失败。

生成失败。

“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(默认目标) (1) ->
“D:\GitLab\test\vsxmake2015\test\test.vcxproj”(默认目标) (2) ->
(_XmakeBuild 目标) ->
  EXEC : error : D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua
:719: runv(link.exe @C:\Users\dell\AppData\Local\Temp\.xmake\190716\_1F7E51A5DA361493CC73FFC79C0DCC72.args.txt) failed(
1120)! [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
  D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: 命令“ [D:\GitLab\test\vsxmake2015\test
\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             pushd "D:\GitLab\test\" [D
:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_CONFIGDIR=D:\Git
Lab\test\.xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_PROGRAM_DIR=D:\s
oft\xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:          [D:\GitLab\test\vsxmake2015\t
est\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: "D:\soft\xmake\xmake.exe" build -v -D
-P . -w test”已退出,代码为 -1。 [D:\GitLab\test\vsxmake2015\test\test.vcxproj]

    0 个警告
    2 个错误

已用时间 00:00:06.88
OpportunityLiu commented 5 years ago

@waruqi --qt必须在-p -m -a后面?

waruqi commented 5 years ago

@waruqi --qt必须在-p -m -a后面?

应该是没有顺序依赖的。。

OpportunityLiu commented 5 years ago

@jiagushuai msbuid 加上 /t:rebuild 试试?

jiagushuai commented 5 years ago

还是报错2个错误

D:\GitLab\test\vsxmake2015>msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true /t:rebuild
Microsoft (R) 生成引擎版本 14.0.25420.1
版权所有(C) Microsoft Corporation。保留所有权利。

在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2019/7/16 16:10:55。
项目“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”在节点 1 上(rebuild 个目标)。
ValidateSolutionConfiguration:
  正在生成解决方案配置“debug|x86”。
项目“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(1)正在节点 1 上生成“D:\GitLab\test\vsxmake2015\test\test.vcxproj”(2) (Rebu
ild 个目标)。
Show:

  MSBuild Properties:
      Xmake Props:
          XmakeTarget: test
          'XmakePlat|Mode|Arch': 'windows|debug|x86'
          XmakeBasename: test
          XmakeFilename:
          XmakeKind: binary
          XmakeCudaVersion:
          XmakeMfcKind:
          XmakeDefines: QT_QML_DEBUG;QT_DEPRECATED_WARNINGS;QT_QUICK_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NETWORK_LIB;QT_CORE_L
  IB;_WINDOWS
          XmakeLanguages: cxx11
      Xmake Path:
          XmakeProjectDir: D:\GitLab\test\
          XmakeScriptDir: D:\GitLab\test\
          XmakeBuilDir: D:\GitLab\test\build\
          XmakeConfigDir: D:\GitLab\test\.xmake\
          XmakeIncludeDir: D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\QtQuick;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\
  QtGui;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\QtQml;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include\QtNetwork;D:\soft\Qt\
  Qt5.6.3\5.6.3\msvc2015\include\QtCore;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\include;D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\mks
  pecs\win32-msvc
          XmakeLinkDir: D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\lib
      Xmake Flags:
          XmakeWarning: true
          XmakeVerbose: true
          XmakeDiagnosis: true
          XmakeCommonFlags:
          XmakeConfigFlags:  --qt=D:\QtStatic\
          XmakeBuildFlags:
          XmakeCleanFlags:
      Xmake Internal:
          _XmakeCommonFlags: -v -D -P .
          _XmakeConfigFlags: --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build"
          _XmakeBuildFlags: -w
          _XmakeCleanFlags:
          _XmakeExecutable: "D:\soft\xmake\xmake.exe"
          _XmakeEnv:
              pushd "D:\GitLab\test\"
              set XMAKE_CONFIGDIR=D:\GitLab\test\.xmake\
              set XMAKE_PROGRAM_DIR=D:\soft\xmake\

      Vs Props:
          'Configuration|Platform': 'debug|Win32'
          VisualStudioVersion: 14.0
          MSBuildProjectDirectory: D:\GitLab\test\vsxmake2015\test
          MSBuildProjectName: test
          OutDir: D:\GitLab\test\build\windows\x86\debug\
          IntDir: D:\GitLab\test\build\.vs\test\x86\debug\
          TargetName: test
          TargetExt: .exe
          PlatformToolset: v140
          CharacterSet: MultiByte
          UseOfMfc: false
          WindowsTargetPlatformVersion: 10.0.10240.0
          PreprocessorDefinitions: _MBCS;;QT_QML_DEBUG;QT_DEPRECATED_WARNINGS;QT_QUICK_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NET
  WORK_LIB;QT_CORE_LIB;_WINDOWS
          LanguageStandard: stdcpp11

_XmakeClean:
  $xmake clean -v -D -P . -a  test
  configure
  {
      arch = x86
      ccache = true
      host = windows
      mode = debug
      qt_sdkver = 5.6.3
      plat = windows
      ndk_stdcxx = true
      clean = true
      kind = static
      buildir = build
      vs = 2015
      qt = D:\QtStatic\
  }
  checking for the linker (ld) ... link.exe
_XmakeReconfig:
  $xmake config -v -D -P . -c --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build" test
  checking for the cl.exe ... ok
  checking for the Microsoft Visual Studio (x86) version ... 2015
  checking for the Qt SDK directory ... D:\QtStatic\5.6.3\VS2015Static
  checking for the Qt SDK version ... 5.6.3
  configure
  {
      arch = x86
      ccache = true
      mode = debug
      qt_sdkver = 5.6.3
      plat = windows
      clean = true
      host = windows
      kind = static
      buildir = build
      vs = 2015
      ndk_stdcxx = true
      qt = D:\QtStatic\5.6.3\VS2015Static
  }
_XmakeBuild:
  $xmake build -v -D -P . -w test
  configure
  {
      arch = x86
      ccache = true
      clean = true
      mode = debug
      qt_sdkver = 5.6.3
      plat = windows
      ndk_stdcxx = true
      host = windows
      kind = static
      buildir = build
      vs = 2015
      qt = D:\QtStatic\
  }
  checking for the c++ compiler (cxx) ... cl.exe
  checking for the ccache ... no
  checking for the flags (-Od) ... ok
  > cl.exe -Od
  checking for the flags (-std:c++11) ... no
  > cl.exe -std:c++11
  checking for the flags (-fPIC) ... no
  > cl.exe -fPIC
  [  0%]: compiling.qt.qrc src\qml.qrc
  cl.exe -c -Zi -Od -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\include\\\\QtQuick -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015
  Static\\\\include\\\\QtGui -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\include\\\\QtQml -ID:\\\\QtStatic\\\\5.6.3\\\
  \VS2015Static\\\\include\\\\QtNetwork -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\include\\\\QtCore -ID:\\\\QtStatic
  \\\\5.6.3\\\\VS2015Static\\\\include -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\mkspecs\\\\win32-msvc -DQT_QML_DEBU
  G -DQT_DEPRECATED_WARNINGS -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -D_WINDOWS -nologo
   -Fdbuild\\.objs\\test\\windows\\x86\\debug\\gens\\rules\\qt\\qrc\\qml.cpp.obj.pdb -Fobuild\\.objs\\test\\windows\\x8
  6\\debug\\gens\\rules\\qt\\qrc\\qml.cpp.obj build\\.gens\\test\\windows\\x86\\debug\\rules\\qt\\qrc\\qml.cpp
  [ 50%]: compiling.debug src\main.cpp
  cl.exe -c -Zi -Od -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\include\\\\QtQuick -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015
  Static\\\\include\\\\QtGui -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\include\\\\QtQml -ID:\\\\QtStatic\\\\5.6.3\\\
  \VS2015Static\\\\include\\\\QtNetwork -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\include\\\\QtCore -ID:\\\\QtStatic
  \\\\5.6.3\\\\VS2015Static\\\\include -ID:\\\\QtStatic\\\\5.6.3\\\\VS2015Static\\\\mkspecs\\\\win32-msvc -DQT_QML_DEBU
  G -DQT_DEPRECATED_WARNINGS -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -D_WINDOWS -nologo
   -Fdbuild\\.objs\\test\\windows\\x86\\debug\\src\\main.cpp.obj.pdb -Fobuild\\.objs\\test\\windows\\x86\\debug\\src\\m
  ain.cpp.obj src\\main.cpp
  checking for the link.exe ... ok
  checking for the linker (ld) ... link.exe
  [100%]: linking.debug test.exe
  link.exe @C:\\Users\\dell\\AppData\\Local\\Temp\\.xmake\\190716\\_1F7E51A5DA361493CC73FFC79C0DCC72.args.txt
EXEC : error : D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:7
19: runv(link.exe @C:\Users\dell\AppData\Local\Temp\.xmake\190716\_1F7E51A5DA361493CC73FFC79C0DCC72.args.txt) failed(11
20)! [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
  stack traceback:
      [C]: in function 'error'
      [D:\soft\xmake/core/base/os.lua:719]: in function 'raise'
      [$(programdir)\core\sandbox\modules\os.lua:309]: in function 'runv'
      [$(programdir)\modules\core\tools\link.lua:115]:
      [C]: in function 'link'
      [$(programdir)\actions\build\kinds\binary.lua:90]: in function '_do_link_target'
      [$(programdir)\actions\build\kinds\binary.lua:113]:
      [$(programdir)\actions\build\kinds\binary.lua:134]: in function '_link_target'
      [$(programdir)\actions\build\kinds\binary.lua:161]: in function '_build_from_objects'
      [$(programdir)\actions\build\kinds\binary.lua:215]: in function 'build'
      [$(programdir)\actions\build\build.lua:40]: in function '_do_build_target'
      [$(programdir)\actions\build\build.lua:64]: in function 'script'
      [$(programdir)\actions\build\build.lua:140]: in function '_build_target'
      [$(programdir)\actions\build\build.lua:167]: in function '_build_target_and_deps'
      [$(programdir)\actions\build\build.lua:233]: in function 'build'
      [$(programdir)\actions\build\main.lua:59]:
      [C]: in function 'trycall'
      [$(programdir)\core\sandbox\modules\try.lua:121]: in function 'try'
      [$(programdir)\actions\build\main.lua:57]:
      [C]: in function 'load'
      [D:\soft\xmake/core/base/task.lua:506]: in function 'run'
      [D:\soft\xmake/core/main.lua:231]:

  D:\QtStatic\5.6.3\VS2015Static\bin\rcc.exe -name qml src\qml.qrc -o build\.gens\test\windows\x86\debug\rules\qt\qrc\q
  ml.cpp
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: 命令“ [D:\GitLab\test\vsxmake2015\test\t
est.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             pushd "D:\GitLab\test\" [D
:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_CONFIGDIR=D:\Git
Lab\test\.xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_PROGRAM_DIR=D:\s
oft\xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:          [D:\GitLab\test\vsxmake2015\t
est\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: "D:\soft\xmake\xmake.exe" build -v -D
-P . -w test”已退出,代码为 -1。 [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
已完成生成项目“D:\GitLab\test\vsxmake2015\test\test.vcxproj”(Rebuild 个目标)的操作 - 失败。

已完成生成项目“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(rebuild 个目标)的操作 - 失败。

生成失败。

“D:\GitLab\test\vsxmake2015\test_vsxmake2015.sln”(rebuild 目标) (1) ->
“D:\GitLab\test\vsxmake2015\test\test.vcxproj”(Rebuild 目标) (2) ->
(_XmakeBuild 目标) ->
  EXEC : error : D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua
:719: runv(link.exe @C:\Users\dell\AppData\Local\Temp\.xmake\190716\_1F7E51A5DA361493CC73FFC79C0DCC72.args.txt) failed(
1120)! [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
  D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: 命令“ [D:\GitLab\test\vsxmake2015\test
\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             pushd "D:\GitLab\test\" [D
:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_CONFIGDIR=D:\Git
Lab\test\.xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:             set XMAKE_PROGRAM_DIR=D:\s
oft\xmake\ [D:\GitLab\test\vsxmake2015\test\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073:          [D:\GitLab\test\vsxmake2015\t
est\test.vcxproj]
D:\soft\xmake\plugins\project\vsxmake\vsproj\xmake.targets(66,9): error MSB3073: "D:\soft\xmake\xmake.exe" build -v -D
-P . -w test”已退出,代码为 -1。 [D:\GitLab\test\vsxmake2015\test\test.vcxproj]

    0 个警告
    2 个错误

已用时间 00:00:11.30
OpportunityLiu commented 5 years ago

@waruqi 你来看吧,QT的问题应该跟我这里没关系了

waruqi commented 5 years ago

$xmake config -v -D -P . -c --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build" test

@jiagushuai 你先自己根据里面的配置项,先手动命令行执行 xmake 尝试build下 看看吧。。等晚上有时间我再看下

jiagushuai commented 5 years ago

build一下是指执行命令吗 运行成功了 然后我需要做什么? image

OpportunityLiu commented 5 years ago

就是msbuild输出的$xmake ...就是实际运行的命令,你手动执行一下这几个看看输出

xmake config -v -D -P . -c --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build" test
xmake build -v -D -P . -w test
jiagushuai commented 5 years ago

xmake config -v -D -P . -c --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build" test的结果上面执行了,正常 xmake build -v -D -P . -w test执行报错 如下

D:\GitLab\test>xmake build -v -D -P . -w test
checking for the architecture ... x64
checkinfo: runv(vswhere.exe -?) failed(-1)!
checking for the vswhere.exe ... no
checkinfo: runv(vswhere.exe -?) failed(-1)!
checking for the vswhere ... no
checking for the cl.exe ... ok
checking for the Microsoft Visual Studio (x64) version ... 2015
checking for the Qt SDK directory ... D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015
checking for the Qt SDK version ... 5.6.3
configure
{
    arch = x64
    ccache = true
    mode = release
    qt_sdkver = 5.6.3
    host = windows
    plat = windows
    ndk_stdcxx = true
    kind = static
    buildir = build
    vs = 2015
    qt = D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015
}
checking for the c++ compiler (cxx) ... cl.exe
checking for the ccache ... no
checking for the flags (-Ox -fp:fast) ... ok
> cl.exe -Ox -fp:fast
checking for the flags (-std:c++11) ... no
> cl.exe -std:c++11
checking for the flags (-fPIC) ... no
> cl.exe -fPIC
[  0%]: compiling.qt.qrc src\qml.qrc
D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015\bin\rcc.exe -name qml src\qml.qrc -o build\.gens\test\windows\x64\release\rules\qt\qrc\qml.cpp
cl.exe -c -Ox -fp:fast -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtQuick -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtGui -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtQml -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtNetwork -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtCore -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\mkspecs\\\\win32-msvc -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -D_WINDOWS -nologo -Fobuild\\.objs\\test\\windows\\x64\\release\\gens\\rules\\qt\\qrc\\qml.cpp.obj build\\.gens\\test\\windows\\x64\\release\\rules\\qt\\qrc\\qml.cpp
[ 50%]: compiling.release src\main.cpp
cl.exe -c -Ox -fp:fast -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtQuick -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtGui -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtQml -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtNetwork -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include\\\\QtCore -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\include -ID:\\\\soft\\\\Qt\\\\Qt5.6.3\\\\5.6.3\\\\msvc2015\\\\mkspecs\\\\win32-msvc -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -D_WINDOWS -nologo -Fobuild\\.objs\\test\\windows\\x64\\release\\src\\main.cpp.obj src\\main.cpp
checking for the link.exe ... ok
checking for the linker (ld) ... link.exe
[100%]: linking.release test.exe
link.exe @C:\\Users\\dell\\AppData\\Local\\Temp\\.xmake\\190716\\_1059B3DD199D734B7F63617F69CB2F6A.args.txt
error: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: Qt5Gui.lib(Qt5Gui.dll) : fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突

stack traceback:
    [C]: in function 'error'
    [D:\soft\xmake/core/base/os.lua:719]: in function 'raise'
    [$(programdir)\core\sandbox\modules\os.lua:309]: in function 'runv'
    [$(programdir)\modules\core\tools\link.lua:115]:
    [C]: in function 'link'
    [$(programdir)\actions\build\kinds\binary.lua:90]: in function '_do_link_target'
    [$(programdir)\actions\build\kinds\binary.lua:113]:
    [$(programdir)\actions\build\kinds\binary.lua:134]: in function '_link_target'
    [$(programdir)\actions\build\kinds\binary.lua:161]: in function '_build_from_objects'
    [$(programdir)\actions\build\kinds\binary.lua:215]: in function 'build'
    [$(programdir)\actions\build\build.lua:40]: in function '_do_build_target'
    [$(programdir)\actions\build\build.lua:64]: in function 'script'
    [$(programdir)\actions\build\build.lua:140]: in function '_build_target'
    [$(programdir)\actions\build\build.lua:167]: in function '_build_target_and_deps'
    [$(programdir)\actions\build\build.lua:233]: in function 'build'
    [$(programdir)\actions\build\main.lua:59]:
    [C]: in function 'trycall'
    [$(programdir)\core\sandbox\modules\try.lua:121]: in function 'try'
    [$(programdir)\actions\build\main.lua:57]:
    [C]: in function 'load'
    [D:\soft\xmake/core/base/task.lua:506]: in function 'run'
    [D:\soft\xmake/core/main.lua:231]:
waruqi commented 5 years ago

你直接执行 xmake f -c 然后执行 xmake.切到默认 arch 和mode编译试试呢 可以自己切不同arch 和mode 都测试下

我怀疑你这 qt sdk 在 debug x86下 链接缺某些库 导致链接失败了

不过没报出链接错误信息 看着也有点问题

jiagushuai commented 5 years ago
# 直接执行xmake f -c
D:\GitLab\test> xmake f -c
checking for the architecture ... x64
checking for the Microsoft Visual Studio (x64) version ... 2015
checking for the Qt SDK directory ... D:\soft\Qt\Qt5.6.3\5.6.3\msvc2015
checking for the Qt SDK version ... 5.6.3
D:\GitLab\test>xmake
[100%]: linking.release test.exe
error: Qt5Gui.lib(Qt5Gui.dll) : fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突

# 设置qt路径后执行xmake
D:\GitLab\test>xmake f --qt=D:\QtStatic\
checking for the architecture ... x64
checking for the Microsoft Visual Studio (x64) version ... 2015
checking for the Qt SDK directory ... D:\QtStatic\5.6.3\VS2015Static
checking for the Qt SDK version ... 5.6.3
D:\GitLab\test>xmake
[  0%]: compiling.qt.qrc src\qml.qrc

# 设置qt路径和平台x86后执行xmake
D:\GitLab\test>xmake f --qt=D:\QtStatic\ -a x86
checking for the Microsoft Visual Studio (x86) version ... 2015
checking for the Qt SDK directory ... D:\QtStatic\5.6.3\VS2015Static
checking for the Qt SDK version ... 5.6.3

D:\GitLab\test>xmake
[  0%]: compiling.qt.qrc src\qml.qrc
[ 50%]: compiling.release src\main.cpp
[100%]: linking.release test.exe
error: Qt5Network.lib(qnetworkinterface_win.obj) : error LNK2019: 无法解析的外部符号 _GetNetworkParams@8,该符号在函数 "public: static class QString __cdecl QHostInfo::localDomainName(void)" (?localDomainName@QHostInfo@@SA?AVQString@@XZ) 中被引用
Qt5Network.lib(qnetworkinterface_win.obj) : error LNK2019: 无法解析的外部符号 _GetAdaptersInfo@8,该符号在函数 "class QHash<class QHostAddress,class QHostAddress> __cdecl ipv4Netmasks(void)" (?ipv4Netmasks@@YA?AV?$QHash@VQHostAddress@@V1@@@XZ) 中被引用
Qt5Network.lib(qnetworkinterface_win.obj) : error LNK2019: 无法解析的外部符号 _GetAdaptersAddresses@20,该符号在函数 "class QList<class QNetworkInterfacePrivate *> __cdecl interfaceListingWinXP(void)" (?interfaceListingWinXP@@YA?AV?$QList@PAVQNetworkInterfacePrivate@@@@XZ) 中被引用
build\\windows\\x86\\release\\test.exe : fatal error LNK1120: 3 个无法解析的外部命令
waruqi commented 5 years ago

error: Qt5Gui.lib(Qt5Gui.dll) : fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突

你当前的这个qt sdk是x86版本的,所以切到x64会报这个问题

error: Qt5Network.lib(qnetworkinterface_win.obj) : error LNK2019: 无法解析的外部符号 _GetNetworkParams@8,该符号在函数 "public: static class QString cdecl QHostInfo::localDomainName(void)" (?localDomainName@QHostInfo@@SA?AVQString@@XZ) 中被引用 Qt5Network.lib(qnetworkinterface_win.obj) : error LNK2019: 无法解析的外部符号 _GetAdaptersInfo@8,该符号在函数 "class QHash<class QHostAddress,class QHostAddress> cdecl ipv4Netmasks(void)" (?ipv4Netmasks@@YA?AV?$QHash@VQHostAddress@@V1@@@XZ) 中被引用 Qt5Network.lib(qnetworkinterface_win.obj) : error LNK2019: 无法解析的外部符号 _GetAdaptersAddresses@20,该符号在函数 "class QList<class QNetworkInterfacePrivate *> __cdecl interfaceListingWinXP(void)" (?interfaceListingWinXP@@YA?AV?$QList@PAVQNetworkInterfacePrivate@@@@XZ) 中被引用 build\windows\x86\release\test.exe : fatal error LNK1120: 3 个无法解析的外部命令

你可以自己xmake.lua加个 add_syslinks("Iphlpapi")试试,缺系统库link而已。

jiagushuai commented 5 years ago

D:\GitLab\test>xmake [100%]: linking.release test.exe

D:\GitLab\test>xmake config -v -D -P . -c --qt=D:\QtStatic\ -p windows -m debug -a x86 -o "build" test checkinfo: runv(vswhere.exe -?) failed(-1)! checking for the vswhere.exe ... no checkinfo: runv(vswhere.exe -?) failed(-1)! checking for the vswhere ... no checking for the cl.exe ... ok checking for the Microsoft Visual Studio (x86) version ... 2015 checking for the Qt SDK directory ... D:\QtStatic\5.6.3\VS2015Static checking for the Qt SDK version ... 5.6.3 configure { arch = x86 ccache = true mode = debug qt_sdkver = 5.6.3 plat = windows clean = true host = windows kind = static buildir = build vs = 2015 ndk_stdcxx = true qt = D:\QtStatic\5.6.3\VS2015Static }

D:\GitLab\test>xmake build -v -D -P . -w test configure { arch = x86 ccache = true clean = true mode = debug qt_sdkver = 5.6.3 plat = windows ndk_stdcxx = true host = windows kind = static buildir = build vs = 2015 qt = D:\QtStatic\ } checking for the c++ compiler (cxx) ... cl.exe checking for the ccache ... no checking for the flags (-Od) ... ok

cl.exe -Od checking for the flags (-std:c++11) ... no cl.exe -std:c++11 checking for the flags (-fPIC) ... no cl.exe -fPIC checking for the link.exe ... ok checking for the linker (ld) ... link.exe [100%]: linking.debug test.exe link.exe @C:\Users\dell\AppData\Local\Temp\.xmake\190717\_B50765A14C82A12F5CF46E23B923D8DE.args.txt error: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: D:\soft\xmake/core/base/os.lua:719: runv(link.exe @C:\Users\dell\AppData\Local\Temp.xmake\190717_B50765A14C82A12F5CF46E23B923D8DE.args.txt) failed(1120)! stack traceback: [C]: in function 'error' [D:\soft\xmake/core/base/os.lua:719]: in function 'raise' [$(programdir)\core\sandbox\modules\os.lua:309]: in function 'runv' [$(programdir)\modules\core\tools\link.lua:115]: [C]: in function 'link' [$(programdir)\actions\build\kinds\binary.lua:90]: in function '_do_link_target' [$(programdir)\actions\build\kinds\binary.lua:113]: [$(programdir)\actions\build\kinds\binary.lua:134]: in function '_link_target' [$(programdir)\actions\build\kinds\binary.lua:161]: in function '_build_from_objects' [$(programdir)\actions\build\kinds\binary.lua:215]: in function 'build' [$(programdir)\actions\build\build.lua:40]: in function '_do_build_target' [$(programdir)\actions\build\build.lua:64]: in function 'script' [$(programdir)\actions\build\build.lua:140]: in function '_build_target' [$(programdir)\actions\build\build.lua:167]: in function '_build_target_and_deps' [$(programdir)\actions\build\build.lua:233]: in function 'build' [$(programdir)\actions\build\main.lua:59]: [C]: in function 'trycall' [$(programdir)\core\sandbox\modules\try.lua:121]: in function 'try' [$(programdir)\actions\build\main.lua:57]: [C]: in function 'load' [D:\soft\xmake/core/base/task.lua:506]: in function 'run' [D:\soft\xmake/core/main.lua:231]:


+ 运行命令编译生成的test.exe报错

![image](https://user-images.githubusercontent.com/29997741/61360898-f3888900-a8b1-11e9-8357-a1705ca5f4ef.png)