StefanSalewski / gintro

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

Linking fails on Windows when trying to install via nimble #33

Open define-private-public opened 5 years ago

define-private-public commented 5 years ago
Hint:  [Link]
Hint: operation successful (48056 lines compiled; 1.015 sec total; 92.957MiB peakmem; Debug Build) [SuccessX]
could not load: libgirepository-1.0.dll
stack trace: (most recent call last)
C:\msys64\tmp\nimble_8180\githubcom_stefansalewskigintro\gintro.nimble(74) installBefore
C:\msys64\tmp\nimble_8180\githubcom_stefansalewskigintro\gintro.nimble(62) prep
C:\msys64\home\Benjamin\.bin\nim\lib\system\nimscript.nim(237) exec
C:\msys64\home\Benjamin\.bin\nim\lib\system\nimscript.nim(237, 7) Error: unhandled exception: FAILED: C:\msys64\tmp\gintrosalewski\gen

I installed nim 0.9.12 from source in an MSYS2 environment, and I have the necessary packages that the README told me to install. But I'm getting this error when I try to run nimble install gintro.

StefanSalewski commented 5 years ago

Hello, thanks for testing gintro module.

From message

could not load: libgirepository-1.0.dll

I assume that it is an Microsoft related issue. So it is not easy to debug for me, as I am using Linux only.

Do you really intend to use gintro seriously, or did you try to install just for fun? In the former case I would have to do further investigations, and I am willing to do that. But in the other case, which I assume is much more likely, we should just ignore the issue for now. As you know GTK is not very popular, especially for Windows users, so you may try one of the other Nim GUI libs.

Maybe one additional remark: I just remembered a report of another Windows User one year ago, see

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

He wrote:

install msys2 and run: pacman -S mingw-w64-x86_64-gtk3 then run: pacman -S mingw-w64-x86_64-python3-gobject to get the other required dlls's.

That seems to solve it for him, but of course I do not know if you are using pacman for your Windows. I thing he got an additional issue with GTKSourceView, an optional package, which generally just can be ignored, but I am not sure if my install script ignores it gracefully currently.

alaviss commented 5 years ago

msys2 libgirepository dll is called: libgirepository-1.0-1.dll and not libgirepository-1.0.dll. Correcting the dll name in oldgtk3 should fix it IIRC

StefanSalewski commented 5 years ago

Great info, thanks. Is that new name valid for latest Windows 10 only, or for older releases too. I will try to fix that name soon, thanks.

define-private-public commented 5 years ago

Hi. At the moment, I'm not doing anything serious/professional with Nim at the moment. Qt really is my preferred cross platform GUI toolkit, but making it work with Nim is kind of round-about at the moment. So I think that Gtk is the next best thing. I good cross-platform GUI I think it something that Nim really is lacking (I know about nimx and NiGui, but I don't think that they're quite there yet).

I'd be willing to help out with testing things on Windows in the meantime for you though.

StefanSalewski commented 5 years ago

I'd be willing to help out with testing things on Windows in the meantime for you though.

Yes that would be nice. Maybe for a first step you can search on your computer for libgirepository dll to investigate if it is totally missing or if as alaviss wrote only name was wrong.

Generally, GTK is ok for people already familiar with it and with mainly Linux as target audience. Windows users generally do not like GTK, some are even unable to install it. And learning GTK now from the beginning is hard, as there is only API documentation, but no good books, only minimal tutorial and nearly no community.

define-private-public commented 5 years ago

The name of the DLL on my machine is as @alaviss reports it is. Can you update that code and I'll installing gintro again?

StefanSalewski commented 5 years ago

Should be fixed. Fix is in package oldgtk3 which is used for installation of gintro package.

$ diff gir.nim ~/.nimble/pkgs/oldgtk3-0.1.0/oldgtk3/gir.nim 
7c7
<   const LIB_GIR = "libgirepository-1.0-1.dll"
---
>   const LIB_GIR = "libgirepository-1.0.dll"

A fresh install of gintro should now use the correct dll name.

Unfortunately I just discovered that gintro does not work with latest Nim devel compiler, see

