atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Unable to load package sdl2-2.1.3 #186

Open LukaHorvat opened 7 years ago

LukaHorvat commented 7 years ago

Error checking and getting types doesn't work for my project but it seems that autocomplete does. No errors pop out but when I open the console I get this

haskell-ghc-mod warning: ghc-mod: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib\libSDL2.a: unknown symbol `strdup'

ghc-mod: Could not on-demand load symbol 'SDL_memcpy_REAL'

ghc-mod: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib\libSDL2.a: unknown symbol `SDL_memcpy_REAL'

ghc-mod: Could not on-demand load symbol 'SDL_OpenAudioDevice'

ghc-mod: C:\sr\snapshots\b16d72c4\lib\x86_64-windows-ghc-8.0.1\sdl2-2.1.3-K0k0XX9kdB2gqPoazL1Cf\HSsdl2-2.1.3-K0k0XX9kdB2gqPoazL1Cf.o: unknown symbol `SDL_OpenAudioDevice'

The thing is, the project builds fine. What's more I can't get this error when I run ghc-mod from the command line. For example

 stack exec ghc-mod -- type -c src/Game.hs 60 18
Warning: STACK_EXE set, preferring Stack project
60 16 60 26 "String -> String -> IO (Either CompileError Program)"
60 16 60 40 "String -> IO (Either CompileError Program)"
60 16 60 56 "IO (Either CompileError Program)"
58 46 101 32 "IO ()"
58 40 101 32 "SDL.Window -> IO ()"
58 27 101 32 "IO ()"
58 1 101 32 "Traversable t => Game t -> IO ()"

The project in question is this https://gitlab.com/LukaHorvat/forrest if you want to try and reproduce. I'm running ghc-mod 5.6.0.0. It's not in path. I did stack build ghc-mod inside of the project. GHC 8.0.1 Windows 10.

LukaHorvat commented 7 years ago

A workaround is to place the DLL in the project root.

lierdakil commented 7 years ago

Not entirely sure what causes this, but if I had to guess, this has something to do with PATH management... What DLL are you talking about, specifically?

lierdakil commented 7 years ago

I should correct myself. I'm not as interested in what DLL you're talking about, as where it is located, so post full path to it if possible. Also, if possible, could you post stack path run in project root here?

LukaHorvat commented 7 years ago

Here's the stack path output

stack-root: C:\sr
project-root: C:\Users\darwi\Projects\forrest
config-location: C:\Users\darwi\Projects\forrest\stack.yaml
bin-path: .;C:\sr\snapshots\df48cbae\bin;C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin;C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\mingw\bin;C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin;C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\bin;C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\local\bin;C:\cygwin64\usr\local\bin;C:\cygwin64\bin;C:\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\cmder\vendor\conemu-maximus5;C:\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\cygwin64\bin;C:\Users\darwi\AppData\Local\Microsoft\WindowsApps;C:\Users\darwi\AppData\Local\atom\bin;C:\cmder;C:\Program Files\PostgreSQL\9.6\bin;C:\Users\darwi\AppData\Roaming\local\bin;C:\Users\darwi\AppData\Roaming\npm;C:\adb;C:\cygwin64\bin;C:\Users\darwi\AppData\Local\Microsoft\WindowsApps;C:\Users\darwi\AppData\Local\atom\bin;C:\cmder;C:\Program Files\PostgreSQL\9.6\bin;C:\Users\darwi\AppData\Roaming\local\bin;C:\Users\darwi\AppData\Roaming\npm
programs: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows
compiler-exe: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc.EXE
compiler-bin: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin
local-bin: C:\Users\darwi\AppData\Roaming\local\bin
extra-include-dirs: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include
extra-library-dirs: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib
snapshot-pkg-db: C:\sr\snapshots\df48cbae\pkgdb
local-pkg-db: C:\Users\darwi\Projects\forrest\.stack-work\install\68c2458c\pkgdb
global-pkg-db: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\lib\package.conf.d
ghc-package-path: C:\Users\darwi\Projects\forrest\.stack-work\install\68c2458c\pkgdb;C:\sr\snapshots\df48cbae\pkgdb;C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\lib\package.conf.d
snapshot-install-root: C:\sr\snapshots\df48cbae
local-install-root: C:\Users\darwi\Projects\forrest\.stack-work\install\68c2458c
snapshot-doc-root: C:\sr\snapshots\df48cbae\doc
local-doc-root: C:\Users\darwi\Projects\forrest\.stack-work\install\68c2458c\doc
dist-dir: .stack-work\dist\b7fec021
local-hpc-root: C:\Users\darwi\Projects\forrest\.stack-work\install\68c2458c\hpc
local-bin-path: C:\Users\darwi\AppData\Roaming\local\bin
ghc-paths: C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows

The DLL's path is "C:\Users\darwi\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin\SDL2.dll"

lierdakil commented 7 years ago

Thanks. See if 1.19.2 helps with this. I wanted to avoid using whole bin-path, but maybe there's still a way to dance around.

LukaHorvat commented 7 years ago

Hmm, it didn't seem to make a difference.

lierdakil commented 7 years ago

That's strange, I could've sworn this should work reasonably well. Okay then, I'll try to find a Windows to test this on in the next couple days. Either I'm misunderstanding how Windows searches for DLLs, or I messed up somewhere. Sorry about that.

lierdakil commented 7 years ago

Also, just to make sure, did you restart Atom after upgrade to 1.19.2? This might make a difference.

LukaHorvat commented 7 years ago

Yeah, I've restarted it.

On Wed, Nov 16, 2016 at 9:36 PM Nikolay Yakimov notifications@github.com wrote:

Also, just to make sure, did you restart Atom after upgrade to 1.19.2? This might make a difference.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/atom-haskell/haskell-ghc-mod/issues/186#issuecomment-261064130, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWnw8XobSYtDot6_M4C1hon-2t6woQAks5q-2lPgaJpZM4Kk7-E .