我正在尝试编译包含MRuby库的Contiki应用程序并执行一些简单的ruby代码。问题是,我不知道如何在编译中包含MRuby库。
以下是项目:https://github.com/matus-tomlein/contiki-mruby-example/tree/wrong
我想要执行的代码位于contiki-mruby-example.c
。问题可能出在Makefile
。这就是我目前所拥有的:
CONTIKI_PROJECT = contiki-mruby-example
all: $(CONTIKI_PROJECT)
CONTIKIDIRS += mruby/include
CFLAGS += -v
CFLAGS += -Imruby/include
CONTIKI = contiki
include $(CONTIKI)/Makefile.include
执行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)
我要包含的MRuby代码位于mruby/include
。
这是一个类似的问题:How to use external libraries and compile them along with a Contiki application
但是使用TARGET_LIBFILES
或LDFLAGS
并没有帮助。我想这是因为我正在编译普通的源代码,而不是库。
可能有一个我想念的简单答案。感谢您的任何建议。
答案 0 :(得分:1)
感谢@kfx的评论,你是对的,我应该把它链接到Makefile中。
只是为了帮助其他可能遇到此问题的人:
make
TARGET_LIBFILES += mruby/build/host/lib/libmruby.a
我已使用修复程序https://github.com/matus-tomlein/contiki-mruby-example
更新了示例repo