sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.53k stars 138 forks source link

asking about pkg-config problem #32

Closed benzsuankularb closed 5 years ago

benzsuankularb commented 8 years ago

I go get in window. It's come up with

$ go get github.com/sbinet/go-python
# pkg-config --cflags python-2.7
Package python-2.7 was not found in the pkg-config search path.
Perhaps you should add the directory containing `python-2.7.pc'
to the PKG_CONFIG_PATH environment variable
No package 'python-2.7' found
pkg-config: exit status 1

This not happen for me in OSX Now I cant even find .pc files in any directories. So I don't know what to add in PKG_CONFIG_PATH

Sorry for asking stupid question I'm pretty new in window, python, pkg-config

sbinet commented 8 years ago

sorry, as you can see, go-python hasn't been extensively used on Windows (TM).

I'll push shortly a cgoflags_posix.go file for the non-windows platforms and a cgoflags_windows.go one for Windows(TM). Then, I could add the proper cgo incantations for Windows(TM) in that file. Do you know what is the canonical installation path of Python for that platform? Is that c:\Python27 ?

benzsuankularb commented 8 years ago

Yes, c:\Python27

sbinet commented 8 years ago

ok. could you give f1981c0 a spin?

benzsuankularb commented 8 years ago

Thank you for very fast response, I've got this (in cygwin)

# github.com/sbinet/go-python
In file included from C:/Python27/include/Python.h:58:0,
                 from go-python.h:4,
                 from ..\github.com\sbinet\go-python\capi.go:3:
C:/Python27/include/pyport.h:886:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?). "
  ^

My python is 64-bits, Cygwin also 64-bits.

sbinet commented 8 years ago

googling this error and after some random walk through the output, I've got this: http://stackoverflow.com/questions/29762560/cygwin-64-bit-cant-install-pillow-via-pip

could you make sure you have the correct cygwin version (32/64) and installed the correct Python2.7 version (32/64) ?

-s

zhengchun commented 6 years ago

I have same issue in windows:

{user}\AppData\Local\Temp\go-build142102602\github.com\sbinet\go-python\_obj\exceptions.cgo2.o: In function `_cgo_75d15165160c_Cfunc_PySignal_SetWakeupFd':
..\../cgo-gcc-prolog:493: undefined reference to `PySignal_SetWakeupFd'
{user}\AppData\Local\Temp\go-build142102602\github.com\sbinet\go-python\_obj\go-python.o: In function `_gopy_InitModule':

{GOPATH}/github.com/sbinet/go-python/go-python.c:147: undefined reference to `__imp_Py_InitModule4'

{user}\AppData\Local\Temp\go-build142102602\github.com\sbinet\go-python\_obj\go-python.o: In function `_gopy_InitModule3':

{GOPATH}/github.com/sbinet/go-python/go-python.c:152: undefined reference to `__imp_Py_InitModule4'

collect2.exe: error: ld returned 1 exit status

This is my config for cgoflags_windows.go:

package python

// #cgo CFLAGS: -I{USER}/Anaconda2/include
// #cgo LDFLAGS: -L{USER}/Anaconda2/libs -lpython27
// #include "go-python.h"
import "C"

My environments: Python 2.7.14 |Anaconda, Inc.| (default, Oct 15 2017, 03:34:40) [MSC v.1500 64 bit (AMD64)] on win32

@sbinet , any suggest?

yuxiaoba commented 5 years ago

I got this problem too,

In file included from C:/Python27/include/Python.h:61:0,
                 from ./go-python.h:4,
                 from C:\gopath\src\github.com\sbinet\go-python\capi.go:3:
C:/Python27/include/pyport.h:895:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."

Have you solved it?

sbinet commented 5 years ago

78 should have addressed this.

feel free to reopen if that isn't the case.