StefanSalewski / gintro

High level GObject-Introspection based GTK3/GTK4 bindings for Nim language
MIT License
297 stars 20 forks source link

[error] Linux/gtk3 undeclared identifier: 'Rectangle #62

Open nodrygo opened 4 years ago

nodrygo commented 4 years ago

Hello I wanted to test gintro who seem really good but can't make demo on my Linux Mint19 see below do you have some idea ? thank's for your help and this lib

tested on Nim 1.0.4 and lastest Nim1.1.1 last git gintro nim c -r label.nim gintro-0.6.1/gintro/cairoimpl.nim(646, 22) Error: undeclared identifier: 'Rectangle

same error occur with makeAll (last line)

Hint: used config file '/home/ygo/dev/nim/nim-1.0.4/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: celldatafunction [Processing]
Hint: gtk [Processing]
Hint: pango [Processing]
Hint: cairo [Processing]
Hint: gobject [Processing]
Hint: glib [Processing]
Hint: times [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: macros [Processing]
Hint: algorithm [Processing]
Hint: unicode [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: posix [Processing]
~/.nimble/pkgs/gintro-0.6.1/gintro/cairoimpl.nim(646, 22) Error: undeclared identifier: 'Rectangle

by the way during nimble install got this error

** (process:6918): CRITICAL **: 19:51:00.465: g_irepository_get_shared_library: assertion 'typelib != NULL' failed
StefanSalewski commented 4 years ago

Oh, seems to be again

https://github.com/StefanSalewski/gintro/issues/60

I have intentionally not closed that one, but its author closed it.

If you live in the free world, then try to get a recent gtk version. If you are from China, then I can currently not really help you, sorry. Tomorrow I will ship version 0.7 with ARC support!

StefanSalewski commented 4 years ago

The other typelib error I will investigate tomorow in more detail...

StefanSalewski commented 4 years ago

I hope you have fixed your issue by using a recent gtk version now or by following #issue60 and the related forum posts. Your gtk must be really old, older than one year at least.

For the typelib issue I would have tow guesses: Maybe your gtk is so old that there is no cairo support at all. Or maybe you have no gtksourceview support by default -- some distros have separate dev packages for gtksourceview. It would be hard for me to examine this in detail.

Note that I do not really recommend gintro for all users. There are many other GUI packages now, see nimble search gui and https://github.com/nim-lang/Nim/wiki/Curated-Packages

nodrygo commented 4 years ago

hello thanks for your answer I am on the gtk 3.22.30 provided by Mint 19.1 I have tested some other package but no one is as finished as gtk is ;-) except probably niup but some other problems here also with libm and libgc I am not using it professionally so no problem using gintro thanks again for this library (but gtk 3.24 seem not well finished so I will continue my personal coding with Go/gotk3)

define-private-public commented 4 years ago

Hi, this is happening for me as well right now too.

StefanSalewski commented 4 years ago

Well, and the solution is still obviously: Use a recent GTK, not one much older than a year.

I would care for this problem if there would be many complaints from china or poor african states, but I think all came from the free and rich world, where a recent GTK should be available.

Other solutions have been described, one was removing the include statement in cairo.nim, the other using an older gintro version.

nodrygo commented 4 years ago

unfortunately the latest version is not necessarily the official version for some distributions. Ubuntu have preferred some back-port for stability reasons

I found a simple solution, just adding these lines (from line 108) in

gintro / cairoimpl.nim

may be not a good solution but this works very well for me (I had same problem and bring same solution for Crystal Lang, unfortunately Crystal doesn't work on Windows )

type
     Rectangle = ref object of RootObj
         x: float64
         y: float64
         width: float64
         height: float64
StefanSalewski commented 4 years ago

I would have assumed that much more than just Rectangle type is missing. But maybe the other missing data types are not needed directly. Fine that it works for you.

The reason for the problem is, that cairo is not really supported by gobject-introspection. In old GTK it was nearly unsupported, but in newer GTK at least the elementary data types are provided. Initially I had created the whole cairo module manually by c2nim, now I take the types provided by gobject-introspection from there.

nodrygo commented 4 years ago

Thanks for your answer My needs are limited so that's enough for me

Very good work so please continue

No sure GTK future will be. GTK4 seem not to be closed to be released so we will see. Some distribution prefer to remain on ancient version more stable so this is important to support them ;-)

Le dim. 12 avr. 2020 à 14:24, StefanSalewski notifications@github.com a écrit :

I would have assumed that much more than just Rectangle type is missing. But maybe the other missing data types are not needed directly. Fine that it works for you.

The reason for the problem is, that cairo is not really supported by gobject-introspection. In old GTK it was nearly unsupported, but in newer GTK at least the elementary data types are provided. Initially I had created the whole cairo module manually by c2nim, now I take the types provided by gobject-introspection from there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/StefanSalewski/gintro/issues/62#issuecomment-612606396, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGFC7XNFGTMF6I5K746ZJTRMGXGPANCNFSM4KLSL4JA .