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

Can't build with Godot 4.2-rc1 and MSVC #126

Closed
ksubox opened this issue Nov 24, 2023 · 2 comments · Fixed by #144
Closed

Can't build with Godot 4.2-rc1 and MSVC #126

ksubox opened this issue Nov 24, 2023 · 2 comments · Fixed by #144
Labels
build system An issue that affects the build system. platform:windows

Comments

@ksubox
Copy link

ksubox commented Nov 24, 2023

Godot version

4.2-rc1

Plugin version

HEAD

System information

Windows 11

Issue description

I try to build webrtc GDExtension for Godot 4.2-rc1. So Cloned repo and checked out godot-cpp 7cd79e4cc64ce484ba04d1919da7d4cd39aab5ff (matched rc1).
Built with VS2022 and finally got error:

msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::pbump(int)" (?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z) already defined in libcpmt.lib(cout.obj)
msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Pnavail(void)const " (?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ) already defined in libcpmt.lib(cout.obj)
msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Init(void)" (?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ) already defined in libcpmt.lib(cout.obj)
msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Init(char * *,char * *,int *,char * *,char * *,int *)" (?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAPEAD0PEAH001@Z) already defined in libcpmt.lib(cout.obj)
msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::xsgetn(char *,__int64)" (?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z) already defined in libcpmt.lib(cout.obj)
msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::xsputn(char const *,__int64)" (?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z) already defined in libcpmt.lib(cout.obj)
   Creating library bin\extension-4.1\webrtc\lib\libwebrtc_native.windows.template_debug.x86_64.lib and object bin\extension-4.1\webrtc\lib\libwebrtc_native.windows.template_debug.x86_64.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : error LNK1218: warning treated as error; no output file generated
scons: *** [bin\extension-4.1\webrtc\lib\libwebrtc_native.windows.template_debug.x86_64.dll] Error 4098
scons: building terminated because of errors.

Steps to reproduce

Clone repo.

cd webrtc-native\godot-cpp
git checkout 7cd79e4cc64ce484ba04d1919da7d4cd39aab5ff
cd ..
scons platform=windows

And finally get error.

Minimal reproduction project

No response

@Faless
Copy link
Collaborator

Faless commented Nov 24, 2023

I try to build webrtc GDExtension for Godot 4.2-rc1.

Note that the current version (godot-cpp for Godot 4.1) is supposed to work in Godot 4.2 .
There is no real reason to update godot-cpp to newer versions unless the Godot WebRTC API changes (which is not the case in 4.2).

@Faless Faless added build system An issue that affects the build system. platform:windows labels Nov 24, 2023
@Faless Faless changed the title Can't build for Godot 4.2-rc1 Can't build with Godot 4.2-rc1 and MSVC Apr 12, 2024
@Faless
Copy link
Collaborator

Faless commented Apr 12, 2024

For now, you can build with MSVC:

scons use_static_cpp=no

For reference this seems caused by the change in godotengine/godot-cpp#1203 which resulted in the default changing from /MD to /MT.

I'll make a new PR to hard-code this fix when MSVC is detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system An issue that affects the build system. platform:windows
Projects
None yet
2 participants