2

I am trying to compile a Contiki application that includes MRuby libraries and executes some simple ruby code. The problem is, I don't know how to include the MRuby libraries in the compilation.

Here is the project: https://github.com/matus-tomlein/contiki-mruby-example/tree/wrong

The code I want to execute is in contiki-mruby-example.c. The problem is probably in the Makefile. This is what I have currently:

CONTIKI_PROJECT = contiki-mruby-example
all: $(CONTIKI_PROJECT)

CONTIKIDIRS += mruby/include

CFLAGS += -v
CFLAGS += -Imruby/include

CONTIKI = contiki
include $(CONTIKI)/Makefile.include

I get the following error when I execute make:

ld: can't map file, errno=22 file 'mruby/include' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The MRuby code I want to include is in mruby/include.

This is a similar question: How to use external libraries and compile them along with a Contiki application But using TARGET_LIBFILES or LDFLAGS didn't help. I guess that is because I am compiling plain source code, not libraries.

There probably is a simple answer that I am missing. Thanks for any suggestions.

Community
  • 1
  • 1
  • Do your really need to *compile* the libraries? I would normally assume that libraries are *linked* with. If you want to link, add libs to the `Makefile`. If you want to *compile*, add source paths to `CONTIKIDIRS`, and list of .c files to `PROJECT_SOURCEFILES`. – kfx Jan 26 '15 at 15:12

1 Answers1

1

Thanks @kfx for the comment, you were right that I should have linked the library in the Makefile.

Just to help anyone else that might have this problem:

  1. Go to the mruby subfolder and execute make
  2. Add this to Makefile: TARGET_LIBFILES += mruby/build/host/lib/libmruby.a

I have updated the example repo with the fix: https://github.com/matus-tomlein/contiki-mruby-example