mitchellh / gox

A dead simple, no frills Go cross compile tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gox creates different bianaries if executed in mac or in Linux

abdul-jabbar01 opened this issue · comments

Hello

I'm using the gox to create the binary of go application.
When I run gox in macbook and create the binaries, then it works fine in all the OS.

But unfortunately when I run the gox command from within the linux (or golang) container, then the created binaries are producing some different result.
Resultant binaries works fine in the darwin and linux. But it don't work in the Alpine docker image and throws the following error:

Error: fork/exec /.helm/plugins/xyz: no such file or directory

(And strange thing is that if I use the gox on macbook and try the linux binary into alpine docker image, it works fine)

So, after lot of testing, I reach to the conclusion that gox is producing different results if it is being run on macbook or within the linux container.

Can anybody please confirm that?

Note: Go version is same in the macbook and in linux container where I'm running the gox.

hi @abdul-jabbar01, i think adding CGO_ENABLED=0 to your build will resolve this issue. i ran into the same thing awhile back compiling internal terraform providers and that resolved it.

my assumption is this has to do with dynamic vs static links during compilation

Yes. You are right. I managed to resolve it like you have said :)