Problem Cross Compiling CGO


(Raphael Jacob) #1

Hello,

I´m very new to go and I know using cgo in one of the first projects and cross compiling it is not the best idea…
This is my source: https://github.com/ski7777/gorobointerface
Here you can find the external lib: https://gitlab.com/Humpelstilzchen/libroboint/tree/master/lib

Now I tried to cross-compile it:
CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm go build --ldflags '-linkmode external -extldflags "-static"'

Result:

# github.com/ski7777/gorobointerface/pkg/robointerface/api
/home/raphael/go/src/github.com/ski7777/gorobointerface/pkg/robointerface/api/low_level.go:5:10: fatal error: roboint.h: No such file or directory
 #include "roboint.h"
          ^~~~~~~~~~~
compilation terminated.

How to fix this?