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

Compiling and using CppUTest 3.8 under MSYS2/MinGW32 #1086

Closed
Jodocus opened this issue Mar 22, 2017 · 1 comment
Closed

Compiling and using CppUTest 3.8 under MSYS2/MinGW32 #1086

Jodocus opened this issue Mar 22, 2017 · 1 comment

Comments

@Jodocus
Copy link

Jodocus commented Mar 22, 2017

Hi!

My problem is somewhat related to this one, though I am not sure if it got fixed over the years.
I want to compile cpputest inside a MSYS2 (MinGW-32) shell using cmake via

cd cpputest_build
cmake ..
make

Building libCppUTest.a and libCppUTestExt.a succeeded, but CppUTestTests failed with a lot of linker errors related to the C++ standard library (like undefined reference to __gxx_personality_v0'). When linking my unit tests with the libraries, I get pretty much the same errors, which however get resolved when I link with -lstdc++ additionally. Unfortunately, whenever a test assertion fails, the unit test will just crash ("This application has requested the Runtime to terminate it in an unusual way...") rather than generating output (e.g. JUnit report), so I guess something went wrong during the building process of CppUTest. What can I do about it? This problem already appears in very simple situations like

TEST(Group, SomeTest) {
    FAIL("always");
}

I am using GCC 6.3.0.

@Jodocus
Copy link
Author

Jodocus commented Mar 23, 2017

I figured it out. CMake auto-detected /mingw32/bin/cc.exe for a C and C++ compiler. However, this one doesn't seem to include -lstdc++, at least on MinGW. Running CMake as

cmake -DCMAKE_CXX_COMPILER=/mingw32/bin/i686-w64-mingw32-c++.exe -DC++11=ON CMakeLists.txt

fixed the linker error issue. Same for the Runtime error: use again the same compiler binary such as i686-w64-mingw32-c++.exe for building the unit tests. Those errors seem to stem from awkward ABI incompatabilities between different GCC versions.

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

No branches or pull requests

1 participant