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

BUG: symbols duplicated between gtest & gmock on windows #68

Closed
h-vetinari opened this issue Apr 20, 2023 · 0 comments · Fixed by #69
Closed

BUG: symbols duplicated between gtest & gmock on windows #68

h-vetinari opened this issue Apr 20, 2023 · 0 comments · Fixed by #69

Comments

@h-vetinari
Copy link
Member

Seen in conda-forge/abseil-cpp-feedstock#58, it appears that there are symbols which appear in both gtest and gmock:

[139/601] Linking CXX executable bin\absl_atomic_hook_test.exe
FAILED: bin/absl_atomic_hook_test.exe 
cmd.exe /C "cd . && D:\bld\abseil-split_1681891785618\_build_env\Library\bin\cmake.exe -E vs_link_exe --intdir=absl\base\CMakeFiles\absl_atomic_hook_test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo absl\base\CMakeFiles\absl_atomic_hook_test.dir\internal\atomic_hook_test.cc.obj  /out:bin\absl_atomic_hook_test.exe /implib:absl\base\absl_atomic_hook_test.lib /pdb:bin\absl_atomic_hook_test.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console  absl\base\absl_atomic_hook_test_helper.lib  absl\abseil_dll.lib  D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gmock-md.lib  D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest_main-md.lib  D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest-md.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo absl\base\CMakeFiles\absl_atomic_hook_test.dir\internal\atomic_hook_test.cc.obj /out:bin\absl_atomic_hook_test.exe /implib:absl\base\absl_atomic_hook_test.lib /pdb:bin\absl_atomic_hook_test.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console absl\base\absl_atomic_hook_test_helper.lib absl\abseil_dll.lib D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gmock-md.lib D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest_main-md.lib D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest-md.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\absl_atomic_hook_test.exe.manifest" failed (exit code 1169) with the following output:
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "bool __cdecl testing::internal::IsTrue(b[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "class std::basic_string<char,struct std:[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "class testing::AssertionResult __cdecl t[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "class testing::AssertionResult __cdecl t[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "class testing::AssertionResult __cdecl t[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "class testing::TestInfo * __cdecl testin[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "private: virtual struct testing::Test::S[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "private: void __cdecl testing::Assertion[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "protected: __cdecl testing::Test::Test(v[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "protected: virtual void __cdecl testing:[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "protected: virtual void __cdecl testing:[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::AssertionResult[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::AssertionResult[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::MatcherDescribe[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::Message::Messag[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::Message::~Messa[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::internal::Asser[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::internal::Asser[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::internal::GTest[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: __cdecl testing::internal::GTest[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: char const * __cdecl testing::As[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: class std::basic_ostream<char,st[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: virtual __cdecl testing::Matcher[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: virtual __cdecl testing::Test::~[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "public: void __cdecl testing::internal::[...]" already defined in gmock-md.lib(gmock.dll)
gtest-md.lib(gtest-all.cc.obj) : error LNK2005: "void const * __cdecl testing::internal::[...]" already defined in gmock-md.lib(gmock.dll)
bin\absl_atomic_hook_test.exe : fatal error LNK1169: one or more multiply defined symbols found

Seems to depend on the order with which these two libs appear in the linker CLI:

[140/601] Linking CXX shared library bin\abseil_test_dll.dll
FAILED: bin/abseil_test_dll.dll absl/abseil_test_dll.lib 
cmd.exe /C "cmd.exe /C "D:\bld\abseil-split_1681891785618\_build_env\Library\bin\cmake.exe -E __create_def D:\bld\abseil-split_1681891785618\work\build\absl\CMakeFiles\abseil_test_dll.dir\.\exports.def D:\bld\abseil-split_1681891785618\work\build\absl\CMakeFiles\abseil_test_dll.dir\.\exports.def.objs && cd D:\bld\abseil-split_1681891785618\work\build" && D:\bld\abseil-split_1681891785618\_build_env\Library\bin\cmake.exe -E vs_link_dll --intdir=absl\CMakeFiles\abseil_test_dll.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo absl\CMakeFiles\abseil_test_dll.dir\log\scoped_mock_log.cc.obj  /out:bin\abseil_test_dll.dll /implib:absl\abseil_test_dll.lib /pdb:bin\abseil_test_dll.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO  /DEF:absl\CMakeFiles\abseil_test_dll.dir\.\exports.def  absl\abseil_dll.lib  D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest-md.lib  D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gmock-md.lib  D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest-md.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
LINK: command "C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo absl\CMakeFiles\abseil_test_dll.dir\log\scoped_mock_log.cc.obj /out:bin\abseil_test_dll.dll /implib:absl\abseil_test_dll.lib /pdb:bin\abseil_test_dll.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO /DEF:absl\CMakeFiles\abseil_test_dll.dir\.\exports.def absl\abseil_dll.lib D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest-md.lib D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gmock-md.lib D:\bld\abseil-split_1681891785618\_h_env\Library\lib\gtest-md.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\abseil_test_dll.dll.manifest" failed (exit code 1169) with the following output:
gmock-md.lib(gmock.dll) : error LNK2005: "bool __cdecl testing::internal::IsTrue(b[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "class std::basic_string<char,struct std:[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: __cdecl testing::Matcher<class s[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: __cdecl testing::MatcherDescribe[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: __cdecl testing::internal::GTest[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: __cdecl testing::internal::GTest[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: bool __cdecl testing::internal::[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: bool __cdecl testing::internal::[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: class std::basic_ostream<char,st[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: static class testing::internal::[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: virtual __cdecl testing::Matcher[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: virtual __cdecl testing::Matcher[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: virtual void __cdecl testing::in[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: void __cdecl testing::internal::[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: void __cdecl testing::internal::[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "public: void __cdecl testing::internal::[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "void __cdecl testing::internal::PrintByt[...]" already defined in gtest-md.lib(gtest-all.cc.obj)
gmock-md.lib(gmock.dll) : error LNK2005: "void __cdecl testing::internal::PrintStr[...]" already defined in gtest-md.lib(gtest-all.cc.obj)

bin\abseil_test_dll.dll : fatal error LNK1169: one or more multiply defined symbols found

Host env:

  environment location: D:\bld\abseil-split_1681891785618\_h_env


The following NEW packages will be INSTALLED:

    gmock:          1.13.0-h91493d7_0       conda-forge
    gtest:          1.13.0-h91493d7_0       conda-forge
    ucrt:           10.0.22621.0-h57928b3_0 conda-forge
    vc:             14.3-hb6edc58_10        conda-forge
    vs2015_runtime: 14.34.31931-h4c5c07a_10 conda-forge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant