This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 04afe3f017 GH-39427: [GLib] Update script and documentation (#39428)
04afe3f017 is described below

commit 04afe3f017668d7fbd74301717ce467394e216d7
Author: Hyunseok Seo <[email protected]>
AuthorDate: Thu Jan 11 22:50:56 2024 +0900

    GH-39427: [GLib] Update script and documentation (#39428)
    
    
    
    ### Rationale for this change
    
    Modify scripts and update documentation for building GLib and running test 
code in a Mac environment.
    
    ### What changes are included in this PR?
    
    * Update Documentation (`c_glib/README.md`)
    * Update Script (`c_glib/test/run-test.sh`)
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    Yes.
    
    * Closes: #39427
    
    Lead-authored-by: Hyunseok Seo <[email protected]>
    Co-authored-by: Sutou Kouhei <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 c_glib/README.md        | 22 +++++++++++++++++++++-
 c_glib/test/run-test.sh | 23 +++++++++++++++++++----
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/c_glib/README.md b/c_glib/README.md
index d571053c3d..2a4d6b8a66 100644
--- a/c_glib/README.md
+++ b/c_glib/README.md
@@ -142,6 +142,17 @@ $ meson compile -C c_glib.build
 $ sudo meson install -C c_glib.build
 ```
 
+> [!WARNING]
+>
+> When building Arrow GLib, it typically uses the Arrow C++ installed via 
Homebrew. However, this can lead to build failures
+> if there are mismatches between the changes in Arrow's GLib and C++ 
libraries. To resolve this, you may need to
+> reference the Arrow C++ library built locally. In such cases, use the 
`--cmake-prefix-path` option with the `meson setup` 
+> command to explicitly specify the library path.
+>
+> ```console
+> $ meson setup c_glib.build c_glib 
--cmake-prefix-path=${arrow_cpp_install_prefix} -Dgtk_doc=true
+> ```
+
 Others:
 
 ```console
@@ -231,9 +242,18 @@ Now, you can run unit tests by the followings:
 
 ```console
 $ cd c_glib.build
-$ bundle exec ../c_glib/test/run-test.sh
+$ BUNDLE_GEMFILE=../c_glib/Gemfile bundle exec ../c_glib/test/run-test.sh
 ```
 
+
+> [!NOTE]
+>
+> If debugging is necessary, you can proceed using the `DEBUGGER` option as 
follows:
+>
+> ```console
+> $ DEBUGGER=lldb BUNDLE_GEMFILE=../c_glib/Gemfile bundle exec 
../c_glib/test/run-test.sh
+> ```
+
 ## Common build problems
 
 ### build failed - /usr/bin/ld: cannot find -larrow
diff --git a/c_glib/test/run-test.sh b/c_glib/test/run-test.sh
index 33e9fbf85d..c7bc6edca5 100755
--- a/c_glib/test/run-test.sh
+++ b/c_glib/test/run-test.sh
@@ -34,14 +34,14 @@ for module in "${modules[@]}"; do
   module_build_dir="${build_dir}/${module}"
   if [ -d "${module_build_dir}" ]; then
     LD_LIBRARY_PATH="${module_build_dir}:${LD_LIBRARY_PATH}"
+    DYLD_LIBRARY_PATH="${module_build_dir}:${DYLD_LIBRARY_PATH}"
   fi
 done
 export LD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH
 
 if [ "${BUILD}" != "no" ]; then
-  if [ -f "Makefile" ]; then
-    make -j8 > /dev/null || exit $?
-  elif [ -f "build.ninja" ]; then
+  if [ -f "build.ninja" ]; then
     ninja || exit $?
   fi
 fi
@@ -59,4 +59,19 @@ for module in "${modules[@]}"; do
 done
 export GI_TYPELIB_PATH
 
-${GDB} ruby ${test_dir}/run-test.rb "$@"
+if type rbenv > /dev/null 2>&1; then
+  RUBY="$(rbenv which ruby)"
+else
+  RUBY=ruby
+fi
+DEBUGGER_ARGS=()
+case "${DEBUGGER}" in
+  "gdb")
+    DEBUGGER_ARGS+=(--args)
+    ;;
+  "lldb")
+    DEBUGGER_ARGS+=(--one-line "env DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}")
+    DEBUGGER_ARGS+=(--)
+    ;;
+esac
+${DEBUGGER} "${DEBUGGER_ARGS[@]}" "${RUBY}" ${test_dir}/run-test.rb "$@"

Reply via email to