4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

世界に一台のNetBSD 10.1_STABLE/comcerto 1000でmruby 3.4をビルドしてみます。

まずrootでrubyを入れます。

c1k# pkg_add -f ruby
pkg_add: Warning: package `ruby-3.4.5' was built for a platform:
pkg_add: NetBSD/earmv4 10.0 (pkg) vs. NetBSD/earmv5 10.1_STABLE (this host)
pkg_add: Warning: package `ruby34-3.4.5' was built for a platform:
pkg_add: NetBSD/earmv4 10.0 (pkg) vs. NetBSD/earmv5 10.1_STABLE (this host)
pkg_add: Warning: package `libyaml-0.2.5' was built for a platform:
pkg_add: NetBSD/earmv4 10.0 (pkg) vs. NetBSD/earmv5 10.1_STABLE (this host)

comcerto 1000はarm v6なのですがnon-hardfloatなのでv4のpkgを利用しています。

mrubyを取得します。

c1k: {6} ftp https://github.com/mruby/mruby/archive/refs/tags/3.4.0.tar.gz
Requesting https://github.com/mruby/mruby/archive/refs/tags/3.4.0.tar.gz
Redirected to https://codeload.github.com/mruby/mruby/tar.gz/refs/tags/3.4.0
Requesting https://codeload.github.com/mruby/mruby/tar.gz/refs/tags/3.4.0
   823 KiB    1.20 MiB/s 
843682 bytes retrieved in 00:00 (1.20 MiB/s)
c1k: {7} tar -zxf 3.4.0.tar.gz 

makeしてみます。

c1k: {8} cd mruby-3.4.0/
c1k: {9} make
make: "/home/hiroki/mruby-3.4.0/Makefile" line 7: Invalid line type
make: "/home/hiroki/mruby-3.4.0/Makefile" line 12: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in /home/hiroki/mruby-3.4.0

あら残念。rakeを直接実行するのが正解のようです。

c1k: {10} rake
CPP   src/allocf.c -> build/host/src/allocf.pi
CPP   src/array.c -> build/host/src/array.pi
CPP   src/backtrace.c -> build/host/src/backtrace.pi
CPP   src/cdump.c -> build/host/src/cdump.pi
CPP   src/class.c -> build/host/src/class.pi
...
Build summary:

================================================
      Config Name: host
 Output Directory: build/host
         Binaries: mrbc, mruby-config
    Included Gems:
             mruby-array-ext - Array class extension
             mruby-bigint - Integer class extension to multiple-precision
             mruby-bin-config - mruby-config command
             mruby-bin-debugger - mruby debugger command
               - Binaries: mrdb
             mruby-bin-mirb - mirb command
               - Binaries: mirb
             mruby-bin-mrbc - mruby compiler executable
             mruby-bin-mruby - mruby command
               - Binaries: mruby
             mruby-bin-strip - irep dump debug section remover command
               - Binaries: mruby-strip
             mruby-binding - Binding class (core features only)
             mruby-class-ext - class/module extension
             mruby-cmath - standard Math module with complex
             mruby-compar-ext - Comparable module extension
             mruby-compiler - mruby compiler library
             mruby-complex - Complex class
             mruby-data - standard Data class
             mruby-dir
             mruby-enum-ext - Enumerable module extension
             mruby-enum-lazy - Enumerator::Lazy class
             mruby-enumerator - Enumerator class
             mruby-errno - Errno module and SystemCallError class
             mruby-error - extensional error handling
             mruby-eval - standard Kernel#eval method
             mruby-fiber - Fiber class
             mruby-hash-ext - Hash class extension
             mruby-io - IO and File class
             mruby-kernel-ext - extensional function-like methods
             mruby-math - standard Math module
             mruby-metaprog - Meta-programming features for mruby
             mruby-method - Method and UnboundMethod class
             mruby-numeric-ext - Numeric class extension
             mruby-object-ext - extensional methods shared by all objects
             mruby-objectspace - ObjectSpace class
             mruby-pack - Array#pack and String#unpack method
             mruby-proc-ext - Proc class extension
             mruby-random - Random class
             mruby-range-ext - Range class extension
             mruby-rational - Rational class
             mruby-set
             mruby-socket - standard socket class
             mruby-sprintf - standard Kernel#sprintf method
             mruby-string-ext - String class extension
             mruby-struct - standard Struct class
             mruby-symbol-ext - Symbol class extension
             mruby-time - standard Time class
             mruby-toplevel-ext - toplevel object (main) methods extension
================================================

================================================
      Config Name: host/mrbc
 Output Directory: build/host/mrbc
         Binaries: mrbc
    Included Gems:
             mruby-bin-mrbc - mruby compiler executable
             mruby-compiler - mruby compiler library
================================================

一時間以上かかりました。

c1k: {11} ./build/host/bin/mruby -v
mruby 3.4.0 (2025-04-20)

おまけ

rubocopもインストールしてみました。

c1k# gem install rubocop
Fetching rubocop-ast-1.48.0.gem
Fetching prism-1.6.0.gem
Fetching unicode-emoji-4.1.0.gem
Fetching ast-2.4.3.gem
Fetching ruby-progressbar-1.13.0.gem
Fetching unicode-display_width-3.2.0.gem
Fetching parser-3.3.10.0.gem
Fetching regexp_parser-2.11.3.gem
Fetching rubocop-1.81.7.gem
Fetching rainbow-3.1.1.gem
Fetching parallel-1.27.0.gem
Fetching lint_roller-1.1.0.gem
Fetching language_server-protocol-3.17.0.5.gem
Successfully installed unicode-emoji-4.1.0
Successfully installed unicode-display_width-3.2.0
Successfully installed ruby-progressbar-1.13.0
Building native extensions. This could take a while...
Successfully installed prism-1.6.0
Successfully installed ast-2.4.3
Successfully installed parser-3.3.10.0
Successfully installed rubocop-ast-1.48.0
Successfully installed regexp_parser-2.11.3
Successfully installed rainbow-3.1.1
Successfully installed parallel-1.27.0
Successfully installed lint_roller-1.1.0
Successfully installed language_server-protocol-3.17.0.5
Successfully installed rubocop-1.81.7
13 gems installed

rubocopはarm v6には重いようです。

mrbの作成

以下のようなMakefileでコンパイルしています。

all:    ft1.mrb

clean:
        rm -f *.mrb

.SUFFIXES: .mrb .rb

.rb.mrb:
        mrbc -o${.TARGET} ${.ALLSRC}
        cp ${.TARGET} /tftpboot/

ft1.mrb:        ws2812.rb ft1.rb

出来上がったmrbをtftpで拾えるようにコピーしています。

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?