diff --git a/c_glib/README.md b/c_glib/README.md index d571053c3dce8..2a4d6b8a6628c 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 33e9fbf85d026..c7bc6edca5f0d 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 "$@"