https://github.com/nim-lang/Nim/issues/10296
define-private-public commented 5 years ago

Tested with Nim v0.19.2, works like a charm right now.

During installation of gintro, I did have this output:

Hint: used config file 'C:\msys64\home\Benjamin\.bin\
Hint: system [Processing]
Hint: gen [Processing]
Hint: os [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: algorithm [Processing]
Hint: unicode [Processing]
Hint: times [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: strformat [Processing]
Hint: macros [Processing]
Hint: winlean [Processing]
Hint: dynlib [Processing]
Hint: ospaths [Processing]
Hint: gir [Processing]
Hint: glib [Processing]
Hint: gobject [Processing]
Hint: sequtils [Processing]
Hint: streams [Processing]
Hint: sets [Processing]
Hint: hashes [Processing]
Hint: tables [Processing]
Hint: combinatorics [Processing]
CC: gir
Hint:  [Link]
Hint: operation successful (48056 lines compiled; 4.2
Remaining delayed methods: 0
Remaining delayed methods: 0
Caution: No free/unref found for  ScaledFont (pango_c
Caution: No free/unref found for  ScaledFont (pango_c
Remaining delayed methods: 0
Remaining delayed methods: 0
Remaining delayed methods: 0
Caution: No free/unref found for   (g_value_array_new
Caution: No free/unref found for   (g_value_array_new
Caution: No free/unref found for  ValueArray (g_valueray_copy)
Caution: No free/unref found for   (g_closure_new_obj)
Caution: No free/unref found for   (g_closure_new_obj)
Caution: No free/unref found for   (g_enum_complete_t_info)
Caution: No free/unref found for   (g_flags_complete_e_info)
Remaining delayed methods: 0
Remaining delayed methods: 0
Remaining delayed methods: 0
Remaining delayed methods: 0
Remaining delayed methods: 0
Caution: No free/unref found for  Language (pango_scr_get_sample_language)
Caution: No free/unref found for  Language (pango_scr_get_sample_language)
Caution: No free/unref found for  Language (pango_cont_get_language)
Caution: No free/unref found for  Language (pango_cont_get_language)
Remaining delayed methods: 0
Remaining delayed methods: 0
Remaining delayed methods: 0
Caution: No free/unref found for  Surface (gdk_windoweate_similar_image_surface)
Caution: No free/unref found for  Surface (gdk_windoweate_similar_surface)
Caution: No free/unref found for  Region (gdk_window__clip_region)
Caution: No free/unref found for  Region (gdk_window__clip_region)
Caution: No free/unref found for  Region (gdk_window__update_area)
Caution: No free/unref found for  Region (gdk_window__update_area)
Caution: No free/unref found for  Region (gdk_window__visible_region)
Caution: No free/unref found for  Region (gdk_window__visible_region)
Caution: No free/unref found for  Region (gdk_drawingntext_get_clip)
Caution: No free/unref found for  Region (gdk_drawingntext_get_clip)
Caution: No free/unref found for  Surface (gdk_cursort_surface)
Caution: No free/unref found for  Surface (gdk_cursort_surface)
Caution: No free/unref found for  Context (gdk_cairo_ate)
Caution: No free/unref found for  Region (gdk_cairo_ron_create_from_surface)
Caution: No free/unref found for  Surface (gdk_cairo_face_create_from_pixbuf)
Remaining delayed methods: 0
Caution: No free/unref found for  Region (gtk_widget_ion_intersect)
Caution: No free/unref found for  Surface (gtk_icon_srender_icon_surface)
Caution: No free/unref found for  Language (gtk_text_r_get_language)
Caution: No free/unref found for  Language (gtk_text_r_get_language)
Caution: No free/unref found for  Surface (gtk_tree_v_create_row_drag_icon)
Caution: No free/unref found for  Surface (gtk_icon_v_create_drag_icon)
Caution: No free/unref found for  EventSequence (gtk_ture_single_get_current_sequence)
Caution: No free/unref found for  EventSequence (gtk_ture_single_get_current_sequence)
Caution: No free/unref found for   (gtk_gradient_reso)
Caution: No free/unref found for  Pattern (gtk_gradieresolve_for_context)
Caution: No free/unref found for  Surface (gtk_icon_i_load_surface)
Caution: No free/unref found for  Surface (gtk_icon_te_load_surface)
Remaining delayed methods: 0
Typelib file for namespace 'GtkSource' (any version)  found
Maybe for your OS you have to install additional GTK ated packages?
We continue with the remaining packages...
Typelib file for namespace 'Vte' (any version) not fo
Maybe for your OS you have to install additional GTK ated packages?
We continue with the remaining packages...
  Verifying dependencies for gintro@0.4.7
 Installing gintro@0.4.7
   Success: gintro installed successfully.

It didn't seem to negatively effect anything I tried to run.

When compiling the examples, I'd get some deprecation warnings:

C:\Users\Benjamin\.nimble\pkgs\gintro-0.4.7\gintro\gimpl.nim(86, 24) Warning: sprecated [Deprecated]
C:\Users\Benjamin\.nimble\pkgs\gintro-0.4.7\gintro\gimpl.nim(86, 31) Warning: u: NimNode -> NimNode` instead; getImpl is deprecated [Deprecated]
C:\Users\Benjamin\.nimble\pkgs\gintro-0.4.7\gintro\gimpl.nim(88, 69) Warning: sprecated [Deprecated]
C:\Users\Benjamin\.nimble\pkgs\gintro-0.4.7\gintro\gimpl.nim(88, 76) Warning: u: NimNode -> NimNode` instead; getImpl is deprecated [Deprecated]
C:\Users\Benjamin\.nimble\pkgs\gintro-0.4.7\gintro\gimpl.nim(88, 107) Warning: eprecated [Deprecated]
C:\Users\Benjamin\.nimble\pkgs\gintro-0.4.7\gintro\gimpl.nim(88, 114) Warning: l: NimNode -> NimNode` instead; getImpl is deprecated [Deprecated]

I'll leave it for you to close this issue.

StefanSalewski commented 5 years ago

Thanks for reporting.

Yesterday Araq told me that I have to make a few global variables which are used in gintro macros compileTime to fix the issue with latest devel compiler, then it should work again.

The "getImpl is deprecated" is interesting, have not seen it before, will try to fix that also.

The messages after "Remaining delayed methods: 0" seems to indicate that you have not installed GtkSourceView and Vte Packages/DLL on your box. That is OK, you may indeed not need them, and they are skipped gracefully. (I have to check the messages, there seems to be typos :-( ) If you have some basic knowledge of Windows, you may investigate if and how you can install these two missing packages, so I can add that info to the doc page for other windows users.

msrn1975 commented 2 years ago

Hi,

I got this error, same error with this issue. Hint: gc: refc; opt: none (DEBUG BUILD,-d:release` generates faster code) 69987 lines; 2.290s; 116.887MiB peakmem; proj: C:\Users\masri\AppData\Local\Temp\gintrosalewski\gen.nim; out: C:\Users\masri\AppData\Local\Temp\gintrosalewski\gen.exe [SuccessX] could not load: libgirepository-1.0-1.dll stack trace: (most recent call last) C:\Users\masri\AppData\Local\Temp\nimblecache-0\nimscriptapi_1408302338.nim(199, 29) C:\Users\masri\AppData\Local\Temp\nimble_6160\githubcom_stefansalewskigintro\gintro.nimble(77, 7) installBefore C:\Users\masri\AppData\Local\Temp\nimble_6160\githubcom_stefansalewskigintro\gintro.nimble(64, 7) prep C:\programming\nim-1.6.8\lib\system\nimscript.nim(273, 7) exec C:\programming\nim-1.6.8\lib\system\nimscript.nim(273, 7) Error: unhandled exception: FAILED: C:\Users\masri\AppData\Local\Temp\gintrosalewski\gen 1 [OSError] Warning: Couldn't remove Nimble's temp dir Error: Exception raised during nimble script execution

`

and I checked gir.nim and it have libgirepository-1.0-1.dll

is this same issue?

msrn1975 commented 2 years ago

sorry, managed to solved it with this pacman -S mingw-w64-x86_64-python3-gobject the file is in this package.