xmake-io / xmake

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

Unnecessary ldflags on windows #5420

Closed star-hengxing closed 1 month ago

star-hengxing commented 1 month ago

Xmake Version

dev

Operating System Version and Architecture

Windows

Describe Bug

$ xmake f -c --toolchain=clang
$ xmake
[ 37%]: cache compiling.release test.c
clang -c -Qunused-arguments -m64 -o build\.objs\a\windows\x64\release\test.c.obj test.c
[ 50%]: cache compiling.release test.c
clang -c -Qunused-arguments -m64 -o build\.objs\b\windows\x64\release\test.c.obj test.c
[ 62%]: linking.release a.dll
clang++ -o build\windows\x64\release\a.dll build\.objs\a\windows\x64\release\test.c.obj -shared -m64
[ 87%]: linking.release b.exe
clang++ -o build\windows\x64\release\b.exe build\.objs\b\windows\x64\release\test.c.obj -m64 -Lbuild\windows\x64\release -Wl,-rpath=$ORIGIN -la
LINK : warning LNK4044: unrecognized option '/rpath=$ORIGIN'; ignored
LINK : fatal error LNK1181: cannot open input file 'a.lib'
clang++: error: linker command failed with exit code 1181 (use -v to see invocation)
error: execv(clang++ -o build\windows\x64\release\b.exe build\.objs\b\windows\x64\release\test.c.obj -m64 -Lbuild\windows\x64\release -Wl,-rpath=$ORIGIN -la) failed(1181)

Expected Behavior

Remove ldflags

LINK : warning LNK4044: unrecognized option '/rpath=$ORIGIN'; ignored

Project Configuration

target("a")
    set_kind("shared")
    add_files("test.c")

target("b")
    set_kind("binary")
    add_files("test.c")
    add_deps("a")

Additional Information and Error Logs

N/A

waruqi commented 1 month ago

try it again. xmake update -s dev

star-hengxing commented 1 month ago

It work. Thanks