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

Stack compiling GTK project #3810

Closed
ImreMD opened this issue Jan 27, 2018 · 5 comments
Closed

Stack compiling GTK project #3810

ImreMD opened this issue Jan 27, 2018 · 5 comments
Milestone

Comments

@ImreMD
Copy link

ImreMD commented Jan 27, 2018

Hello, I have a question related to GTK compiling (note: I am under Windows 10 x64) the program is compiling without problem it's a very simple program just poping a GTK window that's all. When I run it with stack runghc (in a stack shell/ecosystem as I understand) the window appear and everything is fine, but when I try the same with stack exec I have an error message saying: "the procedure entry point inflatValidate could not be located in the DLL ... blah blah ... libpng16-16.dll" . It's probably related to an improper linking of library during compilation, but why it is working in the Stack shell? The stack environment has the good library already linked? Why it cannot use the same set of file during linking/compiling? If needed I can attach the config file or some other information. May be someone encounters the same error.

IM

@mgsloan mgsloan added this to the Support milestone Jan 27, 2018
@mgsloan
Copy link
Contributor

mgsloan commented Jan 27, 2018

runghc runs the code via the interpreter (ghci), so perhaps that is the difference. I assume you are doing stack build before the stack exec?

@ImreMD
Copy link
Author

ImreMD commented Jan 28, 2018

yes, that' right, all the stack "incantation" run smoothly (stack setup, stack build). BTW I fight a lot with dependencies in packages gio against gtk (if I remember well) finally I get to match the proper version this is my stack.yaml extract :
extra-deps:

  • gtk-0.14.7
  • gio-0.13.3.0
  • Cabal-1.24.2.0
  • process-1.4.3.0
  • Win32-2.3.1.1
    I google a lot and the issue is related to some dll, zlib probably (see: [windows] GTK application builds but immediately crashes gtk-rs/gtk#539) which are not the correct one and if I understand all the stack hidden mechanism, the msys2 tool is probably messing something "under the hood", but still it's kind of frustrating to see that ghc shell is managing properly the project but the executable produced by the compilation isn't working.

@Anrock
Copy link

Anrock commented Feb 25, 2018

@ImreMD see workaround here: https://github.com/haskell-gi/haskell-gi/wiki/Using-haskell-gi-in-Windows
Also, been there, #3154

@ImreMD
Copy link
Author

ImreMD commented Mar 10, 2018

Anrock thank you very much, that's working! I suspected that Stack hasn't the proper zlib when running out of the runghc ecosystem, but I am not aware of the internals and do not know from where should I move this zlib1.dll (windows system? stack but where etc... There is a bunch of zlib1 files on a Windows computer).
Just for the record I didn't install a stand alone Msys2 as instructed in the workaround, Stack has it own MSYS2 embedded (I wanted to avoid some potential conflicts) I just pick the zlib1.dll from Stack's MSYS folder and move it to the GHC folder (in the mingw folder as instructed) - I think that there's something to do on a development level just to "sync" this two "ecosystems" embedded into Stack (MSYS and GHC).
I can continue to work on GI powered by Haskell. Great!

@snoyberg
Copy link
Contributor

Sounds like this was resolved, closing

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

4 participants