Skip to content

Conversation

@Watson1978
Copy link
Contributor

This PR will fix CI failures and improve Ruby 3.3 support.

  1. Remove bundler installation
  • It installs bundler without specifying the version in CI. But, it installs bundler which does not work with old Ruby, and it causes failure. So, this patch remove bundler installation and uses bundler bundled in Ruby.
  1. Fix failure with Ruby 3.3
  • The method of getting pointers from TypedData structure has changed since Ruby 3.3. This PR follows that.

Fix following warning message in CI:

```
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
```

Because the CI will eventually stop working.
It installs bundler without specifying the version in CI.
But, it installs bundler which does not work with old Ruby, and it causes failure.

So, this patch remove bundler installation and uses bundler bundled in Ruby.
The method of getting pointers from TypedData structure has changed since Ruby 3.3.

Ruby 3.2 or below can get the pointer with DATA_PTR().
https://github.com/ruby/ruby/blob/52bb2ac0a6971d0391efa2275f7a66bff319087c/error.c#L1073

Ruby 3.3 or later uses RTYPEDDATA_GET_DATA() to get pointer.
https://github.com/ruby/ruby/blob/5124f9ac7513eb590c37717337c430cb93caa151/error.c#L1326
uwabami added a commit to uwabami/numo-narray that referenced this pull request Jan 7, 2025
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
@madhums
Copy link

madhums commented May 23, 2025

Can we merge this @masa16 ?

@masa16 masa16 merged commit 7e42919 into ruby-numo:master May 24, 2025
@Watson1978 Watson1978 deleted the fix-ci-failure branch May 24, 2025 14:57
@madhums
Copy link

madhums commented May 24, 2025

Thank you so much! Can you also publish a new release to rubygems?

@madhums
Copy link

madhums commented May 24, 2025

With ruby 3.3.8 I still get this error while installing

gem specific_install https://github.com/ruby-numo/numo-narray.git
git version 2.49.0
git installing from https://github.com/ruby-numo/numo-narray.git
Cloning into '/tmp/d20250524-668670-a7zyw'...
remote: Enumerating objects: 7878, done.
remote: Counting objects: 100% (101/101), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 7878 (delta 81), reused 68 (delta 68), pack-reused 7777 (from 3)
Receiving objects: 100% (7878/7878), 3.12 MiB | 3.69 MiB/s, done.
Resolving deltas: 100% (5058/5058), done.
WARNING:  open-ended dependency on rake (>= 12.3.3, development) is not recommended
  if rake is semantically versioned, use:
    add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
WARNING:  open-ended dependency on test-unit (>= 0, development) is not recommended
  use a bounded requirement, such as "~> x.y"
WARNING:  See https://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: numo-narray
  Version: 0.9.2.1
  File: numo-narray-0.9.2.1.gem
Building native extensions. This could take a while...
ERROR:  While executing gem ... (Gem::Ext::BuildError)
    ERROR: Failed to build gem native extension.

    current directory: /home/madhu/.rbenv/versions/3.3.8/lib/ruby/gems/3.3.0/gems/numo-narray-0.9.2.1/ext/numo/narray
/home/madhu/.rbenv/versions/3.3.8/bin/ruby extconf.rb
checking for stdbool.h... yes
checking for stdint.h... yes
checking for bool in stdbool.h... yes
checking for u_int8_t in stdint.h... yes
checking for u_int16_t in stdint.h... yes
checking for int32_t in stdint.h... yes
checking for u_int32_t in stdint.h... yes
checking for int64_t in stdint.h... yes
checking for u_int64_t in stdint.h... yes
checking for exp10()... yes
checking for rb_arithmetic_sequence_extract()... yes
checking for RTYPEDDATA_GET_DATA()... yes
checking for rb_cComplex... yes
creating /home/madhu/.rbenv/versions/3.3.8/lib/ruby/gems/3.3.0/gems/numo-narray-0.9.2.1/ext/numo/narray/numo/extconf.h
creating Makefile

current directory: /home/madhu/.rbenv/versions/3.3.8/lib/ruby/gems/3.3.0/gems/numo-narray-0.9.2.1/ext/numo/narray
make DESTDIR\= sitearchdir\=./.gem.20250524-668670-a7i4d7 sitelibdir\=./.gem.20250524-668670-a7i4d7 clean

current directory: /home/madhu/.rbenv/versions/3.3.8/lib/ruby/gems/3.3.0/gems/numo-narray-0.9.2.1/ext/numo/narray
make DESTDIR\= sitearchdir\=./.gem.20250524-668670-a7i4d7 sitelibdir\=./.gem.20250524-668670-a7i4d7
compiling narray.c
compiling array.c
compiling step.c
compiling index.c
compiling ndloop.c
ndloop.c: In function ‘ndloop_alloc’:
ndloop.c:359:19: error: assignment to ‘void (*)(void)’ from incompatible pointer type ‘void (*)(ndfunc_t *, na_md_loop_t *)’ {aka ‘void (*)(struct NDFUNCTION *, struct NA_MD_LOOP *)’} [-Wincompatible-pointer-types]
  359 |     lp->loop_func = loop_func;
      |                   ^
ndloop.c: In function ‘ndloop_run’:
ndloop.c:1275:23: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
 1275 |     if (lp->loop_func == loop_narray) {
      |                       ^~
ndloop.c:1287:23: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
 1287 |     if (lp->loop_func == loop_narray) {
      |                       ^~
ndloop.c:1297:6: error: too many arguments to function ‘lp->loop_func’; expected 0, have 2
 1297 |     (*(lp->loop_func))(nf, lp);
      |     ~^~~~~~~~~~~~~~~~~ ~~
ndloop.c:59:12: note: declared here
   59 |     void (*loop_func)();
      |            ^~~~~~~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make: *** [Makefile:345: ndloop.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/madhu/.rbenv/versions/3.3.8/lib/ruby/gems/3.3.0/gems/numo-narray-0.9.2.1 for inspection.
Results logged to /home/madhu/.rbenv/versions/3.3.8/lib/ruby/gems/3.3.0/extensions/x86_64-linux/3.3.0/numo-narray-0.9.2.1/gem_make.out
	/home/madhu/.rbenv/versions/3.3.8/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
	/home/madhu/.rbenv/versions/3.3.8/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in make'
	/home/madhu/.rbenv/versions/3.3.8/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:43:in `each'
	/home/madhu/.rbenv/versions/3.3.8/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:43:in `make'
	/home/madhu/.rbenv/versions/3.3.8/lib/ruby/site_ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:44:in `build'
	/home/madhu/.rbenv/versions/3.3.8/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:206:in `build_extension'

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.

3 participants