deech / fltkhs

Haskell bindings to FLTK GUI toolkit.
MIT License
190 stars 24 forks source link

Fltkhs as stack dependency linking error on Windows 10 #160

Closed ankutalev closed 4 years ago

ankutalev commented 4 years ago

Hello! I want use ftlk as GUI toolkit for my app using stack (version 2.1.3) First, i just tried add -fltkhs in dependencies in package.yaml, but build failed. Then, i do install --flag fltkhs:bundled just as in Windows 10 installation guide, and it installs correctly, Finally, i do stack build, and linker give me very long error log with errors like these: (it's little part of log)

C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x141c5): undefined reference to Fl_Window_Destroy' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x14582): undefined reference toFl_OverriddenWindow_New_WithLabel' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x1472c): undefined reference to Fl_OverriddenWindow_NewXY_WithLabel' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x14a4a): undefined reference toFl_OverriddenWindow_NewXY' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x14dc0): undefined reference to Fl_OverriddenWindow_New' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x15082): undefined reference toFl_Widget_set_flag' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x15212): undefined reference to Fl_Widget_set_flag' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x15cec): undefined reference toFl_Window_default_virtual_funcs' C:\sr\snapshots\a7492722\lib\x86_64-windows-ghc-8.6.5\fltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj/libHSfltkhs-0.8.0.2-6QZopzDXIfhKCTfqsylScj.a(Window.o):fake:(.text+0x16b5a): undefined reference to Fl_Window_size_range_with_args' collect2.exe: error: ld returned 1 exit status gcc.exe' failed in phase `Linker'. (Exit code: 1)

-- While building package raytracer-0.1.0.0 using: C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.5.exe --builddir=.stack-work\dist\e626a42b build exe:raytracer-exe --ghc-options " -fdiagnostics-color=always" Process exited with code: ExitFailure 1

I tried to find genereted dlls, where those functions can be located, but surprisingly for me, i found nothing.

How can i fix this? Or i'm trying to add fltkhs dependency in my project in incorrect way?

Thank you for this project, and sorry if this question dumb kind.

ankutalev commented 4 years ago

If anyone stands with that in future:

copypaste ghc-options from fltks-skeleton app

  - -pgml g++ "-optl-Wl,--allow-multiple-definition" "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"

Fixed the issue.

Thanks for project one more time =)