Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime/cgo: can't cross compile from os x to linux with cgo #12888

Closed
Thomasdezeeuw opened this issue Oct 9, 2015 · 3 comments
Closed

runtime/cgo: can't cross compile from os x to linux with cgo #12888

Thomasdezeeuw opened this issue Oct 9, 2015 · 3 comments

Comments

@Thomasdezeeuw
Copy link
Contributor

What version of Go are you using (go version)?
go version go1.5.1 darwin/amd64 and
go version devel +3e6334e Tue Oct 6 07:05:51 2015 +0000 darwin/amd64

What operating system and processor architecture are you using?
OS X 10.10.5, 64 bit.

What did you do?
Have a simple go program with cgo (I think is mainly cgo). The code I used:

package main

import "net"

func main() {
    ln, err := net.Listen("unix", "/var/log/nginx.sock")
    if err != nil {
        panic(err)
    }
    defer ln.Close()

    for {
        conn, err := ln.Accept()
        if err != nil {
            panic(err)
        }
        conn.Close()
    }
}

Then try to cross compile from OS X to linux, running: GOOS=linux go build.

What did you expect to see?
A build linux binary.

What did you see instead?
Error message:

# runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Extra notes:

Cross compiling to windows works just fine.

Output of GOOS=linux go build -v:

runtime
sync/atomic
errors
math
sort
runtime/cgo
sync
internal/singleflight
io
syscall
# runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)
time
math/rand
os

Output of GOOS=linux go build -x:

