won't compile on amd64 #3

Open
napsy opened this Issue Jun 5, 2010 · 17 comments

Comments

Projects
None yet
4 participants

napsy commented Jun 5, 2010

I'm unable to compile go-gtk on ArchLinux amd64 with gtk+ 2.20 and latest go. I get the following error:

CGOPKGPATH= /home/luka/bin/cgo pkg-config --cflags gtk+-2.0 -Duintptr="unsigned int*" gtk.go
gcc failed:
cc1: warnings being treated as errors

:41:12: error: '_callback' used but never defined

napsy commented Jun 5, 2010

I fixed this by encapsulating the asm statement inside the _callback function and returning 0.
After I fixed this issue in gtk.go, I get the nex compilation error:
/home/luka/bin/6g -o go.6 gtk.cgo1.go _cgo_gotypes.go
_cgo_gotypes.go:26: invalid recursive type _C_GList
_cgo_gotypes.go:97: invalid recursive type _C_GtkWindow
make[1]: *** [go.6] Error 1

hexsel commented Jun 8, 2010

Just got the latest and I have a similar issue:

...
/home/ghexsel/Development/software/golang/bin/6g -o go.6 gtk.cgo1.go _cgo_gotypes.go
_cgo_gotypes.go:26: invalid recursive type _C_GList
_cgo_gotypes.go:97: invalid recursive type _C_GtkWindow
make[1]: *** [go.6] Error 1

Owner

mattn commented Jun 8, 2010

What version of gtk/glib do you use?

hexsel commented Jun 8, 2010

The default with Ubuntu 10.04:

libgtk 2.20.1
libglib 2.24.1

Owner

mattn commented Jun 8, 2010

Hmm, please try following

# cd /path/to/go-gtk
# make clean
# make install

hexsel commented Jun 8, 2010

same result. I can upload the full output, but it doesn't seem to have anything significant other than the lines I pasted. Would it help?

Owner

mattn commented Jun 9, 2010

Please show me the output.

hexsel commented Jun 9, 2010

