StefanSalewski / gintro

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

"nimble install gobject" failed on windows #38

Open retsyo opened 5 years ago

retsyo commented 5 years ago

MSYS2 + MINGW64 on windows 7 64bits

USER@USER-PC MINGW64 ~
$ nimble install gintro
Downloading https://github.com/stefansalewski/gintro using git
preparing gintro
--2019-01-22 22:08:26--  https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gobject.nim
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16350 (16K) [text/plain]
Saving to: ‘gobject.nim’

gobject.nim            100%[============================>]  15.97K  48.2KB/s    in 0.3s

2019-01-22 22:08:29 (48.2 KB/s) - ‘gobject.nim’ saved [16350/16350]

--2019-01-22 22:08:29--  https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/glib.nim
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 42591 (42K) [text/plain]
Saving to: ‘glib.nim’

glib.nim               100%[============================>]  41.59K  60.0KB/s    in 0.7s

2019-01-22 22:08:31 (60.0 KB/s) - ‘glib.nim’ saved [42591/42591]

--2019-01-22 22:08:31--  https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gir.nim
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5569 (5.4K) [text/plain]
Saving to: ‘gir.nim’

gir.nim                100%[============================>]   5.44K  --.-KB/s    in 0.002s

2019-01-22 22:08:34 (3.05 MB/s) - ‘gir.nim’ saved [5569/5569]

Hint: used config file 'E:\msys64\home\USER\_nim\nim\config\nim.cfg' [Conf]
Hint: used config file 'E:\msys64\home\USER\_nim\nim\config\config.nims' [Conf]
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: pathnorm [Processing]
Hint: osseps [Processing]
Hint: winlean [Processing]
Hint: dynlib [Processing]
Hint: times [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: strformat [Processing]
Hint: macros [Processing]
Hint: gir [Processing]
gir.nim(1, 1) Error: invalid token:  (\31)
stack trace: (most recent call last)
E:\msys64\tmp\nimble_383780\githubcom_stefansalewskigintro\gintro.nimble(75) installBefore
E:\msys64\tmp\nimble_383780\githubcom_stefansalewskigintro\gintro.nimble(61) prep
E:\msys64\home\USER\_nim\nim\lib\system\nimscript.nim(238) exec
E:\msys64\home\USER\_nim\nim\lib\system\nimscript.nim(238, 7) Error: unhandled exception: FAILED: nim c gen.nim

then I found that gir.nim, glib.nim and gobject.nim actually GZIP files. If I decompress them I can do nim c gen.nim and get gen.exe

but what is the next step?

StefanSalewski commented 5 years ago

Thanks for reporting.

I found that gir.nim, glib.nim and gobject.nim actually GZIP files.

That is strange, I have to investigate that.

Note that GTK for Nim is not really recommended for unexperienced people and Windows users. GTK community is not very active generally, Windows users do not love GTK that much, and learning GTK today for beginners is not that easy, no book, only minimal C tutorials, no community.

For your current problem: For the initial downloading wget or nimgrab is used. I guess that for your windows wget is not available, so nimgrab is used. That one should deliver plain text files, no GZIP. I have to investigate.

StefanSalewski commented 5 years ago

No, my initial guess was wrong:

--2019-01-22 22:08:31--  https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gir.nim
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5569 (5.4K) [text/plain]
Saving to: ‘gir.nim’

It seems that you have a windows version of wget which is not working correctly, it thinks it gets plain text, but indeed requested gzip compression.

What you may do: hide your gzip is some way, so that nimgrab is used. Or find a way to tell your wget to get the files uncompressed. You can test it from shell window by commands as used in gintro.nimble like

wget https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gir.nim -O gir.nim
retsyo commented 5 years ago

I updated wget, now the nim files are actually TEXT files.

USER@USER-PC MINGW64 /mingw64/bin
$ whereis libgirepository-1.0-1.dll
libgirepository-1.0-1: /mingw64/bin/libgirepository-1.0-1.dll

USER@USER-PC MINGW64 /mingw64/bin
$ export PATH=/mingw64/bin:$PATH

USER@USER-PC MINGW64 /mingw64/bin
$ nimble install gintro

gen.nim(1380, 9) Hint: 'h' is declared but not used [XDeclaredButNotUsed]
Hint:  [Link]
Hint: operation successful (54401 lines compiled; 2.496 sec total; 91.625MiB peakmem; Debug Build) [SuccessX]
could not load: libgirepository-1.0-1.dll
stack trace: (most recent call last)
E:\msys64\tmp\nimble_593824\githubcom_stefansalewskigintro\gintro.nimble(75) installBefore
E:\msys64\tmp\nimble_593824\githubcom_stefansalewskigintro\gintro.nimble(63) prep
E:\msys64\home\USER\_nim\nim\lib\system\nimscript.nim(238) exec
E:\msys64\home\USER\_nim\nim\lib\system\nimscript.nim(238, 7) Error: unhandled exception: FAILED: E:\msys64\tmp\gintrosalewski\gen
StefanSalewski commented 5 years ago

You may have to restart your terminal to new Path become active? I don't know much about Windows...

At least you have to ensure that libgirepository-1.0-1.dll could be loaded, and it is not.

StefanSalewski commented 5 years ago

Araq just note that you have to ensure that your DLL matches your OS, 32 vs 64 bit issue, see

https://irclogs.nim-lang.org/23-01-2019.html#14:14:30

retsyo commented 5 years ago

my nim and gcc are 64bits, the produced gen.exe is for AMD64 too the only libgirepository-1.0-1.dll is 64bits

I don't know which real Windows tools can be used except for the so said msys clusterfuck

ok, forget it, I give up to use GTK

btw, it seems that there is no many nim users on Windows

StefanSalewski commented 5 years ago

ok, forget it, I give up to use GTK

I think that is a good idea for you.

btw, it seems that there is no many nim users on Windows

No, I think there are more Windows users than Linux users, Araq itself uses Windows. But not many Nim people are doing GUI stuff at all.

StefanSalewski commented 5 years ago

I just noted that your Path definition is different as given here:

http://www.mingw.org/wiki/HOWTO_Specify_the_Location_of_Libraries_for_use_with_MinGW

$ export LIBRARY_PATH $ LIBRARY_PATH="C:/mingw/local/lib;$LIBRARY_PATH"