LoginSignup
0
1

More than 3 years have passed since last update.

メモ: mruby

Last updated at Posted at 2020-07-28

インストール

apt install -y \
 libmruby-dev mruby
example.c
#include <stdio.h>
#include <mruby.h>
#include <mruby/compile.h>

int main(void) {
    mrb_state *mrb = mrb_open();
    char code[] = "5.times { puts 'mruby is awesome!' }";

    printf("Executing Ruby code with mruby:\n");
    mrb_load_string(mrb, code);

    mrb_close(mrb);
    return 0;
}
cc example.c -lmruby -lm -o example

./example

ubuntuでwindows向けにクロスコンパイル(あんまよくわかってない)

apt install -y \
 mingw-w64 binutils-mingw-w64 gcc-mingw-w64 g++-mingw-w64
  • 以下調査中
エラーでダメだった。
x86_64-w64-mingw32-g++ \
 -I /usr/include/ \
 -I /usr/include/x86_64-linux-gnu/ \
 mruby.c \
 -lmruby -lm \
 -o example.exe

キャプチャ.PNG

dockerを使ってクロスコンパイル

git clone "https://github.com/hone/mruby-cli"
cd mruby-cli
docker-compose run compile
mruby-cli --setup hello_world

cd hello_world
docker-compose run compile
0
1
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
0
1