編譯命令:GOOS=linux GOARCH=arm GOARM=7 go build hello.go
編譯成功后放到arm里執行,顯示line 1: syntax error: word unexpected (expecting ")")
另外一個C語言交叉編譯出來的程式能夠正常運行,兩個readelf如下所示,哪位大神指導下為什么
可執行的程式:
ELF Header:
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0xe0e0
Start of program headers: 52 (bytes into file)
Start of section headers: 36403244 (bytes into file)
Flags: 0x5800002, has entry point, Version5 EABI, BE8
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 10
Size of section headers: 40 (bytes)
Number of section headers: 42
Section header string table index: 39
執行報錯的程式:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x5f0a0
Start of program headers: 52 (bytes into file)
Start of section headers: 276 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 24
Section header string table index: 3
uj5u.com熱心網友回復:
建議,1.go的demo要簡單些。嘗試下。2.go的demo中不包含CGO的特性,即不呼叫C函式嘗試下。3.換開發版試試4.確定你的板子CPUt體系結構,用GOARM=7 對嗎?uj5u.com熱心網友回復:
感謝回復。demo程式很簡單,也不包含c呼叫。請問GOARM這個引數代表的具體含義是什么?沒查到相關描述。另外我用的是arm cortex a8。轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/9770.html
標籤:應用程序開發區
