1

I’m trying to build a libtest.a with Go1.11.4 using cgo under linux/mips64le. I make a simple Go file, this is test.go code:

package main
import(
    “C”
    “fmt”
)

func main() {
}

//export hello
func hello(){
    fmt.Println(“Hello World”)
}

and I did:

CGO_ENABLED=1 go build -o libtest.a -buildmode=c-archive test.go

I get these very non-descriptive errors:

# internal/race
flag provided but not defined: -shared
usage: compile [options] file.go...
(... many options such like -K, -L, -M etc.)
# internal/cpu
(...following like above)
# errors
# runtime/internal/sys
# math/bits
# runtime/internal/atomic
# sync/atomic
# math
# unicode/utf8
# unicode
# runtime/cgo

How can I do it? I can not use cgo under mips64le? best regards

wikios
  • 35
  • 1
  • 8

1 Answers1

0

On my Mac, I build with:

GOOS=linux GOARCH=mips64le go build

It works well under mips64le(OS:NeoKylin).

hiyang
  • 11
  • 3