@putu pointed me to the right direction, all I had to do was tune
CFLAGS to include
C comment in
/* #cgo CFLAGS: -I/usr/include/luajit-2.0 -I/usr/local/musl/include/ #cgo LDFLAGS: -L/usr/local/lib -lluajit-5.1 #include <lua.h> #include <stdlib.h> #include "golua.h" */ import "C"
Looks like everything builds just fine:
$ CC="/usr/local/musl/bin/musl-gcc" go build --ldflags '-linkmode external -extldflags "-static"' basic.go $ file basic basic: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped $ ./basic Hello World! test2 arg: 42 from bottom: 42 hello world! from go! hello world! from go! hello world! from go! Ciao [string "test2(42)"]:1: attempt to call global 'test2' (a nil value)