微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Yoctohardknott和带有 go-sqlite3 的 golang

如何解决Yoctohardknott和带有 go-sqlite3 的 golang

需要一些 Yocto 和 Golang 方面的帮助。 我正在为一个 golang 应用程序开发一个配方,它的导入非常简单:

import (
    // standart imports skipped
    "github.com/bmizerany/pat"
    _ "github.com/mattn/go-sqlite3"
)

所以当我构建和运行 Yocto 镜像时出现了问题,所以在 .bb(或 local.conf)中使用 CGO_ENABLED=0 一切都很好,但在运行时我得到:

Binary was compiled with CGO_ENABLED=0,go-sqlite3 requires cgo to work. This is a stub

好的,然后我在没有 CGO_ENABLED=0 的情况下构建 do_compile 阶段开始分裂,实际上我设法编译了它,但在我的配方中没有链接到这个 .bb:

### adding sysroot paths because Go uses recipe-sysroot-native by default:
CGO_CFLAGS += "-I${PKG_CONfig_SYSROOT_DIR}/usr/include"
CGO_CFLAGS += "-mfloat-abi=hard -mfpu=neon"
CGO_LDFLAGS += "-L${PKG_CONfig_SYSROOT_DIR}/usr/lib -L${PKG_CONfig_SYSROOT_DIR}/lib"

ld 到处都是丢失目标文件,例如:

| WARNING: exit code 2 from a shell command.                                                                                                                                                                       
| ERROR: Execution of '<path>/0.1-r0/temp/run.do_compile.17582' Failed with exit code 2:                           
| <path>/0.1-r0/recipe-sysroot-native/<path>/10.2.0/ld: cannot find Scrt1.o: No such file or directory
| <path>/0.1-r0/recipe-sysroot-native/<path>/10.2.0/ld: cannot find crti.o: No such file or directory
| <path>/0.1-r0/recipe-sysroot-native/<path>/10.2.0/ld: cannot find crtbeginS.o: No such file or directory
| collect2: error: ld returned 1 exit status

有人可以帮我解决这个问题吗?具有基于 C 的依赖项的 Golang 是否真的适用于 Yocto hardknott

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。