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, <i...@golang.org> wrote:

> On Fri, Sep 28, 2018 at 2:08 AM, Ankit Gupta
> <ankit.gupta.ii...@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
>

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