tstx program code (golang)
package main
import "fmt"
func main(){
fmt.Printf("Hello")
}
On dev computer (debian based linux) all ok, but when i run it on server computer (Debian 8) i got segmentation fault
both systems are amd64, code compilled with [go build]
[strace ./tstx] - says
execve("./tstx", ["./tstx"], [/* 16 vars */]) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffffffffff8b} ---
+++ killed by SIGSEGV +++
Since you're compiling on one machine and moving to another, you'll really want to be sure that DLLs aren't an issue. First, build with:
CGO_ENABLED=0 go build...
And ensure it looks good with:
ldd tstx
(It should come back with "not a dynamic executable" or similar).
Disabling CGO means that the executable will be larger (everything statically linked), but dlls won't be an issue since it's self-contained. Finally, it can't hurt to verify that their architectures are the same via uname...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.