Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ninja 配置文件生成错误 #3082

Closed
SakuNight opened this issue Nov 19, 2022 · 5 comments
Closed

Ninja 配置文件生成错误 #3082

SakuNight opened this issue Nov 19, 2022 · 5 comments
Labels
Milestone

Comments

@SakuNight
Copy link

Xmake 版本

xmake v2.7.3+HEAD.b35ff3118

操作系统版本和架构

Windows 10 Pro for Workstations 22H2 19045.2251

描述问题

PS C:\Users\30110\personal\projects> xmake create -l c++ -t console ./anewbug
create ./anewbug ...
  [+]: src\main.cpp
  [+]: xmake.lua
  [+]: .gitignore
create ok!
PS C:\Users\30110\personal\projects> cd anewbug
PS C:\Users\30110\personal\projects\anewbug> xmake project -k ninja
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.33.31630
create ok!
PS C:\Users\30110\personal\projects\anewbug> ninja
ninja: error: build.ninja:70: multiple rules generate build/.objs/anewbug/windows/x64/release/src/main.cpp.obj

PS C:\Users\30110\personal\projects\anewbug> ninja --version
1.11.1
PS C:\Users\30110\personal\projects\anewbug> xmake --version
xmake v2.7.3+HEAD.b35ff3118, A cross-platform build utility based on Lua
Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io
                         _
    __  ___ __  __  __ _| | ______
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____|
                         by ruki, xmake.io

    👉  Manual: https://xmake.io/#/getting_started
    🙏  Donate: https://xmake.io/#/sponsor

PS C:\Users\30110\personal\projects\anewbug>

期待的结果

生成正确的 build.ninja

工程配置

默认的

附加信息和错误日志

No response

@SakuNight SakuNight added the bug label Nov 19, 2022
waruqi added a commit that referenced this issue Nov 19, 2022
@waruqi
Copy link
Member

waruqi commented Nov 19, 2022

再试试 xmake update -s dev

@waruqi waruqi added this to the v2.7.4 milestone Nov 19, 2022
@SakuNight
Copy link
Author

PS C:\Users\30110\personal\projects> xmake create -l c++ -t console ./bug
create ./bug ...
  [+]: src\main.cpp
  [+]: xmake.lua
  [+]: .gitignore
create ok!
PS C:\Users\30110\personal\projects> cd bug
PS C:\Users\30110\personal\projects\bug> xmake project -k ninja
checking for platform ... windows
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.33.31630
create ok!
PS C:\Users\30110\personal\projects\bug> ninja
[1/1] regenerating ninja files
create ok!
[1/2] compiling.release src\main.cpp
FAILED: build/.objs/bug/windows/x64/release/src/main.cpp.obj
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.exe -showIncludes -c -nologo -O2 -fp:fast /EHsc -DNDEBUG src\main.cpp -Fobuild\.objs\bug\windows\x64\release\src\main.cpp.obj
src\main.cpp(1): fatal error C1034: iostream: no include path set
ninja: build stopped: subcommand failed.

@SakuNight
Copy link
Author

我没怎么用过 msvc,不清楚这是我的安装问题还是 xmake

@waruqi
Copy link
Member

waruqi commented Nov 19, 2022

我没怎么用过 msvc,不清楚这是我的安装问题还是 xmake

如果你走 xmake 直接编译,那么 xmake 会自动加载 msvc 环境,但是你走 ninja 生成,ninja 不会给你加载 msvc 环境,没有 msvc 的各种环境变量,你只能在 vc prompt cmd 下运行才行。 这跟 xmake 没啥关系。

另外,xmake 编译速度原本就跟 ninja 一样快,没必要还去额外生成 ninja 再去用 ninja 编译。

@SakuNight
Copy link
Author

原来如此明白了。

@waruqi waruqi closed this as completed Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants