pekim / gobbi

gobbi is a set of generated Go bindings for gtk et al.
MIT License
28 stars 3 forks source link

main_event_loop.go:55:10: undefined: SOURCE_REMOVE when running "Custom Drawing" Example Code #3

Closed wade-welles closed 5 years ago

wade-welles commented 5 years ago

This is a wonderful project, thank you for investing time into working on this. I'm interested in learning more about GTK and expanding my knowledge so I was experimenting with this and other Go and C GTK software and in my tests I ran into the following error:

$ go run main.go 
# github.com/pekim/gobbi/lib/glib
../../pekim/gobbi/lib/glib/main_event_loop.go:55:10: undefined: SOURCE_REMOVE

I think this is a simple bug fix, I can submit the pull request to fix it if its not already done locally on your machine.

wade-welles commented 5 years ago

So appears to be having issues assigning untyped number C.G_SOURCE_REMOVE to your convenience alias SOURCE_REMOVE.

wade-welles commented 5 years ago

I feel silly, thought the gobbi file in the root was a mistakenly committed binary and not a build shell script. Using this custom methodology is a bit confusing. Maybe calling it build or something other than the name of the parent folder would make it less confusing.

wade-welles commented 5 years ago

Nm still can't build: FAIL github.com/pekim/gobbi/internal/test/gtk 0.146s

pekim commented 5 years ago

You shouldn't need to run the gobbi script to generate the library. The generated code is already committed. So if you have previously run the script with a build argument, you'll probably want to discard any local changes that might have been generated.

A good first step would be to run an example. https://pekim.github.io/gobbi/getting-started/

git clone https://github.com/pekim/gobbi.git
cd gobbi
./gobbi example simple_window

I've just noticed that there's a typo on that page. simple_window should be window_simple.

All that ./gobbi example window_simple ends up doing is the equivalent of something like this.

go run \
  -tags " \
    cairo_1.12 \
    gobject_2.26 \
    glib_2.48 \
    gdk_3.4 \
    gdkpixbuf_2.32 \
    gio_2.36 \
    gtk_3.18 \
    pango_1.38 \
    pangocairo_1.22
  " \
  example/window_simple/main.go

I hope that helps.

pekim commented 5 years ago

I confess that I didn't read the issue's title properly. I now see that the original problem that you were having was with the custom-drawing example.

Do other examples, such as window_simple work?

pekim commented 5 years ago

SOURCE_REMOVE is defined here. https://github.com/pekim/gobbi/blob/aef82e75028c62d9ad274655573b04ae6b61cb21/lib/glib/constant-2.32.go#L16.

I would speculate that one of the following is the reason for your problem.

So it would appear that https://github.com/pekim/gobbi/blob/master/lib/glib/main_event_loop.go requires a minimum glib version of 2.32. Therefore it could benefit from the addition of this build tag comment to enforce the restriction.

// +build glib_2.32 glib_2.34 glib_2.36 glib_2.38 glib_2.40 glib_2.44 glib_2.46 glib_2.48 glib_2.50 glib_2.52 glib_2.54 glib_2.56

I should be able to look in to sorting that out at the weekend.

pekim commented 5 years ago

I have removed an unnecessary dependency on glib 2.32 or later by glib.IdleAddOnce. d42a7bc