Environment: Ubuntu20.04,Golang 1.9.2,Python 3.7.10
I am trying to use this package: https://github.com/DataDog/go-python3 The problem happened when 'go get github.com/DataDog/go-python3' was executed.
By the way, I have noticed that there is a similar issure:https://github.com/DataDog/go-python3/issues/41. However the answer does not work for me.
I use 'go get -x' to chech what is happening:
mininet@mininet-vm:~/go/src/Dockerfiles$ go get -x github.com/DataDog/go-python3
...
pkg-config --cflags python3
pkg-config --libs python3
CGO_LDFLAGS="-g" "-O2" "-L/opt/py/lib" "-lpython3.7m" /usr/local/go/pkg/tool/linux_amd64/cgo -objdir
...
# github.com/DataDog/go-python3
/usr/bin/ld: $WORK/github.com/DataDog/go-python3/_obj/_cgo_main.o:/tmp/go-build/github.com/DataDog/go-python3/_obj/cgo-generated-wrappers:236: undefined reference to `Py_True'
/usr/bin/ld: $WORK/github.com/DataDog/go-python3/_obj/_cgo_main.o:/tmp/go-build/github.com/DataDog/go-python3/_obj/cgo-generated-wrappers:233: undefined reference to `Py_None'
/usr/bin/ld: $WORK/github.com/DataDog/go-python3/_obj/_cgo_main.o:/tmp/go-build/github.com/DataDog/go-python3/_obj/cgo-generated-wrappers:230: undefined reference to `Py_False'
collect2: error: ld returned 1 exit status
see CGOFLAGS, I have add '-L/opt/py/lib -lpython3.7m' correctly to the end by using pkg-config and setting 'PKG_CONFIG_PATH' and 'LD_LIBRARY_PATH' varibles.
I don't know what happened, maybe go 1.9 is too old? But It seems like a link problem.
I use VM and docker to retry. And the problem is the same.
Thanks for all your possible help.