I  have test that use GOOS=linux GOARCH=amd64 can be compiled successful in 
MacOS.
But I encounter problem when interfere with the github.com/mattn/go-sqlite3 
which need cgo, so I enable the CGO_ENABLED=1
This is where is the error happen, the error message as bellow, how can I 
fix it, thanks.

==================

weedsdeMBP:wechat-server weeds$ make

GOOS=linux GOARCH=amd64 go build

# github.com/mattn/go-sqlite3

../../mattn/go-sqlite3/sqlite3_go18.go:18:10: undefined: SQLiteConn

../../mattn/go-sqlite3/sqlite3_go18.go:26:10: undefined: SQLiteConn

../../mattn/go-sqlite3/sqlite3_go18.go:27:17: undefined: namedValue

../../mattn/go-sqlite3/sqlite3_go18.go:29:13: undefined: namedValue

../../mattn/go-sqlite3/sqlite3_go18.go:35:10: undefined: SQLiteConn

../../mattn/go-sqlite3/sqlite3_go18.go:36:17: undefined: namedValue

../../mattn/go-sqlite3/sqlite3_go18.go:44:10: undefined: SQLiteConn

../../mattn/go-sqlite3/sqlite3_go18.go:49:10: undefined: SQLiteConn

../../mattn/go-sqlite3/sqlite3_go18.go:54:10: undefined: SQLiteStmt

../../mattn/go-sqlite3/sqlite3_go18.go:63:10: undefined: SQLiteStmt

../../mattn/go-sqlite3/sqlite3_go18.go:36:17: too many errors

make: *** [wechatserver] Error 2

weedsdeMBP:wechat-server weeds$ vim Makefile 



weedsdeMBP:wechat-server weeds$ make

CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build

# github.com/gohiweeds/wechat-server

/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 
1

ld: warning: ignoring file 
/var/folders/w_/njwc578x7yn1glp8dn95qlw40000gn/T/go-link-650745584/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/w_/njwc578x7yn1glp8dn95qlw40000gn/T/go-link-650745584/go.o

Undefined symbols for architecture x86_64:

  "__cgo_topofstack", referenced from:

      __cgo_18049202ccd9_C2func_getnameinfo in 000002.o

      __cgo_18049202ccd9_Cfunc_getnameinfo in 000002.o

      __cgo_18049202ccd9_C2func_getaddrinfo in 000004.o

      __cgo_18049202ccd9_Cfunc_gai_strerror in 000004.o

      __cgo_18049202ccd9_Cfunc_getaddrinfo in 000004.o

      __cgo_f54a0db98f45_Cfunc_sqlite3_backup_finish in 000018.o

      __cgo_f54a0db98f45_Cfunc_sqlite3_backup_init in 000018.o

      ...

  "__cgoexp_f54a0db98f45_callbackTrampoline", referenced from:

      _callbackTrampoline in 000017.o

  "__cgoexp_f54a0db98f45_doneTrampoline", referenced from:

      _doneTrampoline in 000017.o

  "__cgoexp_f54a0db98f45_stepTrampoline", referenced from:

      _stepTrampoline in 000017.o

  "_crosscall2", referenced from:

      _callbackTrampoline in 000017.o

      _stepTrampoline in 000017.o

      _doneTrampoline in 000017.o

  "_main", referenced from:

     implicit entry/start for main executable

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see 
invocation)


make: *** [wechatserver] Error 2

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