-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Double free or corruption (fasttop) with google mock #930
Comments
On Windows I get the following compilation errors instead:
can't resolve:
I'm linking against |
I'm having similar issues. gtest/gmock 1.8.0, gcc 5.4, ubuntu 16.04, cmake 3.6 |
+1. But I get this error only if mock at least one method. |
I have experienced the same issue on Ubuntu 14.04, g+++ 4.8.4, gmock / gtest 1.7.0. |
I also have those three symbols unresolved when linking to |
Will this ever be fixed? Repros on Linux for me too. Pretty much have to hard-code using the static version. |
Same problem here (debian linux)! When googletest libs was compiled shared there is always a core dump on exit; donesn't matter if there are tests or not! |
Hi, I am facing the same issue after upgrading from 1.7.0 to 1.8.0. This happens only when you:
The reason is simple: the CMake build of GMock badly embeds the source code from gtest inside gmock.so. When you load both gmock.so and gtest.so in the same address space, then the same global static variable are resolved to the same symbol, but they are initialized twice, and worse, destructed twice. And calling the destructor of things like std::string or std::vector twice clearly leads to double free. For me the CMakeList.txt of gmock is very wrong. gmock should reference gtest as a real library dependency, not try to embed things like gtest-all.cc in gmock.so. My knowledge of CMake is too low to try to fix it right now. I just know in release 1.7.0 I was using the autotools (ie ./configure) instead of cmake, and there is was working fine. Will try to fallback to autotools again. Cheers, |
Another option is to make sure you either link with gtest, or gmock, but not with both at the same time. |
I have some problems linking with both gtest and gmock, seems to be the same fault as here: google/googletest#930
I have been cleaning up older and inactive GitHub googletest issues. You may see an issue "closed" if it appears to be inactive/abandoned |
To work around bug: google/googletest#930 Its not possible to link with gmock dynamically. Therefore we need separate kits for tests and building dlls.
The issue is still actual for me on Debian 10 for the last version |
I get the following problem when using google mock for a CMake project on Linux.
gmock
andgtest
are built with CMake. Even without using any google mock features, the error below will occur as long as google mock is linked against my test executable. No problem if linked against google test only.This occurs after the tests completion. My tests all run good but this segfault occurs right after:
or
or
The text was updated successfully, but these errors were encountered: