Skip to content

Make Dev Container build successful#306

Merged
kou merged 6 commits into
red-data-tools:mainfrom
tikkss:fix-build-devcontainer
May 15, 2025
Merged

Make Dev Container build successful#306
kou merged 6 commits into
red-data-tools:mainfrom
tikkss:fix-build-devcontainer

Conversation

@tikkss
Copy link
Copy Markdown
Contributor

@tikkss tikkss commented Apr 28, 2025

This PR will fix the build container / build failure:

[2025-04-27T00:43:57.085Z] ERROR: Jupyter kernel 'ruby' not found. Known kernels: python3. Run 'quarto check jupyter' with your python environment activated to check python version used.

tikkss added 2 commits April 29, 2025 07:56
Because `jupyter` not found on Dockerfile.
Unable to `quarto convert` because the kernel name `ruby3` not `ruby`:

```console
$ rake jupyter
quarto convert doc/qmd/preprocess_knock_Ruby-RedAmber.qmd -o
doc/notebook/preprocess_knock_Ruby-RedAmber.ipynb
ERROR: Jupyter kernel 'ruby' not found. Known kernels: python3, ruby3.
Run 'quarto check jupyter' with your python environment activated to
check python version used.
```

Since SciRuby/iruby#317, IRuby's default kernel name has been changed to
`ruby3` from `ruby`. However, we keep using `ruby` to respect Ruby's
strong compatibility.

Alternatively, we can modify the jupyter engine setting in qmd files
from `ruby` to `ruby3`:

```yaml
jupyter: ruby3
```

However, this approach requires updating all qmd files whenever Ruby's
major version changes. We don't want to pay that maintenance cost.
@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented Apr 29, 2025

Oh... unable to bundle exec rake test in build container / build with segmentation fault:

About to run devcontainer exec --workspace-folder /home/runner/work/red_amber/red_amber --remote-env GITHUB_OUTPUT=/mnt/github/output --remote-env GITHUB_ENV=/mnt/github/env --remote-env GITHUB_PATH=/mnt/github/path --remote-env GITHUB_STEP_SUMMARY=/mnt/github/step-summary bash -c bundle exec rake test
Loaded suite /home/vscode/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rake-13.2.1/lib/rake/rake_test_loader

Started
/home/vscode/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/gobject-introspection-4.2.9/lib/gobject-introspection/loader.rb:715: [BUG] Segmentation fault at 0x0000000000000000
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]

On my macOS, bundle exec rake test is success:

$ bundle exec rake test
Loaded suite /home/vscode/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rake-13.2.1/lib/rake/rake_test_loader
Started
Finished in 20.632629204 seconds.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
873 tests, 2183 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
42.31 tests/s, 105.80 assertions/s
Coverage report generated for Unit Tests to /workspaces/red_amber/coverage.
Line Coverage: 100.0% (5638 / 5638)
Coverage report generated for Unit Tests to /workspaces/red_amber/coverage/coverage.json. 5638 / 5638 LOC (100.0%) covered.

Let me investigate.

@kou
Copy link
Copy Markdown
Member

kou commented Apr 29, 2025

https://github.com/red-data-tools/red_amber/actions/runs/14719954619/job/41311682989?pr=306#step:4:34656

/lib/x86_64-linux-gnu/libarrow-glib.so.2000(_Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x10) [0x7f96d29aa320]

We can get the source line from this. See also: https://www.clear-code.com/blog/2024/12/25/addr2line-and-separated-debug-information.html

We can use libarrow2000-dbgsym for it. See also https://arrow.apache.org/install/ how to install libarrow2000-dbgsym.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented Apr 29, 2025

Great Post! I would like to investigate it.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented Apr 30, 2025

We can install libarrow2000-dbgsym in debian:bookworm.
But we cannot install libarrow2000-dbgsym in ubuntu:noble.

Steps to reproduce (debian:bookworm)

We can use addr2line but addr2line's result is ??:0.
Is this because the OSs are different? (GitHub Actions is running on Ubuntu 24.04 (noble))

FROM debian:bookworm
  
RUN apt-get update && \
    apt-get install -y -V ca-certificates lsb-release wget
  
RUN wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get update

RUN apt-get install -y libarrow2000-dbgsym

# To use readelf
RUN apt-get install -y binutils
$ docker build -t arrow-dbgsym-bookworm .
$ docker run --rm -it arrow-dbgsym-bookworm bash
root@2f665328cbd9:/# readelf --notes /usr/lib/x86_64-linux-gnu/libarrow.so.2000

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 10799a3aa97dd9625614cb8aaee714127366210f
root@2f665328cbd9:/# addr2line --exe=/usr/lib/debug/.build-id/10/799a3aa97dd9625614cb8aaee714127366210f.debug +0x10
??:0

Steps to reproduce (ubuntu:noble)

Occurred Unable to locate package libarrow2000-dbgsym error.
Is there an additional step required to install dbgsym packages on ubuntu:noble?

FROM ubuntu:noble
  
RUN apt-get update && \
    apt-get install -y -V ca-certificates lsb-release wget
  
RUN wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get update

RUN apt-get install -y libarrow2000-dbgsym

# To use readelf
RUN apt-get install -y binutils
$ docker build -t arrow-dbgsym-noble .
[+] Building 24.9s (7/8)                                                                                                                  docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                      0.0s
 => => transferring dockerfile: 573B                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/ubuntu:noble                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                           0.0s
 => CACHED [1/5] FROM docker.io/library/ubuntu:noble                                                                                                      0.0s
 => [2/5] RUN apt-get update &&     apt-get install -y -V ca-certificates lsb-release wget                                                               13.1s
 => [3/5] RUN wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_rele  10.1s
 => ERROR [4/5] RUN apt-get install -y libarrow2000-dbgsym                                                                                                1.6s
------
 > [4/5] RUN apt-get install -y libarrow2000-dbgsym:
0.190 Reading package lists...
1.347 Building dependency tree...
1.547 Reading state information...
1.575 E: Unable to locate package libarrow2000-dbgsym
------
Dockerfile:10
--------------------
   8 |         apt-get update
   9 |
  10 | >>> RUN apt-get install -y libarrow2000-dbgsym
  11 |
  12 |     # To use readelf
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y libarrow2000-dbgsym" did not complete successfully: exit code: 100

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/ubyck92ubstfd7rs7zoh49ecq

@kou
Copy link
Copy Markdown
Member

kou commented May 1, 2025

Ah, libarrow2000-dbgsym doesn't exist in APT repository metadata for noble: https://apache.jfrog.io/artifactory/arrow/ubuntu/dists/noble/main/binary-amd64/Packages

Could you open it in apache/arrow?

Could you install it directly for now?

wget https://packages.apache.org/artifactory/arrow/ubuntu/pool/noble/main/a/apache-arrow/libarrow2000-dbgsym_20.0.0-1_amd64.ddeb
apt install -y ./libarrow2000-dbgsym_20.0.0-1_amd64.ddeb

libarrowXXXX and libarrowXXXX-dbgsym are tightly associated. We can't mix other pairs. For example, we can't mix noble's libarrowXXXX and bookworm's libarrowXXXX-dbgsym.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 1, 2025

Thanks for your polite advise!

Could you open it in apache/arrow?

Sure!

Could you install it directly for now?

Yes, we can install it directly. But addr2line's result is ??:0.
We use noble's libarrowXXXX and noble's libarrowXXXX-dbgsym pairs. But why addr2line's result is ??:0?

Steps to reproduce:

FROM ubuntu:noble
  
RUN apt-get update && \
    apt-get install -y -V ca-certificates lsb-release wget
  
RUN wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get update

RUN wget https://packages.apache.org/artifactory/arrow/ubuntu/pool/noble/main/a/apache-arrow/libarrow2000-dbgsym_20.0.0-1_amd64.ddeb && \
    apt-get install -y ./libarrow2000-dbgsym_20.0.0-1_amd64.ddeb

# To use readelf
RUN apt-get install -y binutils
$ docker build -t arrow-dbgsym-noble .
$ docker run --rm -it arrow-dbgsym-noble bash
root@2e4db0036917:/# readelf --notes /usr/lib/x86_64-linux-gnu/libarrow.so.2000

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: ebdc8688b2d2c59f4a5aabbcc170deb844dbf936
root@2e4db0036917:/# addr2line --exe=/usr/lib/debug/.build-id/eb/dc8688b2d2c59f4a5aabbcc170deb844dbf936.debug +0x10
??:0

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 1, 2025

I reported in apache/arrow#46284.

@kou
Copy link
Copy Markdown
Member

kou commented May 1, 2025

Could you try addr2line --exe=/usr/lib/debug/.build-id/eb/dc8688b2d2c59f4a5aabbcc170deb844dbf936.debug _Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x10 instead?

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 2, 2025

I tried it. But addr2line's result is ??:0 yet.

$ docker run --rm -it arrow-dbgsym-noble bash
root@a23ed7fc5466:/# readelf --notes /usr/lib/x86_64-linux-gnu/libarrow.so.2000

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: ebdc8688b2d2c59f4a5aabbcc170deb844dbf936
root@a23ed7fc5466:/# addr2line --exe=/usr/lib/debug/.build-id/eb/dc8688b2d2c59f4a5aabbcc170deb844dbf936.debug _Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x10
??:0

I also tried libarrow-glib2000-dbgsym. Because the following segmentation fault includes libarrow-glib.so.2000.
But addr2line's result is ??:?.

/lib/x86_64-linux-gnu/libarrow-glib.so.2000(_Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x10) [0x7f96d29aa320]
root@a23ed7fc5466:/# wget https://packages.apache.org/artifactory/arrow/ubuntu/pool/noble/main/a/apache-arrow/libarrow-glib2000-dbgsym_20.0.0-1_amd64.ddeb
(snip)
root@a23ed7fc5466:/# apt install -y -V ./libarrow-glib2000-dbgsym_20.0.0-1_amd64.ddeb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libarrow-glib2000-dbgsym' instead of './libarrow-glib2000-dbgsym_20.0.0-1_amd64.ddeb'
The following additional packages will be installed:
   libarrow-acero2000 (20.0.0-1)
   libarrow-glib2000 (20.0.0-1)
   libglib2.0-0t64 (2.80.0-6ubuntu3.2)
   libglib2.0-data (2.80.0-6ubuntu3.2)
   shared-mime-info (2.4-4)
   xdg-user-dirs (0.18-1build1)
Suggested packages:
   low-memory-monitor (2.1-2build2)
The following NEW packages will be installed:
   libarrow-acero2000 (20.0.0-1)
   libarrow-glib2000 (20.0.0-1)
   libarrow-glib2000-dbgsym (20.0.0-1)
   libglib2.0-0t64 (2.80.0-6ubuntu3.2)
   libglib2.0-data (2.80.0-6ubuntu3.2)
   shared-mime-info (2.4-4)
   xdg-user-dirs (0.18-1build1)
0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
Need to get 2881 kB/9078 kB of archives.
After this operation, 17.1 MB of additional disk space will be used.
Get:1 /libarrow-glib2000-dbgsym_20.0.0-1_amd64.ddeb libarrow-glib2000-dbgsym amd64 20.0.0-1 [6198 kB]
Get:4 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 libglib2.0-0t64 amd64 2.80.0-6ubuntu3.2 [1546 kB]
Get:2 https://packages.apache.org/artifactory/arrow/ubuntu noble/main amd64 libarrow-acero2000 amd64 20.0.0-1 [451 kB]
Get:3 https://packages.apache.org/artifactory/arrow/ubuntu noble/main amd64 libarrow-glib2000 amd64 20.0.0-1 [343 kB]
Get:5 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 libglib2.0-data all 2.80.0-6ubuntu3.2 [48.5 kB]
Get:6 http://archive.ubuntu.com/ubuntu noble/main amd64 shared-mime-info amd64 2.4-4 [474 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble/main amd64 xdg-user-dirs amd64 0.18-1build1 [18.4 kB]
Fetched 2881 kB in 5s (565 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libglib2.0-0t64:amd64.
(Reading database ... 5765 files and directories currently installed.)
Preparing to unpack .../0-libglib2.0-0t64_2.80.0-6ubuntu3.2_amd64.deb ...
Unpacking libglib2.0-0t64:amd64 (2.80.0-6ubuntu3.2) ...
Selecting previously unselected package libglib2.0-data.
Preparing to unpack .../1-libglib2.0-data_2.80.0-6ubuntu3.2_all.deb ...
Unpacking libglib2.0-data (2.80.0-6ubuntu3.2) ...
Selecting previously unselected package shared-mime-info.
Preparing to unpack .../2-shared-mime-info_2.4-4_amd64.deb ...
Unpacking shared-mime-info (2.4-4) ...
Selecting previously unselected package xdg-user-dirs.
Preparing to unpack .../3-xdg-user-dirs_0.18-1build1_amd64.deb ...
Unpacking xdg-user-dirs (0.18-1build1) ...
Selecting previously unselected package libarrow-acero2000:amd64.
Preparing to unpack .../4-libarrow-acero2000_20.0.0-1_amd64.deb ...
Unpacking libarrow-acero2000:amd64 (20.0.0-1) ...
Selecting previously unselected package libarrow-glib2000:amd64.
Preparing to unpack .../5-libarrow-glib2000_20.0.0-1_amd64.deb ...
Unpacking libarrow-glib2000:amd64 (20.0.0-1) ...
Selecting previously unselected package libarrow-glib2000-dbgsym:amd64.
Preparing to unpack .../6-libarrow-glib2000-dbgsym_20.0.0-1_amd64.ddeb.deb ...
Unpacking libarrow-glib2000-dbgsym:amd64 (20.0.0-1) ...
Setting up libarrow-acero2000:amd64 (20.0.0-1) ...
Setting up xdg-user-dirs (0.18-1build1) ...
Setting up libglib2.0-0t64:amd64 (2.80.0-6ubuntu3.2) ...
No schema files found: doing nothing.
Setting up libglib2.0-data (2.80.0-6ubuntu3.2) ...
Setting up shared-mime-info (2.4-4) ...
Setting up libarrow-glib2000:amd64 (20.0.0-1) ...
Setting up libarrow-glib2000-dbgsym:amd64 (20.0.0-1) ...
Processing triggers for libc-bin (2.39-0ubuntu8.4) ...
root@a23ed7fc5466:/#
root@a23ed7fc5466:/# readelf --notes /usr/lib/x86_64-linux-gnu/libarrow-glib.so.2000

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_PROPERTY_TYPE_0
      Properties: x86 feature: IBT, SHSTK

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 793ff56e8d52369e4e6ade6031ce9d3e5ee49e18
root@a23ed7fc5466:/# addr2line --exe=/usr/lib/debug/.build-id/79/3ff56e8d52369e4e6ade6031ce9d3e5ee49e18.debug _Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x10
??:?

@kou
Copy link
Copy Markdown
Member

kou commented May 2, 2025

I also tried it and it didn't work...

BTW, how about using Ubuntu 24.04 instead 22.04?

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 04ae0f1..38057e6 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,5 +1,4 @@
-# [Choice] debian-11, debian-10, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
-ARG VARIANT=ubuntu-22.04
+ARG VARIANT=ubuntu-24.04
 
 FROM mcr.microsoft.com/devcontainers/base:${VARIANT}
 

@kou
Copy link
Copy Markdown
Member

kou commented May 2, 2025

I can reproduce this by ruby -r arrow -e 'Arrow::Function.find(:rank).default_options' on Ubuntu 24.04.

@kou
Copy link
Copy Markdown
Member

kou commented May 2, 2025

This returns nullptr:

// g++ -g3 -O0 a.cc $(pkgconf --cflags --libs arrow) && ./a.out
#include <stdio.h>
#include <arrow/compute/api.h>

int
main(void)
{
	auto func = *(arrow::compute::GetFunctionRegistry()->GetFunction("rank"));
	printf("%p\n", func->default_options()->options_type());
	return 0;
}

It seems that the Apache Arrow C++ package for Ubuntu has a problem.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 3, 2025

Thanks for your investigate!

I can also reproduce this by ruby -r arrow -e 'Arrow::Function.find(:rank).default_options' on Ubuntu 24.04.
Could I open it in apache/arrow?

BTW, how about using Ubuntu 24.04 instead 22.04?

OK. I committed the following improvements:

  • Use Ubuntu 24.04 instead of 22.04
  • Use Apache Arrow latest (20.0.0)
  • Delegate Apache Arrow installation to rubygems-requirements-system
  • Relax red-arrow and red-parquet version to >= instead of ~>

@kou
Copy link
Copy Markdown
Member

kou commented May 3, 2025

Could I open it in apache/arrow?

Yes, please.

Note that this is a C++ related problem not GLib nor Ruby because #306 (comment) reproduces this.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 3, 2025

The following line has changed slightly, but the addr2line result is still ??:0.

https://github.com/red-data-tools/red_amber/actions/runs/14805234539/job/41572265425?pr=306#step:4:35153

/lib/x86_64-linux-gnu/libarrow-glib.so.2000(_Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x18) [0x7f789c15fa58]
-_Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x10
+_Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x18
$ docker run --rm -it arrow-dbgsym-noble bash
root@b6151ebccc55:/# readelf --notes /usr/lib/x86_64-linux-gnu/libarrow.so.2000

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: ebdc8688b2d2c59f4a5aabbcc170deb844dbf936
root@b6151ebccc55:/# addr2line --exe=/usr/lib/debug/.build-id/eb/dc8688b2d2c59f4a5aabbcc170deb844dbf936.debug _Z31garrow_function_options_new_rawPKN5arrow7compute15FunctionOptionsE+0x18
??:0

@kou
Copy link
Copy Markdown
Member

kou commented May 3, 2025

.debug may not have enough information for addr2line because it uses release build not relwithdebinfo (release with debug information): https://github.com/apache/arrow/blob/81bb98853c5c84132dc1ae9cd1be8507bdd0800a/dev/tasks/linux-packages/apache-arrow/debian/rules#L11

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 3, 2025

Could I open it in apache/arrow?

Yes, please.

Note that this is a C++ related problem not GLib nor Ruby because #306 (comment) reproduces this.

I reported in apache/arrow#46299.

.debug may not have enough information for addr2line because it uses release build not relwithdebinfo (release with debug information): https://github.com/apache/arrow/blob/81bb98853c5c84132dc1ae9cd1be8507bdd0800a/dev/tasks/linux-packages/apache-arrow/debian/rules#L11

Thanks for your investigate. Should we open it in apache/arrow? If yes, Could I open it in apache/arrow?

@kou
Copy link
Copy Markdown
Member

kou commented May 3, 2025

Yes, please.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 3, 2025

I reported in apache/arrow#46304.

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 13, 2025

Thanks for your work in apache/arrow. All reported issues have been resolved. It seems that this segmentation fault will be resolved in the Apache Arrow 21.0.0 release.

@kou
Copy link
Copy Markdown
Member

kou commented May 14, 2025

Are there any remaining issues before we merge this?

@tikkss
Copy link
Copy Markdown
Contributor Author

tikkss commented May 14, 2025

No, there are no remaining issues.

@kou kou merged commit 15fc3e5 into red-data-tools:main May 15, 2025
4 of 10 checks passed
@tikkss tikkss deleted the fix-build-devcontainer branch May 15, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants