-
-
Notifications
You must be signed in to change notification settings - Fork 688
Description
Godot version
no matter
godot-cpp version
godot-4.5-stable
System information
Windows 11
Issue description
Incorrect linker flags are used when building the project in the Windows + Clang (GNU-like CLI) + Ninja + CMake environment
FAILED: [code=1] reproduce.dll reproduce.lib
C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -nostartfiles -nostdlib -O0 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -g -Xclang -gcodeview -shared -Wl,--no-undefined -lstdc++ -fuse-ld=lld-link -o reproduce.dll -Xlinker /MANIFEST:EMBED -Xlinker /implib:reproduce.lib -Xlinker /pdb:reproduce.pdb -Xlinker /version:0.0 CMakeFiles/reproduce.dir/empty.cpp.obj bin/libgodot-cpp.windows.template_debug.x86_64.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
lld-link: warning: ignoring unknown argument '--no-undefined'
lld-link: error: could not open 'stdc++.lib': no such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Incorrect linker flags are added here. I assume this was written with the expectation that we are using MinGW/MSYS with a POSIX runtime, but that’s not the case here.
t would be nice to have an option to prevent targets that use godot-cpp from being polluted with its PUBLIC linker flags, and instead allow the higher-level project (the one that calls add_subdirectory(godot-cpp)) to control them.
Steps to reproduce
- Download reproduce.zip
- Configure (options below)
- Try to build
- Wait for the linking stage
Configure options:
-G Ninja
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_MAKE_PROGRAM=ninja
-DCMAKE_C_COMPILER=C:/Program Files/LLVM/bin/clang.exe (It’s possible to use Clang installed via Chocolatey)
-DCMAKE_CXX_COMPILER=C:/Program Files/LLVM/bin/clang++.exe