Closed Eilens closed 3 years ago
You have to use cross C compiler. You are using host C compiler that can build executable for Windows. You need C compiler to build Linux executable.
我有点不太明白您的意思,我办公的win10电脑执行bee pack -be GOOS=linux是没有问题的 但是我得另一台电脑执行这个命令就失败,请问您能告诉我具体该怎么配置我得电脑吗?
translation: I don’t quite understand what you mean. It’s OK to run bee pack -be GOOS=linux on my win10 computer, but I have to run this command on another computer and it fails. Could you tell me how to configure my computer? Computer?
No problem with office computer | 任帅 | |
---|---|---|
@. | 签名由网易邮箱大师定制 On 4/21/2021 @.> wrote:
You have to use cross C compiler. You are using host C compiler that can build executable for Windows. You need C compiler to build Linux executable.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Go compiler use C compiler to build cgo package. Go can build linux executable but you need to use C compiler for Linux (Not Windows).
我明白您的意思,但是为什么我另一台win10电脑就可以把我的项目编译成可以让linux运行的包呢?
translation: I understand what you mean, but why can my other win10 computer compile my project into a package that can run linux? | 任帅 | |
---|---|---|
@. | 签名由网易邮箱大师定制 On 4/21/2021 @.> wrote:
Go compiler use C compiler to build cgo package. Go can build linux executable but you need to use C compiler for Linux (Not Windows).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Because the part of codes are compiled with different compiler.
package foo
/*
void Bar() {
// This part is compiled with C compiler
}
*/
import "C"
func Foo() {
// This part is compiled with Go compier
}
okey , I understand, thank you very much. next ,I want to use win10 to package my program into a linux executable file. What should I do? Because I am a junior programmer, I don't know how to deal with this problem in detail. | 任帅 | |
---|---|---|
@. | 签名由网易邮箱大师定制 On 4/21/2021 @.> wrote:
Because the part of codes are different with Go compiler.
package foo
/void Bar() { // This part is compiled with C compiler}/import"C"funcFoo() { // This part is compiled with Go compier }
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
As far as I know, there are no good compilers that can build Linux executable for Windows. So you've better to build Linux executable on Linux host (ex: VirtualBox, Cloud, WSL2)
好吧 万分感谢您。
任帅 | |
---|---|
@. | 签名由网易邮箱大师定制 On 4/21/2021 @.> wrote:
As far as I know, there are no good compilers that can build Linux executable for Windows. So you've better to build Linux executable on Linux host (ex: VirtualBox, Cloud, WSL2)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.