ghexsel@vic-ghexsel-desktop:/Development/code/go/calc$ rm -rf go-gtk/
ghexsel@vic-ghexsel-desktop:
/Development/code/go/calc$ git clone http://github.com/mattn/go-gtk.git
Initialized empty Git repository in /home/ghexsel/Development/code/go/calc/go-gtk/.git/
remote: Counting objects: 502, done.
remote: Compressing objects: 100% (348/348), done.
remote: Total 502 (delta 234), reused 303 (delta 148)
Receiving objects: 100% (502/502), 292.45 KiB | 219 KiB/s, done.
Resolving deltas: 100% (234/234), done.
ghexsel@vic-ghexsel-desktop:/Development/code/go/calc$ cd go-gtk/
ghexsel@vic-ghexsel-desktop:
/Development/code/go/calc/go-gtk$ make install
cd glib && make install
make[1]: Entering directory /home/ghexsel/Development/code/go/calc/go-gtk/glib' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags glib-2.0glib.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 glib.cgo1.go _cgo_gotypes.go /home/ghexsel/Development/software/golang/bin/6c -FVw -I"/home/ghexsel/Development/software/golang/src/pkg/runtime" -D_64BIT _cgo_defun.c rm -f _obj/glib.a /home/ghexsel/Development/software/golang/bin/gopack grc _obj/glib.a _go_.6 _cgo_defun.6 cp _obj/glib.a "/home/ghexsel/Development/software/golang/pkg/linux_amd64/glib.a" gcc -m64 -fPIC -O2 -o glib.cgo2.o -cpkg-config --cflags glib-2.0glib.cgo2.c gcc -m64 -o _cgo_.so glib.cgo2.opkg-config --libs glib-2.0-shared -lpthread -lm cp _cgo_.so "/home/ghexsel/Development/software/golang/pkg/linux_amd64/glib.so" rm glib.cgo2.c make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/glib'
cd gdk && make install
make[1]: Entering directory /home/ghexsel/Development/code/go/calc/go-gtk/gdk' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags gdk-2.0gdk.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 gdk.cgo1.go _cgo_gotypes.go /home/ghexsel/Development/software/golang/bin/6c -FVw -I"/home/ghexsel/Development/software/golang/src/pkg/runtime" -D_64BIT _cgo_defun.c rm -f _obj/gdk.a /home/ghexsel/Development/software/golang/bin/gopack grc _obj/gdk.a _go_.6 _cgo_defun.6 cp _obj/gdk.a "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdk.a" gcc -m64 -fPIC -O2 -o gdk.cgo2.o -cpkg-config --cflags gdk-2.0gdk.cgo2.c gcc -m64 -o _cgo_.so gdk.cgo2.opkg-config --libs gdk-2.0-shared -lpthread -lm cp _cgo_.so "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdk.so" rm gdk.cgo2.c make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gdk'
cd gdkpixbuf && make install
make[1]: Entering directory /home/ghexsel/Development/code/go/calc/go-gtk/gdkpixbuf' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags gdk-pixbuf-2.0gdkpixbuf.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 gdkpixbuf.cgo1.go _cgo_gotypes.go /home/ghexsel/Development/software/golang/bin/6c -FVw -I"/home/ghexsel/Development/software/golang/src/pkg/runtime" -D_64BIT _cgo_defun.c rm -f _obj/gdkpixbuf.a /home/ghexsel/Development/software/golang/bin/gopack grc _obj/gdkpixbuf.a _go_.6 _cgo_defun.6 cp _obj/gdkpixbuf.a "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdkpixbuf.a" gcc -m64 -fPIC -O2 -o gdkpixbuf.cgo2.o -cpkg-config --cflags gdk-pixbuf-2.0gdkpixbuf.cgo2.c gcc -m64 -o _cgo_.so gdkpixbuf.cgo2.opkg-config --libs gdk-pixbuf-2.0-shared -lpthread -lm cp _cgo_.so "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdkpixbuf.so" rm gdkpixbuf.cgo2.c make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gdkpixbuf'
cd gtk && make install
make[1]: Entering directory /home/ghexsel/Development/code/go/calc/go-gtk/gtk' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags gtk+-2.0-Duintptr="unsigned int*" gtk.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 gtk.cgo1.go _cgo_gotypes.go _cgo_gotypes.go:26: invalid recursive type _C_GList _cgo_gotypes.go:97: invalid recursive type _C_GtkWindow make[1]: *** [_go_.6] Error 1 make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gtk'
make: *** [install] Error 2
_ghexsel@vic-ghexsel-desktop:/Development/code/go/calc/go-gtk$ make clean
cd glib && make clean
make[1]: Entering directory /home/ghexsel/Development/code/go/calc/go-gtk/glib' rm -rf *.o *.a *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export._ _.so _obj _test _testmain.go make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/glib'
cd gdk && make clean
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/gdk' rm -rf *.o *.a *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export._ _.so _obj _test _testmain.go make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gdk'
cd gdkpixbuf && make clean
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/gdkpixbuf' rm -rf *.o *.a *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export._ _.so _obj _test _testmain.go make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gdkpixbuf'
cd gtk && make clean
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/gtk' rm -rf *.o *.a *.[568vq] [568vq].out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export._ _.so _obj _test _testmain.go make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gtk'
cd example && make clean
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/example' cd demo && make clean make[2]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/example/demo'
rm -rf *.o *.a *.[568vq] [568vq].out demo
make[2]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/example/demo' cd twitter && make clean make[2]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/example/twitter'
rm -rf *.o *.a *.[568vq] [568vq].out twitter
make[2]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/example/twitter' make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/example'
ghexsel@vic-ghexsel-desktop:
/Development/code/go/calc/go-gtk$ make install
cd glib && make install
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/glib' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags glib-2.0glib.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 glib.cgo1.go _cgo_gotypes.go /home/ghexsel/Development/software/golang/bin/6c -FVw -I"/home/ghexsel/Development/software/golang/src/pkg/runtime" -D_64BIT _cgo_defun.c rm -f _obj/glib.a /home/ghexsel/Development/software/golang/bin/gopack grc _obj/glib.a _go_.6 _cgo_defun.6 cp _obj/glib.a "/home/ghexsel/Development/software/golang/pkg/linux_amd64/glib.a" gcc -m64 -fPIC -O2 -o glib.cgo2.o -cpkg-config --cflags glib-2.0glib.cgo2.c gcc -m64 -o _cgo_.so glib.cgo2.opkg-config --libs glib-2.0-shared -lpthread -lm cp _cgo_.so "/home/ghexsel/Development/software/golang/pkg/linux_amd64/glib.so" rm glib.cgo2.c make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/glib'
cd gdk && make install
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/gdk' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags gdk-2.0gdk.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 gdk.cgo1.go _cgo_gotypes.go /home/ghexsel/Development/software/golang/bin/6c -FVw -I"/home/ghexsel/Development/software/golang/src/pkg/runtime" -D_64BIT _cgo_defun.c rm -f _obj/gdk.a /home/ghexsel/Development/software/golang/bin/gopack grc _obj/gdk.a _go_.6 _cgo_defun.6 cp _obj/gdk.a "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdk.a" gcc -m64 -fPIC -O2 -o gdk.cgo2.o -cpkg-config --cflags gdk-2.0gdk.cgo2.c gcc -m64 -o _cgo_.so gdk.cgo2.opkg-config --libs gdk-2.0-shared -lpthread -lm cp _cgo_.so "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdk.so" rm gdk.cgo2.c make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gdk'
cd gdkpixbuf && make install
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/gdkpixbuf' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags gdk-pixbuf-2.0gdkpixbuf.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 gdkpixbuf.cgo1.go _cgo_gotypes.go /home/ghexsel/Development/software/golang/bin/6c -FVw -I"/home/ghexsel/Development/software/golang/src/pkg/runtime" -D_64BIT _cgo_defun.c rm -f _obj/gdkpixbuf.a /home/ghexsel/Development/software/golang/bin/gopack grc _obj/gdkpixbuf.a _go_.6 _cgo_defun.6 cp _obj/gdkpixbuf.a "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdkpixbuf.a" gcc -m64 -fPIC -O2 -o gdkpixbuf.cgo2.o -cpkg-config --cflags gdk-pixbuf-2.0gdkpixbuf.cgo2.c gcc -m64 -o _cgo_.so gdkpixbuf.cgo2.opkg-config --libs gdk-pixbuf-2.0-shared -lpthread -lm cp _cgo_.so "/home/ghexsel/Development/software/golang/pkg/linux_amd64/gdkpixbuf.so" rm gdkpixbuf.cgo2.c make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gdkpixbuf'
cd gtk && make install
make[1]: Entering directory/home/ghexsel/Development/code/go/calc/go-gtk/gtk' CGOPKGPATH= /home/ghexsel/Development/software/golang/bin/cgopkg-config --cflags gtk+-2.0-Duintptr="unsigned int_" gtk.go /home/ghexsel/Development/software/golang/bin/6g -o _go_.6 gtk.cgo1.go _cgo_gotypes.go _cgo_gotypes.go:26: invalid recursive type _C_GList _cgo_gotypes.go:97: invalid recursive type _C_GtkWindow make[1]: **\* [_go_.6] Error 1 make[1]: Leaving directory/home/ghexsel/Development/code/go/calc/go-gtk/gtk'
make: *** [install] Error 2