WORK=/var/folders/lq/rzq0zxld0bb5mcy4jl1txrf00000gn/T/go-build464459186
mkdir -p $WORK/runtime/_obj/
mkdir -p $WORK/
cd /go/go/src/runtime
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/runtime.a -trimpath $WORK -p runtime -+ -buildid f4db31d312311c278e863eda6fdb573d33eefb7e -D _/go/go/src/runtime -I $WORK -pack -asmhdr $WORK/runtime/_obj/go_asm.h ./alg.go ./arch_amd64.go ./atomic_amd64x.go ./atomic_pointer.go ./cgo.go ./cgo_mmap.go ./cgocall.go ./cgocallback.go ./chan.go ./compiler.go ./complex.go ./cpuprof.go ./cputicks.go ./debug.go ./defs_linux_amd64.go ./env_posix.go ./error.go ./extern.go ./fastlog2.go ./fastlog2table.go ./hash64.go ./hashmap.go ./hashmap_fast.go ./heapdump.go ./iface.go ./lfstack.go ./lfstack_amd64.go ./lock_futex.go ./malloc.go ./mbarrier.go ./mbitmap.go ./mcache.go ./mcentral.go ./mem_linux.go ./mfinal.go ./mfixalloc.go ./mgc.go ./mgcmark.go ./mgcsweep.go ./mgcwork.go ./mheap.go ./mprof.go ./msize.go ./mstats.go ./mstkbar.go ./netpoll.go ./netpoll_epoll.go ./os1_linux.go ./os2_linux.go ./os_linux.go ./panic.go ./panic1.go ./parfor.go ./print1.go ./print1_write.go ./proc.go ./proc1.go ./race0.go ./rdebug.go ./rune.go ./runtime.go ./runtime1.go ./runtime2.go ./select.go ./sema.go ./signal1_unix.go ./signal2_unix.go ./signal_amd64x.go ./signal_linux.go ./signal_linux_amd64.go ./signal_unix.go ./sigpanic_unix.go ./sigqueue.go ./slice.go ./softfloat64.go ./sqrt.go ./stack1.go ./stack2.go ./string.go ./string1.go ./stubs.go ./stubs2.go ./symtab.go ./sys_x86.go ./time.go ./trace.go ./traceback.go ./type.go ./typekind.go ./typekind1.go ./unaligned1.go ./vdso_linux_amd64.go ./wbfat.go ./zgoarch_amd64.go ./zgoos_linux.go ./zversion.go
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/asm.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/asm_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/duff_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./duff_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/memclr_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./memclr_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/memmove_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./memmove_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/rt0_linux_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./rt0_linux_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/runtime/_obj/sys_linux_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./sys_linux_amd64.s
pack r $WORK/runtime.a $WORK/runtime/_obj/asm.o $WORK/runtime/_obj/asm_amd64.o $WORK/runtime/_obj/duff_amd64.o $WORK/runtime/_obj/memclr_amd64.o $WORK/runtime/_obj/memmove_amd64.o $WORK/runtime/_obj/rt0_linux_amd64.o $WORK/runtime/_obj/sys_linux_amd64.o # internal
mkdir -p $WORK/errors/_obj/
cd /go/go/src/errors
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/errors.a -trimpath $WORK -p errors -complete -buildid df2c76951e51fe1bd3345f24c2f19f9edb45296e -D _/go/go/src/errors -I $WORK -pack ./errors.go
mkdir -p $WORK/sync/atomic/_obj/
mkdir -p $WORK/sync/
cd /go/go/src/sync/atomic
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/sync/atomic.a -trimpath $WORK -p sync/atomic -buildid d186629dc0bf30729a39822bcceb09bf758e9a54 -D _/go/go/src/sync/atomic -I $WORK -pack -asmhdr $WORK/sync/atomic/_obj/go_asm.h ./doc.go ./value.go
mkdir -p $WORK/math/_obj/
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/math.a -trimpath $WORK -p math -buildid f7ac6fae7e626a4046fa536785c2546683f2ce8f -D _/go/go/src/math -I $WORK -pack -asmhdr $WORK/math/_obj/go_asm.h ./abs.go ./acosh.go ./asin.go ./asinh.go ./atan.go ./atan2.go ./atanh.go ./bits.go ./cbrt.go ./const.go ./copysign.go ./dim.go ./erf.go ./exp.go ./expm1.go ./floor.go ./floor_asm.go ./frexp.go ./gamma.go ./hypot.go ./j0.go ./j1.go ./jn.go ./ldexp.go ./lgamma.go ./log.go ./log10.go ./log1p.go ./logb.go ./mod.go ./modf.go ./nextafter.go ./pow.go ./pow10.go ./remainder.go ./signbit.go ./sin.go ./sincos.go ./sinh.go ./sqrt.go ./tan.go ./tanh.go ./unsafe.go
mkdir -p $WORK/sort/_obj/
cd /go/go/src/sort
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/sort.a -trimpath $WORK -p sort -complete -buildid ffc617af88004900ab77444c58916894b99810f3 -D _/go/go/src/sort -I $WORK -pack ./search.go ./sort.go
mkdir -p $WORK/runtime/cgo/_obj/
mkdir -p $WORK/runtime/
cd /go/go/src/runtime/cgo
CGO_LDFLAGS="-g" "-O2" "-lpthread" /go/go/pkg/tool/darwin_amd64/cgo -objdir $WORK/runtime/cgo/_obj/ -importpath runtime/cgo -import_runtime_cgo=false -import_syscall=false -- -I $WORK/runtime/cgo/_obj/ -Wall -Werror cgo.go
cd /go/go/src/sync/atomic
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/sync/atomic/_obj/asm_amd64.o -trimpath $WORK -I $WORK/sync/atomic/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm_amd64.s
pack r $WORK/sync/atomic.a $WORK/sync/atomic/_obj/asm_amd64.o # internal
mkdir -p $WORK/sync/_obj/
cd /go/go/src/sync
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/sync.a -trimpath $WORK -p sync -buildid 5ecc9434e0a8da6603a4d6082c646c6602f32738 -D _/go/go/src/sync -I $WORK -pack ./cond.go ./mutex.go ./once.go ./pool.go ./race0.go ./runtime.go ./rwmutex.go ./waitgroup.go
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -print-libgcc-file-name
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/_cgo_main.o -c $WORK/runtime/cgo/_obj/_cgo_main.c
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/_cgo_export.o -c $WORK/runtime/cgo/_obj/_cgo_export.c
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/cgo.cgo2.o -c $WORK/runtime/cgo/_obj/cgo.cgo2.c
mkdir -p $WORK/io/_obj/
cd /go/go/src/io
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/io.a -trimpath $WORK -p io -complete -buildid 1f11f4f749237d117d4a43928609be7a309a1f16 -D _/go/go/src/io -I $WORK -pack ./io.go ./multi.go ./pipe.go
mkdir -p $WORK/internal/singleflight/_obj/
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_fatalf.o -c ./gcc_fatalf.c
mkdir -p $WORK/internal/
cd /go/go/src/internal/singleflight
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/internal/singleflight.a -trimpath $WORK -p internal/singleflight -complete -buildid bac1bf700eeff2a67ec0f2a5c8376d432ddecb47 -D _/go/go/src/internal/singleflight -I $WORK -pack ./singleflight.go
mkdir -p $WORK/syscall/_obj/
cd /go/go/src/syscall
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/syscall.a -trimpath $WORK -p syscall -buildid 6b68edc0f88c74e06a29277e484a4b44f6832858 -D _/go/go/src/syscall -I $WORK -pack -asmhdr $WORK/syscall/_obj/go_asm.h ./env_unix.go ./exec_linux.go ./exec_unix.go ./flock.go ./lsf_linux.go ./netlink_linux.go ./race0.go ./sockcmsg_linux.go ./sockcmsg_unix.go ./str.go ./syscall.go ./syscall_linux.go ./syscall_linux_amd64.go ./syscall_unix.go ./zerrors_linux_amd64.go ./zsyscall_linux_amd64.go ./zsysnum_linux_amd64.go ./ztypes_linux_amd64.go
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_libinit.o -c ./gcc_libinit.c
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_linux_amd64.o -c ./gcc_linux_amd64.c
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_mmap.o -c ./gcc_mmap.c
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/abs_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./abs_amd64.s
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_setenv.o -c ./gcc_setenv.c
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/asin_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asin_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/atan2_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./atan2_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/atan_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./atan_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/dim_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./dim_amd64.s
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_util.o -c ./gcc_util.c
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/exp2_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./exp2_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/exp_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./exp_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/expm1_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./expm1_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/floor_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./floor_amd64.s
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -I $WORK/runtime/cgo/_obj/ -g -O2 -Wall -Werror -o $WORK/runtime/cgo/_obj/gcc_amd64.o -c ./gcc_amd64.S
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/frexp_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./frexp_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/hypot_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./hypot_amd64.s
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -o $WORK/runtime/cgo/_obj/_cgo_.o $WORK/runtime/cgo/_obj/_cgo_main.o $WORK/runtime/cgo/_obj/_cgo_export.o $WORK/runtime/cgo/_obj/cgo.cgo2.o $WORK/runtime/cgo/_obj/gcc_fatalf.o $WORK/runtime/cgo/_obj/gcc_libinit.o $WORK/runtime/cgo/_obj/gcc_linux_amd64.o $WORK/runtime/cgo/_obj/gcc_mmap.o $WORK/runtime/cgo/_obj/gcc_setenv.o $WORK/runtime/cgo/_obj/gcc_util.o $WORK/runtime/cgo/_obj/gcc_amd64.o -g -O2 -lpthread
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/ldexp_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./ldexp_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/log10_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./log10_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/log1p_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./log1p_amd64.s
cd /go/go/src/runtime/cgo
/go/go/pkg/tool/darwin_amd64/cgo -objdir $WORK/runtime/cgo/_obj/ -dynpackage cgo -dynimport $WORK/runtime/cgo/_obj/_cgo_.o -dynout $WORK/runtime/cgo/_obj/_cgo_import.go -dynlinker
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/log_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./log_amd64.s
cd /go/go/src/runtime/cgo
clang -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -o $WORK/runtime/cgo/_obj/_all.o $WORK/runtime/cgo/_obj/_cgo_export.o $WORK/runtime/cgo/_obj/cgo.cgo2.o $WORK/runtime/cgo/_obj/gcc_fatalf.o $WORK/runtime/cgo/_obj/gcc_libinit.o $WORK/runtime/cgo/_obj/gcc_linux_amd64.o $WORK/runtime/cgo/_obj/gcc_mmap.o $WORK/runtime/cgo/_obj/gcc_setenv.o $WORK/runtime/cgo/_obj/gcc_util.o $WORK/runtime/cgo/_obj/gcc_amd64.o -g -O2 -Wl,-r -nostdlib -Wl,--build-id=none
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/mod_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./mod_amd64.s
# runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/modf_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./modf_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/remainder_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./remainder_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/sin_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./sin_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/sincos_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./sincos_amd64.s
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/sqrt_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./sqrt_amd64.s
cd /go/go/src/syscall
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/syscall/_obj/asm.o -trimpath $WORK -I $WORK/syscall/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm.s
cd /go/go/src/math
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/math/_obj/tan_amd64.o -trimpath $WORK -I $WORK/math/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./tan_amd64.s
cd /go/go/src/syscall
/go/go/pkg/tool/darwin_amd64/asm -o $WORK/syscall/_obj/asm_linux_amd64.o -trimpath $WORK -I $WORK/syscall/_obj/ -I /go/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm_linux_amd64.s
cd /go/go/src/math
pack r $WORK/math.a $WORK/math/_obj/abs_amd64.o $WORK/math/_obj/asin_amd64.o $WORK/math/_obj/atan2_amd64.o $WORK/math/_obj/atan_amd64.o $WORK/math/_obj/dim_amd64.o $WORK/math/_obj/exp2_amd64.o $WORK/math/_obj/exp_amd64.o $WORK/math/_obj/expm1_amd64.o $WORK/math/_obj/floor_amd64.o $WORK/math/_obj/frexp_amd64.o $WORK/math/_obj/hypot_amd64.o $WORK/math/_obj/ldexp_amd64.o $WORK/math/_obj/log10_amd64.o $WORK/math/_obj/log1p_amd64.o $WORK/math/_obj/log_amd64.o $WORK/math/_obj/mod_amd64.o $WORK/math/_obj/modf_amd64.o $WORK/math/_obj/remainder_amd64.o $WORK/math/_obj/sin_amd64.o $WORK/math/_obj/sincos_amd64.o $WORK/math/_obj/sqrt_amd64.o $WORK/math/_obj/tan_amd64.o # internal
mkdir -p $WORK/math/rand/_obj/
mkdir -p $WORK/math/
cd /go/go/src/math/rand
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/math/rand.a -trimpath $WORK -p math/rand -complete -buildid 6729a6ad7948404fdeb492dde299e3bea99d4f2a -D _/go/go/src/math/rand -I $WORK -pack ./exp.go ./normal.go ./rand.go ./rng.go ./zipf.go
cd /go/go/src/syscall
pack r $WORK/syscall.a $WORK/syscall/_obj/asm.o $WORK/syscall/_obj/asm_linux_amd64.o # internal
mkdir -p $WORK/time/_obj/
cd /go/go/src/time
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/time.a -trimpath $WORK -p time -buildid 7052eb61585600d47e0cf37981b696ee6850d669 -D _/go/go/src/time -I $WORK -pack ./format.go ./sleep.go ./sys_unix.go ./tick.go ./time.go ./zoneinfo.go ./zoneinfo_read.go ./zoneinfo_unix.go
mkdir -p $WORK/os/_obj/
cd /go/go/src/os
/go/go/pkg/tool/darwin_amd64/compile -o $WORK/os.a -trimpath $WORK -p os -buildid a727ccb78b2b5b38d7170dbd5fd6f19831d64131 -D _/go/go/src/os -I $WORK -pack ./dir_unix.go ./doc.go ./env.go ./error.go ./error_unix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./pipe_linux.go ./proc.go ./stat_linux.go ./sticky_notbsd.go ./str.go ./sys_linux.go ./sys_unix.go ./types.go ./types_notwin.go
@ianlancetaylor
Copy link
Contributor

In order to use cgo when cross-compiling, you need to set the CC environment variable to a Darwin -> GNU/Linux cross-compiler. You are using a Darwin native compiler, which can not work. Even if the build succeeded, the resulting code would not run on GNU/Linux.

@ianlancetaylor
Copy link
Contributor

By the way, thanks for providing all the useful information in the bug report.

@Thomasdezeeuw
Copy link
Contributor Author

@ianlancetaylor thanks for the quick response.

For people with the same issues, I ended up just running linux inside VirtualBox. I tried using gcc, installed via Homebrew, but that didn't work either.

@golang golang locked and limited conversation to collaborators Oct 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants