There's a tool for that, and yeah it uses docker. 
https://github.com/karalabe/xgo

On Monday, 7 May 2018 22:32:00 UTC+8, mbanzon wrote:
>
> It was specifically stated that the code was CGO - this approach won’t 
> work unless there is a C compiler that is crosscompile enabled installed 
> already - I’m guessing the question is how to do that.
>
> In my experience the (by far) easiest way to do this is to set up a 
> (Docker) container or a VM with the needed Linux toolchain and use that. As 
> long as the target is Linux it is fairly easy (I am still to crack the 
> Windows<->macOS cross compilation for my CGO code - which is also caused by 
> SQLite).
>
> --
> Michael Banzon
> https://michaelbanzon.com/
>
> Den 7. maj 2018 kl. 07.22 skrev Rohit Jain <jain.ro...@gmail.com 
> <javascript:>>:
>
> *GOOS=linux GOARCH=amd64 go build*
>
> Try this?
>
> On Mon, May 7, 2018 at 8:56 AM, Steven Roth <st...@rothskeller.net 
> <javascript:>> wrote:
>
>> Can anyone point me to a recipe or guidance on how to set up a 
>> cross-compilation environment on a Mac that will allow me to build 
>> CGO-enabled Go code to run on Ubuntu?  The program I'm building is pure Go 
>> except for an unavoidable dependency on libsqlite3.
>>
>> Thanks in advance,
>> Steve
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Rohit Jain
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to