Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wade-welles opened this issue Mar 27, 2019 · 7 comments

Comments

@wade-welles
Copy link

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
Copy link
Author

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

@wade-welles
Copy link
Author

wade-welles commented Mar 27, 2019

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
Copy link
Author

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

@pekim
Copy link
Owner

pekim commented Mar 27, 2019

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
Copy link
Owner

pekim commented Mar 27, 2019

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
Copy link
Owner

pekim commented Mar 27, 2019

SOURCE_REMOVE is defined here.

const SOURCE_REMOVE bool = false // C.G_SOURCE_REMOVE
.

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

  • you were using a build tag of glib_2.xx, where xx is less that 32
  • you were not using a glib build tag

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
Copy link
Owner

pekim commented Mar 31, 2019

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

@pekim pekim closed this as completed Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants