Build googlemock library

When enabling ENABLE_TESTS option to build tfhe project, the googlemock library is needed, otherwise the following errors will be generated:

[ 54%] Linking CXX executable unittests-fftw
/usr/bin/ld: cannot find -lgmock
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/unittests-fftw.dir/build.make:229: test/unittests-fftw] Error 1
make[1]: *** [CMakeFiles/Makefile2:1290: test/CMakeFiles/unittests-fftw.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

To build googlemock, you can follow this guide:

(1) Download googletest:

$ git clone https://github.com/google/googletest.git

(2) Execute autoreconf command:

$ cd googletest/googlemock
$ autoreconf -fvi

(3) Create libgmock:

$ cd make
$ make
$ ar -rv libgmock.a gtest-all.o gmock-all.o

(4) Copy libgmock.a into /usr/local/lib:

$ cp libgmock.a /usr/local/lib/

Then you can use libgmock.a now.

One thought on “Build googlemock library”

  1. Hi Team,

    Platform/category :VCL
    Build :15.1.5
    IDE : Embarcadero C++ Builder 10 Seattle
    Operating system : windows 10

    we had downloaded the googletest & GoogleMock files in following Url : https://github.com/google/googletest

    I had implemented test cases using googletest ,but i don’t know
    how to Create library file for gmock and gmock exe in Embarcadero C++ Builder 10 Seattle,please help me for creating gmock libraries and gmockmain.cbproj

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.