Reputation: 2377
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?
Upvotes: 7
Views: 5342
Reputation: 25603
We build google test with our applications itself. We did not use any pre build library, we simply include the needed stuff in our build toolchain like this fragment in the Makefile shows:
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
and the gmock.mk contains:
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
So any flags and changes to the build will also be affect the test framework. So we build it with different compilers, targets and also for 64 and 32 bit on various platforms.
Upvotes: 2
Reputation: 61232
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
Upvotes: 5