Skip to content

Commit 0d27ba0

Browse files
authored
Fix Google Mock differences between Ubuntu 18.04 and 16.04 (#9141)
I thought I got all of these, but turns out I didn't, there's another weirdism in how Google Mock and Google Test are packaged on Ubuntu where the `cmake` command fails due to directories outside of the build root. Double checked logs on Ubuntu 18.04 and Ubuntu 16.04 for this after enabling verbose copying: ```shell $ ./docker/build.sh ci_cpu --net=host ... 'googlemock/libgmock.a' -> '/usr/lib/libgmock.a' 'googlemock/libgmock_main.a' -> '/usr/lib/libgmock_main.a' 'googlemock/gtest/libgtest.a' -> '/usr/lib/libgtest.a' 'googlemock/gtest/libgtest_main.a' -> '/usr/lib/libgtest_main.a' $ ./docker/build.sh ci_i386 --net=host ... 'libgtest.a' -> '/usr/lib/libgtest.a' 'libgtest_main.a' -> '/usr/lib/libgtest_main.a' ... 'libgmock.a' -> '/usr/lib/libgmock.a' 'libgmock_main.a' -> '/usr/lib/libgmock_main.a' ```
1 parent 198a8ab commit 0d27ba0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docker/install/ubuntu_install_core.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ apt-get update && apt-get install -y --no-install-recommends \
2626
libcurl4-openssl-dev libssl-dev libopenblas-dev g++ sudo \
2727
apt-transport-https graphviz pkg-config curl
2828

29-
30-
cd /usr/src/gtest && cmake CMakeLists.txt && make && cp *.a /usr/lib
31-
cd /usr/src/gmock && cmake CMakeLists.txt && make && cp *.a /usr/lib
29+
if [[ -d /usr/src/googletest ]]; then
30+
# Single package source (Ubuntu 18.04)
31+
# googletest is installed via libgtest-dev
32+
cd /usr/src/googletest && cmake CMakeLists.txt && make && cp -v {googlemock,googlemock/gtest}/*.a /usr/lib
33+
else
34+
# Split source package (Ubuntu 16.04)
35+
# libgtest-dev and google-mock
36+
cd /usr/src/gtest && cmake CMakeLists.txt && make && cp -v *.a /usr/lib
37+
cd /usr/src/gmock && cmake CMakeLists.txt && make && cp -v *.a /usr/lib
38+
fi

0 commit comments

Comments
 (0)