Owner

mattn commented Jun 9, 2010

Hmm, I can't reproduce it.

# export GOARCH=amd64
# cd /path/to/go-gtk/
# make install
... success ...

Perhaps, You may not have latest soruce of go-gtk.

Owner

mattn commented Jun 9, 2010

I found the cause of error.
I'm discussing with others about this issue on github.
Maybe, this is a bug of cgo.

output of cgo on my environment

type _C_GList _Cstruct__GList
type _Cstruct__GList struct {
    data _C_gpointer
    next *_C_GList
    prev *_C_GList
}

But your environment(maybe)

type _Cstruct__GList struct {
    data _C_gpointer
    next *_C_GList
    prev *_C_GList
}
type _C_GList _Cstruct__GList

There is different of order of definition.
This make build error like following.

invalid recursive type _C_GList� 

hexsel commented Jun 10, 2010

Is there anything I can help with?

napsy commented Jun 11, 2010

I now get a similar problem on the latest-go-gtk:

home/luka/bin/6g -o go.6 gtk.cgo1.go _cgo_gotypes.go
_cgo_gotypes.go:97: invalid recursive type _C_GtkWindow
make[1]: *** [go.6] Error 1

napsy commented Jun 20, 2010

Any progress on this?

Owner

mattn commented Jun 21, 2010

Yes, I'm looking.
And I'm checking whether SWIG can be help for this problem.
Please wait.

hernad commented Jul 1, 2010

I have the same problem (ubuntu-devel amd64)

for me, the workaround is
find in "_cgo_gotypes.go" this line:

 type _C_GtkWindow _Cstruct__GtkWindow

move that line to the top of file.

After that compilation is successful

Owner

mattn commented Jul 1, 2010

Thanks.
I want to know why the problem is happend on 64bit only.

Owner

mattn commented Dec 25, 2014

I can't reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment