SIGILL: illegal instruction
agorman opened this issue · 5 comments
I'm having an issue where when build the binary inside a docker container and then try to run it on another machine I get SIGILL: illegal instruction
. If I build and run it on the same machine then it works fine. I'm thinking it may be due to differing CPU capabilities. It's being built on a system with an AMD processor and it's being run on a system with an Intel processor.
I've tried building with CGO_CXXFLAGS="-std=c++1z -Wall -DNDEBUG -march=x86-64 -mtune=generic"
but it doesn't seem to help.
Any ideas on how I can get the binary to run on any x86_64 machine?
SIGILL: illegal instruction
PC=0xdf7133 m=8 sigcode=2
signal arrived during cgo execution
instruction bytes: 0xc4 0xe3 0xd1 0x6b 0xc9 0x50 0x48 0x39 0xd8 0x7c 0xea 0xc5 0xfb 0x10 0xad 0x90
goroutine 26 [syscall]:
runtime.cgocall(0xdc2ff0, 0xc0000afbd0)
/usr/local/go/src/runtime/cgocall.go:158 +0x5c fp=0xc0000afba8 sp=0xc0000afb70 pc=0x478e3c
github.com/Kagami/go-face._Cfunc_facerec_init(0x7fc58c000b60)
_cgo_gotypes.go:176 +0x49 fp=0xc0000afbd0 sp=0xc0000afba8 pc=0xd8abe9
github.com/Kagami/go-face.NewRecognizer({0x1169d9c?, 0xc000110270?})
/root/go/pkg/mod/github.com/!kagami/go-face@v0.0.0-20210630145111-0c14797b4d0e/face.go:68 +0x67 fp=0xc0000afc38 sp=0xc0000afbd0 pc=0xd8b107
github.com/Kagami/go-face.NewRecognizerWithConfig({0x1169d9c?, 0xc0000afcb8?}, 0x482a67?, 0x3e800000, 0x0)
/root/go/pkg/mod/github.com/!kagami/go-face@v0.0.0-20210630145111-0c14797b4d0e/face.go:82 +0x3b fp=0xc0000afc88 sp=0xc0000afc38 pc=0xd8b55b
I have the same problem here.
build in docker, debian. same problem here.
Here it worked for me to change the following line in the file.go file::
// #cgo CXXFLAGS: -std=c++1z -Wall -O3 -DNDEBUG -march=native
to:
// #cgo CXXFLAGS: -std=c++1z -Wall -O3 -DNDEBUG -march=x86-64 -mtune=generic
@leandroveronezi do you know if it's possible to pass these flags from the command line?
When I try CGO_CXXFLAGS="-std=c++1z -Wall -O3 -DNDEBUG -march=x86-64 -mtune=generic" go build ...
I'm still getting SIGILL: illegal instruction
By command I think it is not possible. The flag is defined in the face.go file. See this link to my local change.