LoginSignup
4
4

More than 5 years have passed since last update.

intel edison用にmrubyをWindowsでクロスコンパイル

Posted at

はじめに

mrubyはドキュメントにもあるようにクロスコンパイルが簡単にできるようになっているので、
intel edison用にWindowsでクロスコンパイルで書いたように--sysrootを指定することさえ分かっていれば簡単にedison用のバイナリをビルドできます。

クロスコンパイルの設定と実行

mrubyのドキュメントにあるように、クロスコンパイルするには
build_config.rbに設定を追加します。
以下をbuild_config.rbの最後に追記してください(--sysrootに指定するパスは適宜修正のこと)。

build_config.rb
MRuby::CrossBuild.new('edison') do |conf|
  toolchain :gcc

  conf.cc.command = ENV['CC'] || 'i586-poky-linux-gcc'
  conf.cc.flags << "--sysroot=C:/Tools/edison/sysroots/core2-32-poky-linux"
  conf.linker.command = ENV['LD'] || 'i586-poky-linux-gcc'
  conf.linker.flags << "--sysroot=C:/Tools/edison/sysroots/core2-32-poky-linux"

  conf.exts.executable = ''

  enable_debug

  conf.gembox 'default'

  # if you need mrdb
  conf.cc.defines = %w(ENABLE_DEBUG)
  conf.gem :core => "mruby-bin-debugger"

end

編集が終わったらいつも通りmake1を実行すれば
build/edison以下にファイルがビルドされます。

あとはbuild/edison/bin/mrubybuild/edison/bin/mrdbなど必要なファイルを転送すれば
intel edisonでmrubyが使えます!

あとは、mruby-mraaとかあればなぁ~色々できるんだろうなぁ~


  1. まずhost用mrbcをビルドし、そのあとedison用バイナリをビルドするので
    windowsがターゲットのGCC(mingwなど)と、edisonのSDK、両方にpathを通しておく必要があります。 

4
4
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
4