Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22199

[cgo]Python C API Error: undefined reference to 'Py_True'

$
0
0

Environment:Ubuntu20.04,Golang 1.9.2,Python 3.7.10

I am trying to use this package: https://github.com/DataDog/go-python3The 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 is 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 python3pkg-config --libs python3CGO_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.


Viewing all articles
Browse latest Browse all 22199


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>