gpt4 book ai didi

使用 MRuby 编译 Contiki 应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 23:48:02 27 4
gpt4 key购买 nike

我正在尝试编译一个包含 MRuby 库并执行一些简单的 ruby​​ 代码的 Contiki 应用程序。问题是,我不知道如何在编译中包含 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_LIBFILESLDFLAGS 没有帮助。我想那是因为我正在编译纯源代码,而不是库。

我可能缺少一个简单的答案。感谢您的任何建议。

最佳答案

感谢@kfx 的评论,你是对的,我应该在 Makefile 中链接库。

只是为了帮助其他可能遇到此问题的人:

  1. 进入mruby子文件夹并执行make
  2. 将此添加到 Makefile:TARGET_LIBFILES += mruby/build/host/lib/libmruby.a

我已经用修复程序更新了示例存储库:https://github.com/matus-tomlein/contiki-mruby-example

关于使用 MRuby 编译 Contiki 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28151814/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com