Golang cannot be run under linux after compilation. What is the reason for the segment error?

Go programs compiled under Mac are uploaded to two linux servers, one of which runs normally, but the other displays a segment error. what may be the reason?

Linux version 2.6.32-573.22.1.el6.x86_64
can run

Linux version 3.10.0-514.26.2.el7.x86_64
cannot run, execute display segment error

Mar.04,2021

obviously you need to cross-compile

learn about Golang cross-compilation

< hr >

if it still doesn't work, see the next question https://codeshelper.com/q/10.

.

don't hit each hand

. The go program running under

linux is compiled directly under linux to get the executable file to run. Do not compile under mac and run under linux.


you may need to see how many bits of 32 or 64 the operating system is. Cross-compilation parameters are different


upload code. Ftp software defaults to ASCII, to binary upload.


different versions of the kernel will not be fully compatible. 2.x 3.x 4.x has changed a lot. If the program uses the interface of the kernel and happens to change the interface, it will be core dump.

Menu