Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reconfigure Google Test for a 32-bit embedded software?

I've managed to install Google Test according to this.

My problem is the following: I have to test projects which are being developed for an embedded software with a 32-bit operating system, so I need to reconfigure Google Test from 64-bit.

With the old 1.7.0 version it is know that the solution was this:

autoreconf -fvi
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make

This is how I tried now with the new version:

cd home/CWD/googletest/googlemock
autoreconf -fvi
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"

cd home/CWD/googletest/googletest
autoreconf -fvi
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"

cd ..
mkdir googletest_build
cd googletest_build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/me/googletest ../googletest
make
make install

Did this, because I could not find configure files anywhere else but results shown in the terminal were the same as with the 1.7.0 version's reconfiguration.

However after using:

make UTEST=yes project_Name

I get this:

Linking... project_Name
GTEST_LDFLAGS=-L ../../googletest//lib/ -lpthread -lgtest -lgtest_main -lgmock -lstdc++!
/usr/bin/ld: skipping incompatible ../../googletest//lib//libgtest.a when searching for -lgtest
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../libgtest.a when searching for -lgtest
/usr/bin/ld: skipping incompatible //usr/lib/libgtest.a when searching for -lgtest
/usr/bin/ld: cannot find -lgtest
/usr/bin/ld: skipping incompatible ../../googletest//lib//libgtest_main.a when searching for -lgtest_main
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../libgtest_main.a when searching for -lgtest_main
/usr/bin/ld: skipping incompatible //usr/lib/libgtest_main.a when searching for -lgtest_main
/usr/bin/ld: cannot find -lgtest_main
/usr/bin/ld: skipping incompatible ../../googletest//lib//libgmock.a when searching for -lgmock
/usr/bin/ld: cannot find -lgmock
collect2: error: ld returned 1 exit status

The projects env variables are set to 32-bit in the makefile, so that shouldn't be the problem.

Looking at the error message I am thinking: Is it my gcc version?

like image 857
MattSom Avatar asked Jul 26 '16 15:07

MattSom


1 Answers

To build 32-bit googletest using my answer that you have referred to just follow the same procedure but instead of running:

cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/me/googletest ../googletest

run:

cmake -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_INSTALL_PREFIX:PATH=/home/me/googletest ../googletest

If you are making even a personal installation of 32-bit googletest on a 64-bit host it would be a good idea to make it obvious that it is 32-bit, e.g. by using the like of:

-DCMAKE_INSTALL_PREFIX:PATH=/home/me/googletest_32
like image 106
Mike Kinghan Avatar answered Nov 06 '22 18:11

Mike Kinghan