sgilmore10 commented on PR #37483:
URL: https://github.com/apache/arrow/pull/37483#issuecomment-1701842381

   Hi @kou 
   
   @kevingurney and I spent some more time investigating this failure. Here's 
what we found:
   
   1. If you run the `ldd` command on the `placeholder_test` executable (with 
these changes), the names of the `gtest` and `gtest_main` libraries are 
specified as relative paths, while other library names are specified as 
absolute paths:
   
   ```shell
   >> ldd placeholder_test
   placeholder_test:
        libarrow_gtest.1.11.0.dylib (compatibility version 0.0.0, current 
version 1.11.0)
        libarrow_gtest_main.1.11.0.dylib (compatibility version 0.0.0, current 
version 1.11.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 
1300.36.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1319.0.0)
   ```
   2. However, if you run `ldd` on the `placeholder_test` executable built 
prior to these changes, the names for `gtest` and `gtest_main` are specified as 
absolute paths:
   
   ```shell
   >> ldd placeholder_test
   placeholder_test:
        
</path/to/repo>/arrow/matlab/build/arrow_ep-build/googletest_ep-prefix/lib/libgtest.1.11.0.dylib
 (compatibility version 0.0.0, current version 1.11.0)
        
</path/to/repo>/arrow/matlab/build/arrow_ep-build/googletest_ep-prefix/lib/libgtest_main.1.11.0.dylib
 (compatibility version 0.0.0, current version 1.11.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 
1300.36.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1319.0.0)
   ```
   
   **Note:** I replaced some personal information with `</path/to/repo>`.
   
   3. We were able to run the `placeholder_test` executable successfully if we 
made the changes below:
   
      - Specify the `MACOSX_RPATH` property to `TRUE` for both targets `gtest` 
and `gtest_main` in `arrow/cpp/cmake_modules/ThirdartyToolchain.cmake`.
      - Specify the `BUILD_RPATH` property to 
`"${CMAKE_CURRENT_BINARY_DIR}/arrow_ep-prefix/lib"` for target 
`placeholder_test` in `arrow/matlab/CMakeLists.txt`.
   
   With those changes, the executable runs as expected:
   
   ```shell
   Internal ctest changing into directory: <path/to/repo>/arrow/matlab/build
   Test project <path/to/repo>/arrow/matlab/build
       Start 1: PlaceholderTestTarget
   1/1 Test #1: PlaceholderTestTarget ............   Passed    0.01 sec
   
   100% tests passed, 0 tests failed out of 1
   
   Total Test time (real) =   0.03 sec
   ```
     
   4.  For reference, here's the output of `ldd placeholder` with these changes 
applied:
   
   ```shell
   placeholder_test:
        @rpath/libarrow_gtest.1.11.0.dylib (compatibility version 0.0.0, 
current version 1.11.0)
        @rpath/libarrow_gtest_main.1.11.0.dylib (compatibility version 0.0.0, 
current version 1.11.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 
1300.36.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1319.0.0)
   ```
   
   I'm not sure if this solution is the right one, but wanted to share with you 
what we found.
   
   Best,
   Sarah 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to