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

Windows 10 build error #9

Open
ysitbon opened this issue Oct 1, 2018 · 9 comments
Open

Windows 10 build error #9

ysitbon opened this issue Oct 1, 2018 · 9 comments

Comments

@ysitbon
Copy link

ysitbon commented Oct 1, 2018

Was trying to build a project to experience haskell game programming https://github.com/jxv/dino-rush but it failed when trying building sdl2-image:

  • Stack 1.7.1
  • Windows 10 N 64-bit

It seems to be the same issue as #7 which was fixed with this pull request #8. As an haskell beginner I can probably talk about things that I misunderstood but is Stackage up to date with the latest fix?

Here my build logs:

...skiping all the successfull build logs
sdl2-2.4.1.0: download                                                                                                                                                                                                                       
sdl2-2.4.1.0: configure                                                                                                                                                                                                                      
sdl2-2.4.1.0: build                                                                                                                                                                                                                          
sdl2-2.4.1.0: copy/register                                                                                                                                                                                                                  
sdl2-ttf-2.0.2: download                                                                                                                                                                                                                     
sdl2-mixer-1.1.0: download                                                                                                                                                                                                                   
sdl2-image-2.0.0: download                                                                                                                                                                                                                   
sdl2-ttf-2.0.2: configure                                                                                                                                                                                                                    
sdl2-ttf-2.0.2: build                                                                                                                                                                                                                        
sdl2-image-2.0.0: configure                                                                                                                                                                                                                  
sdl2-mixer-1.1.0: configure                                                                                                                                                                                                                  
sdl2-image-2.0.0: build                                                                                                                                                                                                                      
sdl2-mixer-1.1.0: build                                                                                                                                                                                                                      
sdl2-ttf-2.0.2: copy/register                                                                                                                                                                                                                
sdl2-mixer-1.1.0: copy/register                                                                                                                                                                                                              
Progress 54/55                                                                                                                                                                                                                               
                                                                                                                                                                                                                                             
--  While building custom Setup.hs for package sdl2-image-2.0.0 using:                                                                                                                                                                       
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe --builddir=.stack-work\dist\7d103d30 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"                                       
    Process exited with code: ExitFailure 1                                                                                                                                                                                                  
    Logs have been written to: F:\Yoann\documents\apps\dino-rush\.stack-work\logs\sdl2-image-2.0.0.log                                                                                                                                       
                                                                                                                                                                                                                                             
    Configuring sdl2-image-2.0.0...                                                                                                                                                                                                          
    Preprocessing library for sdl2-image-2.0.0..                                                                                                                                                                                             
    In file included from C:/Users/Yoann/AppData/Local/Programs/stack/x86_64-windows/msys2-20180531/mingw64/include/SDL2/SDL.h:32:0,                                                                                                         
                     from C:/Users/Yoann/AppData/Local/Programs/stack/x86_64-windows/msys2-20180531/mingw64/include/SDL2/SDL_image.h:27,                                                                                                     
                     from Image.hsc:71:                                                                                                                                                                                                      
    C:/Users/Yoann/AppData/Local/Programs/stack/x86_64-windows/msys2-20180531/mingw64/include/SDL2/SDL_main.h:111:17: error: conflicting types for 'SDL_main'                                                                                
     #define main    SDL_main                                                                                                                                                                                                                
                     ^                                                                                                                                                                                                                       
    C:\Users\Yoann\AppData\Local\Temp\stack9068\sdl2-image-2.0.0\Image.hsc:73:5: note: in expansion of macro 'main'                                                                                                                          
    C:/Users/Yoann/AppData/Local/Programs/stack/x86_64-windows/msys2-20180531/mingw64/include/SDL2/SDL_main.h:117:39: note: previous declaration of 'SDL_main' was here                                                                      
     extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);                                                                                                                                                                 
                                           ^~~~~~~~                                                                                                                                                                                          
    compiling .stack-work\dist\7d103d30\build\SDL\Raw\Image_hsc_make.c failed (exit code 1)                                                                                                                                                  
    command was: C:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib/../mingw/bin\gcc.exe -c .stack-work\dist\7d103d30\build\SDL\Raw\Image_hsc_make.c -o .stack-work\dist\7d103d30\build\SDL\Raw\Image_hsc_make.o -fno-s
