macOS: 12.5.1
go: go1.19.3 darwin/amd64

I'm having trouble building a go module that uses Python as a shared 
library.

This code works:
...
package main

// #include <float.h>
import "C"
import "fmt"

func main() {
fmt.Println("Max float value of float is", C.FLT_MAX)
}
...
$ go run . 
Max float value of float is 3.4028234663852886e+38
...
I run into problems when I try to include Python:
...
package main

/*
#cgo pkg-config: python3
#cgo LDFLAGS: -lpython3.8
*/
import "C"

import (
"fmt"
)

func main() {
C.Py_Initialize()
fmt.Println(C.GoString(C.Py_GetVersion()))
C.Py_Finalize()
}
...
$ go run .
# producer
./producer.go:16:2: could not determine kind of name for C.Py_Finalize
./producer.go:15:25: could not determine kind of name for C.Py_GetVersion
./producer.go:14:2: could not determine kind of name for C.Py_Initialize
...

Any suggestions? I'm guessing it has something to do w/ setting 
PKG_CONFIG_PATH and/or CGO_CFLAGS but I'm not certain...

-- 
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/3143e01d-4143-49d5-b2e5-745ebec1406cn%40googlegroups.com.

Reply via email to