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

Phony targets + xmake f = toochain not found #6037

Open
HoShiMin opened this issue Jan 3, 2025 · 1 comment
Open

Phony targets + xmake f = toochain not found #6037

HoShiMin opened this issue Jan 3, 2025 · 1 comment
Labels

Comments

@HoShiMin
Copy link

HoShiMin commented Jan 3, 2025

Xmake Version

2.9.7

Operating System Version and Architecture

Windows 11 24H2

Describe Bug

I have a phony target that unites several other targets. When I try xmake config -a <something>, it fails with toolchain not found for the phony target.

Expected Behavior

Configuration should be applied for only "real" targets, not for the phony ones.

Project Configuration

set_project('app')
set_version('0.1.0')

target('sample-clang')
    set_toolchains('clang-cl')
    add_rules('mode.debug', 'mode.release')
    add_files('main.cpp')

target('sample-msvc')
    set_toolchains('msvc')
    add_rules('mode.debug', 'mode.release')
    add_files('main.cpp')

target('both')
    set_kind('phony')
    add_deps('sample-clang')
    add_deps('sample-msvc')

Additional Information and Error Logs

PS F:\Programs\Cpp\xmake-sample> xmake f -a x64
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2022
checking for LLVM Clang C/C++ Compiler (x64) version ... 19.1.5
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.42.34435
error: target(both): toolchain not found!
@HoShiMin HoShiMin added the bug label Jan 3, 2025
@waruqi
Copy link
Member

waruqi commented Jan 5, 2025

it works for me

> xmake f -a x64
checking for platform ... windows
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.41.33923
checking for Microsoft Visual Studio (x64) version ... 2022
checking for LLVM Clang C/C++ Compiler (x64) version ... 18.1.6

> xmake -rv
checking for clang-cl.exe ... C:\Program Files\LLVM\bin\clang-cl.exe
checking for the c++ compiler (cxx) ... clang-cl.exe
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.41.33923\bin\HostX64\x64\cl.exe
checking for the c++ compiler (cxx) ... cl.exe
checking for C:\Program Files\LLVM\bin\clang-cl.exe ... ok
checking for C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.41.33923\bin\HostX64\x64\cl.exe ... ok
checking for flags (-O2) ... ok
checking for flags (-DNDEBUG) ... ok
[ 50%]: compiling.release src\main.cpp
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.41.33923\\bin\\HostX64\\x64\\cl.exe" -c -nologo -O2 /EHsc -DNDEBUG -Fobuild\.objs\sample-msvc\windows\x64\release\src\main.cpp.obj src\main.cpp
checking for flags (-O2) ... ok
checking for flags (-DNDEBUG) ... ok
[ 50%]: cache compiling.release src\main.cpp
"C:\\Program Files\\LLVM\\bin\\clang-cl.exe" -c --target=x86_64-pc-windows-msvc -O2 /EHsc -DNDEBUG -Fobuild\.objs\sample-clang\windows\x64\release\src\main.cpp.obj src\main.cpp
checking for flags (-fcolor-diagnostics) ... ok
checking for flags (-fansi-escape-codes) ... ok
checking for flags (cl_sourceDependencies) ... ok
[ 60%]: linking.release sample-msvc.exe
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.41.33923\\bin\\HostX64\\x64\\link.exe" -nologo -dynamicbase -nxcompat -machine:x64 /opt:ref /opt:icf -out:build\windows\x64\release\sample-msvc.exe build\.objs\sample-msvc\windows\x64\release\src\main.cpp.obj
[ 80%]: linking.release sample-clang.exe
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.41.33923\\bin\\HostX64\\x64\\link.exe" -nologo -dynamicbase -nxcompat -machine:x64 /opt:ref /opt:icf -out:build\windows\x64\release\sample-clang.exe build\.objs\sample-clang\windows\x64\release\src\main.cpp.obj
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.41.33923\bin\HostX64\x64\cl.exe
checking for the c compiler (cc) ... cl.exe
checking for clang-cl.exe ... C:\Program Files\LLVM\bin\clang-cl.exe
checking for the c compiler (cc) ... clang-cl.exe
[100%]: build ok, spent 3.984s

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