ack-protector -D__GLASGOW_HASKELL__=804 -Dmingw32_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dmingw32_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:/Users/Yoann/AppD
ta/Local/Programs/stack/x86_64-windows/msys2-20180531/mingw64/include/SDL2 -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:/Users/Yoann/AppData/Local/Programs/stack/x86_64-windows/msys2-201
0531/mingw64/include/SDL2 -Dmain=SDL_main -I.stack-work\dist\7d103d30\build\autogen -I.stack-work\dist\7d103d30\build\global-autogen -include .stack-work\dist\7d103d30\build\autogen\cabal_macros.h -IC:\Users\Yoann\AppData\Local\Programs\
tack\x86_64-windows\msys2-20180531\mingw64\include -IC:/Users/Yoann/AppData/Local/Programs/stack/x86_64-windows/msys2-20180531/mingw64/include/SDL2 -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\inclu
e -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\sr\snapshots\03cb0bbe\lib\x86_64-windows-ghc-8
4.3\vector-0.12.0.1-4awQG9XUvVEBfJgKGHBhOb\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I
:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-win
ows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\A
pData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\sr\snapshots\03cb0bbe\lib\x86_64-windows-ghc-8.4.3\primitive-0.6.3.0-DaZpcxwJp2TGn8ITSgfI4C\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-window
\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib\time-1.8.0.2\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\
ppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-2018
531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Pr
grams\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\inc
ude -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86
64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\
oann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys
-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\Yoann\AppData\Lo
al\Programs\stack\x86_64-windows\ghc-8.4.3\lib\Win32-2.6.1.0\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib\bytestring-0.10.8.2\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys
-20150512\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib\base-4.11.1.0\include -IC:\Users\Yoann\AppDa
a\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib\integer-gmp-1.0.2.0\include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib/include -IC:\Users\Yoann\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3/lib
include/                                                                                                                                                                                                                                     
@schell
Copy link

schell commented Oct 3, 2018

@jxv dino rush love :)

@amras0000
Copy link

I had the same error. The gccflags proposed in the referenced issue do solve it, however they were not called by default on my Windows10 machine.

I had to remove the line if(windows) from the sdl2-image.cabal file before the library would build.

@ysitbon
Copy link
Author

ysitbon commented Dec 12, 2018

Sorry for the late feedback. I didn't have time to play with for a few months... Was extremely busy at work. I can confirm that the if os(windows) condition is not working on Windows 10. I removed this line like suggested (thank you @amras0000), unindented the cpp-options property and then it was building properly.

@Krantz-XRF
Copy link
Contributor

Same error occurred in stack Version 1.9.3 (Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1) .

But I have no idea how to modify the sdl2-image.cabal file, for I am using stack, and I found no cabal file presented. It seems that these files are cleaned by stack after every unsuccessful build.

Is there a schedule when this issue will be fixed? Or is there a temporary workaround for stack?

@ysitbon
Copy link
Author

ysitbon commented Jan 21, 2019

@Krantz-XRF I ran into the same issue. You will found the anwer to your question here:
https://stackoverflow.com/questions/32849269/how-to-install-use-a-local-version-of-package-using-stack

@Krantz-XRF
Copy link
Contributor

@ysaskia Thanks for your response, but another strange problem occurs. I downloaded this repository as a zip package and unzipped it to my project directory as that StackOverflow answer suggests.

But when I run stack build in that directory, it takes literally forever to finish compiling. I looked into the compiling process and found that the .hsc files are correctly converted into .hs, but then GHC hangs for some unknown reason. (I waited for about 2 hours, and it didn't finish compiling yet.)

FYI, I used lts-13.3 as the build plan, but I don't think this really matters.

@Krantz-XRF
Copy link
Contributor

I have fixed the compiling problems by manually write the Haskell bindings for those SDL_image APIs. I rewrote the SDL.Raw.Image module to get rid of those Template-Haskells and it finished compiling in several minutes. I guess there are some problems in the function liftF, or there are some bugs in my GHC's Template-Haskell.

Strangely enough, same problem didn't occur when I compiled this library on Linux.

@tjlaxs
Copy link

tjlaxs commented Sep 8, 2019

While the stackage is not updated this can be fixed also by adding to stack.yaml extra-deps like:

extra-deps:
- git: https://github.com/haskell-game/sdl2-image.git
  commit: 382395c763b473032721c71921b5c9241142178f

Compiled pretty fast with lts-14.4 resolver.

@sullyj3
Copy link

sullyj3 commented Nov 21, 2019

Any word on when this will be added to the resolver?

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

6 participants