linux - 使用 tinygo 从 x64 Linux 编译 arm 二进制文件:未定义的参考问题
问题描述
当我输入以下命令时,我正在尝试使用 Linux 中的 tinygo 编译程序:
GOARCH=arm tinygo build -o <OutputName> ./main.go
我有 :
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /tmp/tinygo859602615/main.o: in function `syscall.Seek':
/usr/local/go/src/syscall/syscall_linux_arm.go:60: undefined reference to `syscall.seek'
上面显示的相关代码是:
// Underlying system call writes to newoffset via pointer.
// Implemented in assembly to avoid allocation.
func seek(fd int, offset int64, whence int) (newoffset int64, err Errno)
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
newoffset, errno := seek(fd, offset, whence)
if errno != 0 {
return 0, errno
}
return newoffset, nil
}
我刚刚使用sudo apt-get install arm-linux-gnueabihf来安装这个包。
但是,GOARCH=arm go build -o ./main.go可以正常工作。使用 CGO_ENABLED="0" 标志不会改变任何东西。我在网上搜索过,没有发现类似的问题。感谢您提供任何可能的信息。
环境 :
Linux 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
go version go1.16.3 linux/amd64
CGO_ENABLED="1"
GOROOT="/usr/local/go"
TINYGOROOT="/usr/local/lib/tinygo"
解决方案
推荐阅读
- python - 为什么我的代码不执行,我该如何执行?
- ios - 为什么应用在实施 Firebase Crashlytics 时不会崩溃?
- excel - Normal.dot 和 Personal.xlsb
- html - 水平对齐 CSS 箭头和文本
- c++ - 我可以在 C++ 中覆盖非虚函数吗
- java - 为什么 spring-hadoop 生命周期结束并且有继任者?
- python-3.x - 让 tkinter 标签在一段时间后消失 - “NoneType”对象没有属性“destroy”
- python-3.x - 如何修复此代码?(多维)
- python - 在Python中出现异常后将项目返回到for循环中
- firebase - FIREBASE Hosting 无法使用正确的网站