1
votes

I'm trying to use CppUTest in Windows, first step is to get it to work and I already have problems. These are the things I've tried:

First Approach

With CMake, using the cmake GUI I can do the configure and generate command and I get something in the output directory, but no binaries and no libraries, just a bunch of cmakefiles. The CMake GUI says everything went OK during the configuration and generation steps, however the libraries (.lib files) are not generated in the output directory... is there something I am missing? I've never used CMake before.

Second approach

With MinGW and msys alone, running cmd in Windows and executing a MinGW shell by typing sh in the Windows terminal, afterwards I execute the following commands:

cd <CppUTest folder>
mount c:\mingw /mingw
./autogen.sh
./configure
make

The build process starts but it fails with a message indicating that pthread.h was not found in MinGW directory. If I install the pthread-win32 package with the MinGW package manager and repeat the same steps as above the build process starts but fails with a message indicating that the structure timespec is defined in time.h and pthread.h.

I've tried to follow this same procedure with CppUTest 3.6 and it works perfectly fine, I get the .lib files, so I guess I will have to continue with this for now.

Does anyone know how to build CppUTest 3.7 (latest release) with MinGW or CMake?

1
The CMake GUI says everything went OK during the configuration and generation steps - this CMake step is somehow equivalent to ./autogen.sh plus ./configure in autotools. Then you should use make as usual.Tsyvarev
I'll try that when I get out of work... and post here the results.Mite
If I use make.exe or mingw32-make.exe from MinGw in the output directory of CMake it starts to build, but I get the same pthread missing error. Has anyone managed to build CppUTest 3.71 with MinGW?Mite
Googling reveals, that problem with pthread support on MinGW under Windows has relatively long history without being fully resolved. See, e.g., this question.Tsyvarev
Well, I got it to work, to build at least. I downloaded the pthreads package for MinGW, they I handled the timespec redefinition by adding preprocessor two lines to CppUTest source code. I'll try to do something with CppUTest before confirming this works.Mite

1 Answers

0
votes

In the end I used Cygwin to compile it, I couldn't find a way to compile it with MinGW properly, I added a dirty trick to make it compile under MinGW (handled the timespec redifinition) but chances are that is going to cause issues.

Just make sure that you use Cygwin aswell to compile your tests, something that I found out after making this question (https://www.youtube.com/watch?v=oVmd0P85D8o).