You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 GO111MODULE=off go build -o=$output_name
But the result was error!!!
What did you expect to see?
building success
What did you see instead?
/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/g_/w7965d_x0sq5_fwz9f0nzzy40000gp/T/go-link-781191658/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/g_/w7965d_x0sq5_fwz9f0nzzy40000gp/T/go-link-781191658/go.o
Undefined symbols for architecture x86_64:
"__cgo_topofstack", referenced from:
__cgo_faadc1275fbb_Cfunc_dpiConn_breakExecution in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_commit in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_getServerVersion in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_newVar in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_ping in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_prepareStmt in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_release in 000001.o
...
"__cgoexp_faadc1275fbb_CallbackSubscr", referenced from:
_CallbackSubscr in 000000.o
"_crosscall2", referenced from:
_CallbackSubscr in 000000.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)
The text was updated successfully, but these errors were encountered:
Cross-compilation with CGO_ENABLED requires that you set CC to a suitable cross-compiler (with relevant C source files for the target system).
Your command line suggests that you are attempting to build a Linux binary using a macOS host. That generally works fine for pure-Go binaries, but Linux and macOS have very different C environments and toolchains — you might not have appropriate Linux C headers and sources installed, or they might require additional configuration via environment variables.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
N/A
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm building a project steps as follows ;
export output_name=$GOPATH/shortenUrl/bin/shortenUrl-linux-amd64
env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 GO111MODULE=off go build -o=$output_name
But the result was error!!!
What did you expect to see?
building success
What did you see instead?
/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/g_/w7965d_x0sq5_fwz9f0nzzy40000gp/T/go-link-781191658/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/g_/w7965d_x0sq5_fwz9f0nzzy40000gp/T/go-link-781191658/go.o
Undefined symbols for architecture x86_64:
"__cgo_topofstack", referenced from:
__cgo_faadc1275fbb_Cfunc_dpiConn_breakExecution in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_commit in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_getServerVersion in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_newVar in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_ping in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_prepareStmt in 000001.o
__cgo_faadc1275fbb_Cfunc_dpiConn_release in 000001.o
...
"__cgoexp_faadc1275fbb_CallbackSubscr", referenced from:
_CallbackSubscr in 000000.o
"_crosscall2", referenced from:
_CallbackSubscr in 000000.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)
The text was updated successfully, but these errors were encountered: