Tamas,

I installed docker on mac and cross compiled using xgo like you suggested. 
Worked perfectly. Thanks a lot!

On Saturday, September 29, 2018 at 1:58:20 AM UTC+5:30, Tamás Gulácsi wrote:
>
> 2018. szeptember 28., péntek 15:59:14 UTC+2 időpontban Ankit Gupta a 
> következőt írta:
>>
>> Thanks Ian for responding. Can you point me as to how to get the cross 
>> compiler. I am farely new to Mac.
>>
>> On Fri, 28 Sep 2018, 19:23 Ian Lance Taylor, <ia...@golang.org> wrote:
>>
>>> On Fri, Sep 28, 2018 at 2:08 AM, Ankit Gupta
>>> <ankit.gu...@gmail.com> wrote:
>>> >
>>> > I am working with confluent-kafka-go library
>>> > (https://github.com/confluentinc/confluent-kafka-go) which builds 
>>> fine on
>>> > the mac machine (mac OS 10.13.6) along with the code files I wrote. In 
>>> order
>>> > to deploy it on Linux server (Ubuntu 64 bit), I try this -
>>> >
>>> > $> CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build program.go
>>> >
>>> >
>>> > I get below linking error -
>>> >
>>> >
>>> > /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit 
>>> status
>>> > 1
>>> >
>>> > ld: warning: ignoring file
>>> > 
>>> /var/folders/fy/9ph54yjs6cq1kyxgs6cc9rvjvs6t0m/T/go-link-060577916/go.o,
>>> > file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 
>>> 0x01
>>> > 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the
>>> > architecture being linked (x86_64):
>>> > /var/folders/fy/9ph54yjs6cq1kyxgs6cc9rvjvs6t0m/T/go-link-060577916/go.o
>>> >
>>> > Undefined symbols for architecture x86_64:
>>> >
>>> >   "__cgo_topofstack", referenced from:
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc_rd_kafka_conf_new in 000003.o
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc_rd_kafka_conf_set in 000003.o
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc_rd_kafka_topic_conf_new in 000003.o
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc_rd_kafka_topic_conf_set in 000003.o
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc__c_rdkafka_topic_partition_list_entry in
>>> > 000004.o
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc_rd_kafka_assign in 000004.o
>>> >
>>> >       __cgo_f2fa82ea8f11_Cfunc_rd_kafka_assignment in 000004.o
>>> >
>>> >       ...
>>> >
>>> >   "_main", referenced from:
>>> >
>>> >      implicit entry/start for main executable
>>> >
>>> >      (maybe you meant: 
>>> __cgo_f2fa82ea8f11_Cfunc_rd_kafka_queue_get_main)
>>> >
>>> > ld: symbol(s) not found for architecture x86_64
>>> >
>>> > clang: error: linker command failed with exit code 1 (use -v to see
>>> > invocation)
>>> >
>>> >
>>> > It points to /var/folders which I am given to understand is a temp 
>>> location
>>> > in mac.
>>> >
>>> >
>>> > Any ideas on how to fix it?
>>>
>>> When cross-compiling a Go program that uses cgo, you need to be using
>>> a C cross-compiler.  It looks like you are using the native Darwin C
>>> compiler.  You need a cross-compiler from Darwin to GNU/Linux.
>>>
>>> Ian
>>>
>>
> Native compilation is much easier.
> If you have Docker installed, https://github.com/karalabe/xgo can help a 
> lot!
>

-- 
*::DISCLAIMER::

----------------------------------------------------------------------------------------------------------------------------------------------------


The contents of this e-mail and any attachments are confidential and 
intended for the named recipient(s) only.E-mail transmission is not 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted,lost, destroyed, arrive late or incomplete, or may contain 
viruses in transmission. The e mail and its contents(with or without 
referred errors) shall therefore not attach any liability on the originator 
or redBus.com. Views or opinions, if any, presented in this email are 
solely those of the author and may not necessarily reflect the views or 
opinions of redBus.com. Any form of reproduction, dissemination, copying, 
disclosure, modification,distribution and / or publication of this message 
without the prior written consent of authorized representative of redbus. 
<http://redbus.in/>com is strictly prohibited. If you have received this 
email in error please delete it and notify the sender immediately.Before 
opening any email and/or attachments, please check them for viruses and 
other defects.*

-- 
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