kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [2/2] kudu git commit: Fix gmock link errors on macOS
Date Wed, 21 Jun 2017 21:11:35 GMT
Fix gmock link errors on macOS

For reasons unknown, using 'make install' to install the gmock/gtest
libraries was causing the lib name to be malformed on macOS. For
example, before this change:

```
$ otool -L thirdparty/installed/uninstrumented/lib/libgmock.dylib
thirdparty/installed/uninstrumented/lib/libgmock.dylib:
        libgmock.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
        /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 125.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
```

and with the change:

```
$ otool -L thirdparty/installed/uninstrumented/lib/libgmock.dylib
thirdparty/installed/uninstrumented/lib/libgmock.dylib:
        /Users/dan/src/cpp/kudu-gtest/thirdparty/build/gmock-1.7.0.shared/libgmock.dylib (compatibility
version 0.0.0, current version 0.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
        /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 125.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
```

The result was that tests failed with runtime linker errors:

```
$ bin/index-test
dyld: Library not loaded: libgmock.dylib
  Referenced from: /Users/dan/src/cpp/kudu/build/debug/bin/index-test
    Reason: image not found
    fish: 'and bin/index-test' terminated by signal SIGTRAP (Trace or breakpoint trap)
```

I didn't get as far as identifying why the built libraries don't have
the same lib name issue (as opposed to the installed libraries).

Change-Id: I41e6d4bfcabb36efbf83fd4969e9f35c16b74f3d
Reviewed-on: http://gerrit.cloudera.org:8080/7251
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Reviewed-by: Dan Burkert <danburkert@apache.org>
Tested-by: Dan Burkert <danburkert@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/a5b7ece1
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/a5b7ece1
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/a5b7ece1

Branch: refs/heads/master
Commit: a5b7ece1b1132cdda968349a9844d7389e8cff2c
Parents: f3f75ab
Author: Dan Burkert <danburkert@apache.org>
Authored: Wed Jun 21 13:10:07 2017 -0700
Committer: Dan Burkert <danburkert@apache.org>
Committed: Wed Jun 21 21:11:11 2017 +0000

----------------------------------------------------------------------
 thirdparty/build-definitions.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/a5b7ece1/thirdparty/build-definitions.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index fcbe9dc..20dea1d 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -327,11 +327,19 @@ build_gmock() {
       -DCMAKE_BUILD_TYPE=Debug \
       -DCMAKE_POSITION_INDEPENDENT_CODE=On \
       -DBUILD_SHARED_LIBS=$SHARED \
-      -DCMAKE_INSTALL_PREFIX=$PREFIX \
       $GMOCK_SOURCE/googlemock
-    make -j$PARALLEL $EXTRA_MAKEFLAGS install
+    make -j$PARALLEL $EXTRA_MAKEFLAGS
     popd
   done
+
+  # Install gmock/gtest libraries and headers manually instead of using make
+  # install. Make install results in libraries with a malformed lib name on
+  # macOS.
+  echo Installing gmock...
+  cp -a $GMOCK_SHARED_BDIR/libgmock.$DYLIB_SUFFIX $PREFIX/lib/
+  cp -a $GMOCK_STATIC_BDIR/libgmock.a $PREFIX/lib/
+  rsync -av $GMOCK_SOURCE/googlemock/include/ $PREFIX/include/
+  rsync -av $GMOCK_SOURCE/googletest/include/ $PREFIX/include/
 }
 
 build_protobuf() {


Mime
View raw message