xmake-io / xmake

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

Unnecessary ldflags on windows #5420

Closed star-hengxing closed 3 months ago

star-hengxing commented 3 months 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 3 months ago

try it again. xmake update -s dev

star-hengxing commented 3 months ago

It work. Thanks