mattn / mattn/mruby-require

require not working with mruby

Open
#51 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
42
Forks
24
PR merge metrics
No merged PRs in 30d

Description

I try to create an executable from a simple Ruby program. If the file contains a simple puts with a string and I use the following commands
mrbc -Btest load.rb
gcc -std=c99 -I/root/mruby/include -I. test_stub.c -o load /root/mruby/build/host/lib/libmruby.a -lm -ldl
everything runs well calling ./load display my string.
But if I add
require 'yaml' or require 'ostruct' or require 'json' before, execution simply display nothig, no crash either...
I have added the following line in mrbgems/default.gembox file
conf.gem :core => "mruby-yaml"

and
conf.gem :github => 'ksss/mruby-ostruct', :branch => 'master'
conf.gem :github => 'mattn/mruby-json'
conf.gem :github => 'mattn/mruby-require'
in build_config.rb after conf.gembox 'default'
After make clean a call to objdump on libmruby.a show that the modules are in the lib...
But it doesn't work!
What am I doing wrong ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing mrbgems/default.gembox, build_config.rb, and test_stub.c, then reproduce the shown mrbc and gcc commands with the reported require cases. Compare the resulting libmruby.a and executable behavior; done means ./load still displays the string when yaml, ostruct, or json is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ruby
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.