I'd like to state my observations (this is not a definitive answer).

On macOS it is okay to ignore the undefined symbols with -undefined 
dynamic_lookup
On Windows you need to link with a library containing the symbols 
On Linux you don't need to care at all... as long as the binary during 
runtime sees the symbols.

So my build script is something like this:

switch goos {
    case "darwin":
        cmd.Env = append(cmd.Env, "CGO_CFLAGS: 
-I/opt/homebrew/opt/lua@5.3/include/lua")
        cmd.Env = append(cmd.Env, "CGO_LDFLAGS=-undefined dynamic_lookup")
    case "linux":
        cmd.Env = append(cmd.Env, "CGO_CFLAGS=-I/usr/include/lua5.3")
    case "windows":
        cmd.Env = append(cmd.Env, "CGO_CFLAGS=-I/usr/include/lua5.3")
        cmd.Env = append(cmd.Env, "CGO_LDFLAGS=-llua53w64 
-L/path/to/binary/with/lua/symbols/")
...

With this (don't forget GOOS, GOARCH and CGO_ENABLED) everything compiles 
(and runs) fine. But there might be pitfalls ignoring all the undefined 
symbols. 

Patrick


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2638af06-d17b-4801-9cf5-32e9932ba7c4n%40googlegroups.com.

Reply via email to