How to reconfigure Google Test for 32-bit firmware?

I was able to install Google Test in accordance with this .

My problem is this: I need to test projects that are developed for firmware with a 32-bit operating system, so I need to reconfigure Google Test from the 64-bit version.

In the old version 1.7.0, it is known that the solution was as follows:

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

Here 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

I did this because I could not find the configuration files elsewhere, but the results shown on the terminal were the same as with the reconfiguration of version 1.7.0.

However, after use:

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

env 32- make , .

, : gcc?

+4
2

32- googletest, , , :

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

:

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

32- googletest 64- , 32-, . , :

-DCMAKE_INSTALL_PREFIX:PATH=/home/me/googletest_32
+3

Google . - pre-build, , Makefile :

include /opt/foreign_components/gmock-1.7.0/gmock.mk

OBJ_SERI_BASIC = \
        $(GMOCK_OBJ) \
        $(COMPONENT_HOME_SERI)/unittest/src/test_virtual.o \
        $(COMPONENT_HOME_SERI)/component/name_value_pair.o

gmock.mk :

GMOCK_PATH=$(HOME)/foreign_components/gmock-1.7.0

GMOCK_OBJ= \
       $(GMOCK_PATH)/fused-src/gmock_main.o \
       $(GMOCK_PATH)/fused-src/gmock-gtest-all.o

GMOCK_INCLUDE=\
          -I$(GMOCK_PATH)/fused-src/gmock/ \
          -I$(GMOCK_PATH)/fused-src

, . , , 64 32 .

+2

Source: https://habr.com/ru/post/1649182/


All Articles