Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Doesn't build with gccgo #6

Open
russel opened this issue Aug 11, 2013 · 2 comments
Open

Doesn't build with gccgo #6

russel opened this issue Aug 11, 2013 · 2 comments
Assignees

Comments

@russel
Copy link

russel commented Aug 11, 2013

I did a "go get" of the project but this failed to compile for all the reasons that are documented in the README.md. So having got the Git clone, I did the simple make install and that worked fine (albeit with a number of warnings): go-python.a appears in the appropriate place. However using:

make GO_COMPILER=gccgo install

I get the

(cd cmd/go-python && CGO_LDFLAGS="-L/usr/lib/python2.7 -lpython2.7" CGO_CFLAGS="-I/usr/include/python2.7 -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security " go install -compiler=gccgo .)

github.com/sbinet/go-python/cmd/go-python

./main.go:5:29: error: import file ‘github.com/sbinet/go-python’ not found
"github.com/sbinet/go-python"
^
./main.go:10:9: error: reference to undefined name ‘python’
err := python.Initialize()
^
./main.go:17:8: error: reference to undefined name ‘python’
rc := python.Py_Main(os.Args)
^
make: *** [install] Error 2

Almost certainly user error, but…

Thanks.

PS any move to Python 3 planned, Python 2 is so last millenium ;-)

@sbinet
Copy link
Owner

sbinet commented Aug 11, 2013

hi Russel,

I haven't tested building go-python with gccgo in a long time (obviously)
but it seems something's broken with gccgo.

with the following little project, I could reproduce your issue:

$ cd /tmp/go-tmp
$ export GOPATH=`pwd`
$ mkdir -p src/foo
$ cd src/foo
$ cat > foo.go << EOF
package foo
import "fmt"
func Foo() {
 fmt.Printf("hello foo\n")
}
EOF

$ mkdir bar && cd bar
$ cat > bar.go << EOF
package main
import "foo"
func main() {
 foo.Foo()
}
EOF

$ go get -compiler=gccgo -v .
foo
foo/bar
# foo/bar
./bar.go:3:11: error: import file ‘foo’ not found
 import "foo"
           ^
./bar.go:6:2: error: reference to undefined name ‘foo’
  foo.Foo()
  ^
zsh: exit 2     go get -compiler=gccgo -v .

do you have the same gccgo version than I do ?

$ gccgo --version
gccgo (GCC) 4.8.1 20130725 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

wrt Python-3: I don't plan to migrate just yet as my workplace has yet to move away from py-2... but I'd be happy to open a python-3 branch and pull requests there :}

-s

@ghost ghost assigned sbinet Aug 11, 2013
@russel
Copy link
Author

russel commented Aug 11, 2013

My gccgo reports:

|> gccgo --version
gccgo (Debian 4.8.1-8) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

wrt Python version, I would have thought your work would be champing at the bit to get to Python 3.3. What is the reason for staying with Python 2.7? I may well try and take a fork and feature branch for the C Python 3.3 API. I guess there is also PyPy to think about.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants