Skip to content

Commit

Permalink
apacheGH-39427: [GLib] Update script and documentation (apache#39428)
Browse files Browse the repository at this point in the history
### 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: apache#39427

Lead-authored-by: Hyunseok Seo <hsseo0501@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
2 people authored and dgreiss committed Feb 17, 2024
1 parent d2c4948 commit b93212e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
22 changes: 21 additions & 1 deletion c_glib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions c_glib/test/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 "$@"

0 comments on commit b93212e

Please sign in to comment.